From 3b8c95a94ed2a6e6fdd34f265214f1291a51d76b Mon Sep 17 00:00:00 2001 From: Amiram_se Date: Thu, 8 Oct 2026 22:36:22 +0400 Subject: [PATCH] feat(apps): checkout, payment, subscriptions, transactions and notifications routes in bull and bear Co-Authored-By: Claude Opus 5.5 --- .../app/(flow)/checkout/[username]/.gitkeep | 0 .../(flow)/checkout/[username]/loading.tsx | 33 +++++++++++ .../app/(flow)/checkout/[username]/page.tsx | 35 ++++++++++++ .../checkout-template/CheckoutTemplate.tsx | 56 ++++++++++++++++++ .../templates/checkout-template/index.ts | 2 + .../templates/checkout-template/types.ts | 3 + .../payment/result/[paymentId]/loading.tsx | 26 +++++++++ .../payment/result/[paymentId]/page.tsx | 56 ++++++++++++++++++ .../src/app/(flow)/payment/return/.gitkeep | 0 .../src/app/(flow)/payment/return/loading.tsx | 16 ++++++ .../src/app/(flow)/payment/return/page.tsx | 46 +++++++++++++++ .../app/(flow)/terms/subscription/loading.tsx | 19 +++++++ .../app/(flow)/terms/subscription/page.tsx | 57 +++++++++++++++++++ .../(investor)/subscriptions/.gitkeep | 0 .../(investor)/subscriptions/loading.tsx | 15 +++++ .../(investor)/subscriptions/page.tsx | 43 ++++++++++++++ .../(investor)/transactions/.gitkeep | 0 .../(investor)/transactions/loading.tsx | 16 ++++++ .../(investor)/transactions/page.tsx | 44 ++++++++++++++ .../src/app/(main)/notifications/loading.tsx | 26 +++++++++ .../src/app/(main)/notifications/page.tsx | 54 ++++++++++++++++++ .../app/(main)/terms/subscription/.gitkeep | 0 .../app/(flow)/checkout/[username]/.gitkeep | 0 .../(flow)/checkout/[username]/loading.tsx | 22 +++++++ .../app/(flow)/checkout/[username]/page.tsx | 35 ++++++++++++ .../checkout-template/CheckoutTemplate.tsx | 37 ++++++++++++ .../templates/checkout-template/index.ts | 2 + .../templates/checkout-template/types.ts | 3 + .../payment/result/[paymentId]/loading.tsx | 20 +++++++ .../payment/result/[paymentId]/page.tsx | 52 +++++++++++++++++ .../src/app/(flow)/payment/return/.gitkeep | 0 .../src/app/(flow)/payment/return/loading.tsx | 16 ++++++ .../src/app/(flow)/payment/return/page.tsx | 46 +++++++++++++++ .../app/(flow)/terms/subscription/loading.tsx | 19 +++++++ .../app/(flow)/terms/subscription/page.tsx | 47 +++++++++++++++ .../(investor)/subscriptions/.gitkeep | 0 .../(investor)/subscriptions/loading.tsx | 15 +++++ .../(investor)/subscriptions/page.tsx | 43 ++++++++++++++ .../(investor)/transactions/.gitkeep | 0 .../(investor)/transactions/loading.tsx | 16 ++++++ .../(investor)/transactions/page.tsx | 44 ++++++++++++++ .../src/app/(main)/notifications/loading.tsx | 22 +++++++ .../src/app/(main)/notifications/page.tsx | 49 ++++++++++++++++ .../app/(main)/terms/subscription/.gitkeep | 0 44 files changed, 1035 insertions(+) delete mode 100644 apps/bear/src/app/(flow)/checkout/[username]/.gitkeep create mode 100644 apps/bear/src/app/(flow)/checkout/[username]/loading.tsx create mode 100644 apps/bear/src/app/(flow)/checkout/[username]/page.tsx create mode 100644 apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx create mode 100644 apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/index.ts create mode 100644 apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/types.ts create mode 100644 apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx create mode 100644 apps/bear/src/app/(flow)/payment/result/[paymentId]/page.tsx delete mode 100644 apps/bear/src/app/(flow)/payment/return/.gitkeep create mode 100644 apps/bear/src/app/(flow)/payment/return/loading.tsx create mode 100644 apps/bear/src/app/(flow)/payment/return/page.tsx create mode 100644 apps/bear/src/app/(flow)/terms/subscription/loading.tsx create mode 100644 apps/bear/src/app/(flow)/terms/subscription/page.tsx delete mode 100644 apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/.gitkeep create mode 100644 apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/loading.tsx create mode 100644 apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx delete mode 100644 apps/bear/src/app/(main)/dashboard/(investor)/transactions/.gitkeep create mode 100644 apps/bear/src/app/(main)/dashboard/(investor)/transactions/loading.tsx create mode 100644 apps/bear/src/app/(main)/dashboard/(investor)/transactions/page.tsx create mode 100644 apps/bear/src/app/(main)/notifications/loading.tsx create mode 100644 apps/bear/src/app/(main)/notifications/page.tsx delete mode 100644 apps/bear/src/app/(main)/terms/subscription/.gitkeep delete mode 100644 apps/bull/src/app/(flow)/checkout/[username]/.gitkeep create mode 100644 apps/bull/src/app/(flow)/checkout/[username]/loading.tsx create mode 100644 apps/bull/src/app/(flow)/checkout/[username]/page.tsx create mode 100644 apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx create mode 100644 apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/index.ts create mode 100644 apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/types.ts create mode 100644 apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx create mode 100644 apps/bull/src/app/(flow)/payment/result/[paymentId]/page.tsx delete mode 100644 apps/bull/src/app/(flow)/payment/return/.gitkeep create mode 100644 apps/bull/src/app/(flow)/payment/return/loading.tsx create mode 100644 apps/bull/src/app/(flow)/payment/return/page.tsx create mode 100644 apps/bull/src/app/(flow)/terms/subscription/loading.tsx create mode 100644 apps/bull/src/app/(flow)/terms/subscription/page.tsx delete mode 100644 apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/.gitkeep create mode 100644 apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/loading.tsx create mode 100644 apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx delete mode 100644 apps/bull/src/app/(main)/dashboard/(investor)/transactions/.gitkeep create mode 100644 apps/bull/src/app/(main)/dashboard/(investor)/transactions/loading.tsx create mode 100644 apps/bull/src/app/(main)/dashboard/(investor)/transactions/page.tsx create mode 100644 apps/bull/src/app/(main)/notifications/loading.tsx create mode 100644 apps/bull/src/app/(main)/notifications/page.tsx delete mode 100644 apps/bull/src/app/(main)/terms/subscription/.gitkeep diff --git a/apps/bear/src/app/(flow)/checkout/[username]/.gitkeep b/apps/bear/src/app/(flow)/checkout/[username]/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bear/src/app/(flow)/checkout/[username]/loading.tsx b/apps/bear/src/app/(flow)/checkout/[username]/loading.tsx new file mode 100644 index 0000000..50003df --- /dev/null +++ b/apps/bear/src/app/(flow)/checkout/[username]/loading.tsx @@ -0,0 +1,33 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { DesktopHeader, DesktopPageTitle } from '@lumina/market/app/navigation'; +import { CheckoutCreatorSkeleton } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-creator'; +import { CheckoutSkeleton } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-panel'; + +import { i18n } from '../../../../i18n'; + +/** Checkout before the page arrives, block for block, in its 480 column. */ +export default function Loading() { + return ( + + + + + + } + label={i18n.t('payment:checkout.loading')} + /> + + + + ); +} diff --git a/apps/bear/src/app/(flow)/checkout/[username]/page.tsx b/apps/bear/src/app/(flow)/checkout/[username]/page.tsx new file mode 100644 index 0000000..5c80174 --- /dev/null +++ b/apps/bear/src/app/(flow)/checkout/[username]/page.tsx @@ -0,0 +1,35 @@ +import { ROUTES } from '@lumina/market/app/navigation'; +import { getChannel, readOnServer } from '@lumina/market/server'; +import { toChannelUsername } from '@lumina/market/shared/utils'; +import type { Metadata } from 'next'; +import { notFound, permanentRedirect, redirect } from 'next/navigation'; + +import { i18n } from '../../../../i18n'; +import { CheckoutTemplate } from './templates/checkout-template'; + +type CheckoutPageProps = { params: Promise<{ username: string }> }; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('payment:checkout.title'), + robots: { index: false }, + }; +} + +/** + * Checkout for a creator's channel (U9), reached only from its «اشتراک». The server renders the + * same page for everyone: the bar and who is being paid; the investor's own checkout loads in the + * browser. Another spelling of the username redirects to the stored one; a suspended channel + * sends the visitor to the channel, which says it is unavailable. + */ +export default async function CheckoutPage({ params }: CheckoutPageProps) { + const segment = (await params).username; + const username = toChannelUsername(segment); + if (!username) notFound(); + if (username !== segment) permanentRedirect(ROUTES.checkout(username)); + const channel = await readOnServer(() => getChannel(username)); + if (channel.status !== 'ok') notFound(); + if (channel.data.suspended) redirect(ROUTES.channel(username)); + + return ; +} diff --git a/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx b/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx new file mode 100644 index 0000000..73d922f --- /dev/null +++ b/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx @@ -0,0 +1,56 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { + DesktopHeader, + DesktopPageTitle, + ROUTES, +} from '@lumina/market/app/navigation'; +import { CheckoutCreator } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-creator'; +import { CheckoutPanel } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-panel'; + +import { i18n } from '../../../../../../i18n'; +import type { CheckoutTemplateProps } from './types'; + +/** + * Checkout on desktop (U9 ۹.۱): one centred column of 480 under the header, back beside the + * title, and the pay block stuck to the bottom of the window while the tiers scroll. + */ +export function CheckoutTemplate({ channel }: CheckoutTemplateProps) { + const t = i18n.getFixedT(null, 'payment'); + + return ( + + + + + + + + } + /> + + + + + ); +} diff --git a/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/index.ts b/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/index.ts new file mode 100644 index 0000000..4415cca --- /dev/null +++ b/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/index.ts @@ -0,0 +1,2 @@ +export { CheckoutTemplate } from './CheckoutTemplate'; +export type { CheckoutTemplateProps } from './types'; diff --git a/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/types.ts b/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/types.ts new file mode 100644 index 0000000..efd0409 --- /dev/null +++ b/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/types.ts @@ -0,0 +1,3 @@ +import type { PublicCreatorPayload } from '@lumina/market/features/channel'; + +export type CheckoutTemplateProps = { channel: PublicCreatorPayload }; diff --git a/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx b/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx new file mode 100644 index 0000000..1f33abb --- /dev/null +++ b/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx @@ -0,0 +1,26 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { DesktopHeader } from '@lumina/market/app/navigation'; +import { PaymentResultSkeleton } from '@lumina/market/app/screens/(flow)/payment/result/[paymentId]/organisms/payment-result'; + +import { i18n } from '../../../../../i18n'; + +/** The result before the page arrives, in its 480 column. */ +export default function Loading() { + return ( + + + + + + + + + ); +} diff --git a/apps/bear/src/app/(flow)/payment/result/[paymentId]/page.tsx b/apps/bear/src/app/(flow)/payment/result/[paymentId]/page.tsx new file mode 100644 index 0000000..1d129a7 --- /dev/null +++ b/apps/bear/src/app/(flow)/payment/result/[paymentId]/page.tsx @@ -0,0 +1,56 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { DesktopHeader } from '@lumina/market/app/navigation'; +import { + PaymentResult, + PaymentResultSkeleton, +} from '@lumina/market/app/screens/(flow)/payment/result/[paymentId]/organisms/payment-result'; +import type { Metadata } from 'next'; + +import { i18n } from '../../../../../i18n'; + +type PaymentResultPageProps = { params: Promise<{ paymentId: string }> }; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('payment:result.meta-title'), + robots: { index: false }, + }; +} + +/** «نتیجه پرداخت» on desktop (U10 ۹.۴, ۹.۵): one panel in the 480 column under the header. */ +export default async function PaymentResultPage({ + params, +}: PaymentResultPageProps) { + const { paymentId } = await params; + const skeleton = ( + + ); + + return ( + + + + + + + + + + + + + ); +} diff --git a/apps/bear/src/app/(flow)/payment/return/.gitkeep b/apps/bear/src/app/(flow)/payment/return/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bear/src/app/(flow)/payment/return/loading.tsx b/apps/bear/src/app/(flow)/payment/return/loading.tsx new file mode 100644 index 0000000..ca5aa0e --- /dev/null +++ b/apps/bear/src/app/(flow)/payment/return/loading.tsx @@ -0,0 +1,16 @@ +import { PaymentConfirming } from '@lumina/market/app/screens/(flow)/payment/return/organisms/payment-confirming'; + +import { i18n } from '../../../../i18n'; + +/** The confirming screen itself: nothing else may show on the way back from the bank. */ +export default function Loading() { + return ( + + ); +} diff --git a/apps/bear/src/app/(flow)/payment/return/page.tsx b/apps/bear/src/app/(flow)/payment/return/page.tsx new file mode 100644 index 0000000..ab382cc --- /dev/null +++ b/apps/bear/src/app/(flow)/payment/return/page.tsx @@ -0,0 +1,46 @@ +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { PaymentConfirming } from '@lumina/market/app/screens/(flow)/payment/return/organisms/payment-confirming'; +import { PaymentReturn } from '@lumina/market/app/screens/(flow)/payment/return/organisms/payment-return'; +import type { Metadata } from 'next'; + +import { i18n } from '../../../../i18n'; + +type PaymentReturnPageProps = { + searchParams: Promise<{ paymentId?: string | string[] }>; +}; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('payment:confirm.meta-title'), + robots: { index: false }, + }; +} + +/** + * Back from the bank (U10 ۱.۱): «در حال تأیید پرداخت...» while the payment settles, then its + * result page in this one's place. The same screen before the session is known. + */ +export default async function PaymentReturnPage({ + searchParams, +}: PaymentReturnPageProps) { + const raw = (await searchParams).paymentId; + const paymentId = typeof raw === 'string' && raw ? raw : null; + const confirming = ( + + ); + + return ( + + + {confirming} + + + ); +} diff --git a/apps/bear/src/app/(flow)/terms/subscription/loading.tsx b/apps/bear/src/app/(flow)/terms/subscription/loading.tsx new file mode 100644 index 0000000..345a829 --- /dev/null +++ b/apps/bear/src/app/(flow)/terms/subscription/loading.tsx @@ -0,0 +1,19 @@ +import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton'; + +import { i18n } from '../../../../i18n'; + +/** The terms before they arrive: a few paragraphs' worth of lines. */ +export default function Loading() { + return ( + + + + + + + ); +} diff --git a/apps/bear/src/app/(flow)/terms/subscription/page.tsx b/apps/bear/src/app/(flow)/terms/subscription/page.tsx new file mode 100644 index 0000000..7a07ac4 --- /dev/null +++ b/apps/bear/src/app/(flow)/terms/subscription/page.tsx @@ -0,0 +1,57 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { Card } from '@lumina/island/molecules/card'; +import { DesktopHeader, DesktopPageTitle } from '@lumina/market/app/navigation'; +import { + SubscriptionTerms, + subscriptionTermsLabels, +} from '@lumina/market/app/screens/(flow)/terms/subscription/organisms/subscription-terms'; +import { supportChatUrls } from '@lumina/market/app/screens/organisms/support-entry'; +import { getEnv } from '@lumina/market/env'; +import type { Metadata } from 'next'; + +import { i18n } from '../../../../i18n'; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('terms:meta-title'), + description: i18n.t('terms:meta-description'), + }; +} + +/** + * «شرایط اشتراک» on desktop (S5 ۲.۱): the text in a panel of the 640 column under the header, + * about 75 characters a line, with back beside the title. + */ +export default function SubscriptionTermsPage() { + const labels = subscriptionTermsLabels( + i18n.getFixedT(null, 'terms'), + i18n.getFixedT(null, 'auth'), + getEnv().supportHours, + ); + + return ( + + + + + + + + + + + + ); +} diff --git a/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/.gitkeep b/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/loading.tsx b/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/loading.tsx new file mode 100644 index 0000000..ac59a36 --- /dev/null +++ b/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/loading.tsx @@ -0,0 +1,15 @@ +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; + +import { i18n } from '../../../../../i18n'; + +/** The list before it arrives, card for card; the layout keeps the bar and the tabs. */ +export default function Loading() { + return ( + + ); +} diff --git a/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx b/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx new file mode 100644 index 0000000..15415c0 --- /dev/null +++ b/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx @@ -0,0 +1,43 @@ +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { SubscriptionList } from '@lumina/market/app/screens/(main)/dashboard/subscriptions/organisms/subscription-list'; +import type { Metadata } from 'next'; +import { Suspense } from 'react'; + +import { i18n } from '../../../../../i18n'; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('dashboard:subscriptions.meta-title'), + robots: { index: false }, + }; +} + +/** + * داشبورد › اشتراک‌ها (U2, U11): the investor's own subscriptions, in the browser only, behind + * cards of the same size. A failed read shows in place of the list; the tabs stay (U2 ۳.۴). + */ +export default function SubscriptionsPage() { + const skeleton = ( + + ); + + return ( + + + + + + + + ); +} diff --git a/apps/bear/src/app/(main)/dashboard/(investor)/transactions/.gitkeep b/apps/bear/src/app/(main)/dashboard/(investor)/transactions/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bear/src/app/(main)/dashboard/(investor)/transactions/loading.tsx b/apps/bear/src/app/(main)/dashboard/(investor)/transactions/loading.tsx new file mode 100644 index 0000000..673a6ff --- /dev/null +++ b/apps/bear/src/app/(main)/dashboard/(investor)/transactions/loading.tsx @@ -0,0 +1,16 @@ +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; + +import { i18n } from '../../../../../i18n'; + +/** The payments before they arrive, row for row; the layout keeps the bar and the tabs. */ +export default function Loading() { + return ( + + ); +} diff --git a/apps/bear/src/app/(main)/dashboard/(investor)/transactions/page.tsx b/apps/bear/src/app/(main)/dashboard/(investor)/transactions/page.tsx new file mode 100644 index 0000000..74bb8fa --- /dev/null +++ b/apps/bear/src/app/(main)/dashboard/(investor)/transactions/page.tsx @@ -0,0 +1,44 @@ +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { TransactionList } from '@lumina/market/app/screens/(main)/dashboard/transactions/organisms/transaction-list'; +import type { Metadata } from 'next'; +import { Suspense } from 'react'; + +import { i18n } from '../../../../../i18n'; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('dashboard:transactions.meta-title'), + robots: { index: false }, + }; +} + +/** + * داشبورد › تراکنش‌ها (U4): the investor's own payments, in the browser only, behind rows of the + * same size. A failed read shows in place of the list, without the chips; the tabs stay (U4 ۴.۳). + */ +export default function TransactionsPage() { + const skeleton = ( + + ); + + return ( + + + + + + + + ); +} diff --git a/apps/bear/src/app/(main)/notifications/loading.tsx b/apps/bear/src/app/(main)/notifications/loading.tsx new file mode 100644 index 0000000..8e454a2 --- /dev/null +++ b/apps/bear/src/app/(main)/notifications/loading.tsx @@ -0,0 +1,26 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; +import { DesktopPageTitle } from '@lumina/market/app/navigation'; + +import { i18n } from '../../../i18n'; + +/** The centre before it arrives, in its column. */ +export default function Loading() { + return ( + + + + + + + ); +} diff --git a/apps/bear/src/app/(main)/notifications/page.tsx b/apps/bear/src/app/(main)/notifications/page.tsx new file mode 100644 index 0000000..cc61ec6 --- /dev/null +++ b/apps/bear/src/app/(main)/notifications/page.tsx @@ -0,0 +1,54 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { DesktopPageTitle } from '@lumina/market/app/navigation'; +import { NotificationCentre } from '@lumina/market/app/screens/(main)/notifications/organisms/notification-centre'; +import type { Metadata } from 'next'; +import { Suspense } from 'react'; + +import { i18n } from '../../../i18n'; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('notifications:title'), + robots: { index: false }, + }; +} + +/** + * اعلان‌ها at its own address on desktop, such as a link opened from elsewhere: the same centre the + * header's bell opens as a panel (U5 ۴.۱), in the 640 column. + */ +export default function NotificationsPage() { + const skeleton = ( + + ); + + return ( + + + + + + + + + + + + + ); +} diff --git a/apps/bear/src/app/(main)/terms/subscription/.gitkeep b/apps/bear/src/app/(main)/terms/subscription/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bull/src/app/(flow)/checkout/[username]/.gitkeep b/apps/bull/src/app/(flow)/checkout/[username]/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bull/src/app/(flow)/checkout/[username]/loading.tsx b/apps/bull/src/app/(flow)/checkout/[username]/loading.tsx new file mode 100644 index 0000000..091f34d --- /dev/null +++ b/apps/bull/src/app/(flow)/checkout/[username]/loading.tsx @@ -0,0 +1,22 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { MobileTopBar } from '@lumina/market/app/navigation'; +import { CheckoutCreatorSkeleton } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-creator'; +import { CheckoutSkeleton } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-panel'; + +import { i18n } from '../../../../i18n'; + +/** Checkout before the page arrives, block for block, under its bar. */ +export default function Loading() { + return ( + + + + } + label={i18n.t('payment:checkout.loading')} + /> + + + ); +} diff --git a/apps/bull/src/app/(flow)/checkout/[username]/page.tsx b/apps/bull/src/app/(flow)/checkout/[username]/page.tsx new file mode 100644 index 0000000..5c80174 --- /dev/null +++ b/apps/bull/src/app/(flow)/checkout/[username]/page.tsx @@ -0,0 +1,35 @@ +import { ROUTES } from '@lumina/market/app/navigation'; +import { getChannel, readOnServer } from '@lumina/market/server'; +import { toChannelUsername } from '@lumina/market/shared/utils'; +import type { Metadata } from 'next'; +import { notFound, permanentRedirect, redirect } from 'next/navigation'; + +import { i18n } from '../../../../i18n'; +import { CheckoutTemplate } from './templates/checkout-template'; + +type CheckoutPageProps = { params: Promise<{ username: string }> }; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('payment:checkout.title'), + robots: { index: false }, + }; +} + +/** + * Checkout for a creator's channel (U9), reached only from its «اشتراک». The server renders the + * same page for everyone: the bar and who is being paid; the investor's own checkout loads in the + * browser. Another spelling of the username redirects to the stored one; a suspended channel + * sends the visitor to the channel, which says it is unavailable. + */ +export default async function CheckoutPage({ params }: CheckoutPageProps) { + const segment = (await params).username; + const username = toChannelUsername(segment); + if (!username) notFound(); + if (username !== segment) permanentRedirect(ROUTES.checkout(username)); + const channel = await readOnServer(() => getChannel(username)); + if (channel.status !== 'ok') notFound(); + if (channel.data.suspended) redirect(ROUTES.channel(username)); + + return ; +} diff --git a/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx b/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx new file mode 100644 index 0000000..ca851a9 --- /dev/null +++ b/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx @@ -0,0 +1,37 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation'; +import { CheckoutCreator } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-creator'; +import { CheckoutPanel } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-panel'; + +import { i18n } from '../../../../../../i18n'; +import type { CheckoutTemplateProps } from './types'; + +/** + * Checkout on mobile: a task page pushed from the channel, back · «خرید اشتراک» · support and no + * bottom nav (U9 §۲), with the pay block pinned to the bottom of the screen. + */ +export function CheckoutTemplate({ channel }: CheckoutTemplateProps) { + const t = i18n.getFixedT(null, 'payment'); + + return ( + + + + + + } + /> + + + + ); +} diff --git a/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/index.ts b/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/index.ts new file mode 100644 index 0000000..4415cca --- /dev/null +++ b/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/index.ts @@ -0,0 +1,2 @@ +export { CheckoutTemplate } from './CheckoutTemplate'; +export type { CheckoutTemplateProps } from './types'; diff --git a/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/types.ts b/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/types.ts new file mode 100644 index 0000000..efd0409 --- /dev/null +++ b/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/types.ts @@ -0,0 +1,3 @@ +import type { PublicCreatorPayload } from '@lumina/market/features/channel'; + +export type CheckoutTemplateProps = { channel: PublicCreatorPayload }; diff --git a/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx b/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx new file mode 100644 index 0000000..689e527 --- /dev/null +++ b/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx @@ -0,0 +1,20 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { MobileTopBar } from '@lumina/market/app/navigation'; +import { PaymentResultSkeleton } from '@lumina/market/app/screens/(flow)/payment/result/[paymentId]/organisms/payment-result'; + +import { i18n } from '../../../../../i18n'; + +/** The result before the page arrives, under its bar. */ +export default function Loading() { + return ( + + + + + + + ); +} diff --git a/apps/bull/src/app/(flow)/payment/result/[paymentId]/page.tsx b/apps/bull/src/app/(flow)/payment/result/[paymentId]/page.tsx new file mode 100644 index 0000000..b867390 --- /dev/null +++ b/apps/bull/src/app/(flow)/payment/result/[paymentId]/page.tsx @@ -0,0 +1,52 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { MobileTopBar } from '@lumina/market/app/navigation'; +import { + PaymentResult, + PaymentResultSkeleton, +} from '@lumina/market/app/screens/(flow)/payment/result/[paymentId]/organisms/payment-result'; +import type { Metadata } from 'next'; + +import { i18n } from '../../../../../i18n'; + +type PaymentResultPageProps = { params: Promise<{ paymentId: string }> }; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('payment:result.meta-title'), + robots: { index: false }, + }; +} + +/** + * «نتیجه پرداخت» (U10 ۹.۱–۹.۳): the name and support with no back, since the bank is behind it, + * the investor's own payment in the browser, and its two ways on pinned to the bottom. + */ +export default async function PaymentResultPage({ + params, +}: PaymentResultPageProps) { + const { paymentId } = await params; + const skeleton = ( + + ); + + return ( + + + + + + + + + + + ); +} diff --git a/apps/bull/src/app/(flow)/payment/return/.gitkeep b/apps/bull/src/app/(flow)/payment/return/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bull/src/app/(flow)/payment/return/loading.tsx b/apps/bull/src/app/(flow)/payment/return/loading.tsx new file mode 100644 index 0000000..35d8cd8 --- /dev/null +++ b/apps/bull/src/app/(flow)/payment/return/loading.tsx @@ -0,0 +1,16 @@ +import { PaymentConfirming } from '@lumina/market/app/screens/(flow)/payment/return/organisms/payment-confirming'; + +import { i18n } from '../../../../i18n'; + +/** The confirming screen itself: nothing else may show on the way back from the bank. */ +export default function Loading() { + return ( + + ); +} diff --git a/apps/bull/src/app/(flow)/payment/return/page.tsx b/apps/bull/src/app/(flow)/payment/return/page.tsx new file mode 100644 index 0000000..fd8e32a --- /dev/null +++ b/apps/bull/src/app/(flow)/payment/return/page.tsx @@ -0,0 +1,46 @@ +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { PaymentConfirming } from '@lumina/market/app/screens/(flow)/payment/return/organisms/payment-confirming'; +import { PaymentReturn } from '@lumina/market/app/screens/(flow)/payment/return/organisms/payment-return'; +import type { Metadata } from 'next'; + +import { i18n } from '../../../../i18n'; + +type PaymentReturnPageProps = { + searchParams: Promise<{ paymentId?: string | string[] }>; +}; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('payment:confirm.meta-title'), + robots: { index: false }, + }; +} + +/** + * Back from the bank (U10 ۱.۱): «در حال تأیید پرداخت...» while the payment settles, then its + * result page in this one's place. The same screen before the session is known. + */ +export default async function PaymentReturnPage({ + searchParams, +}: PaymentReturnPageProps) { + const raw = (await searchParams).paymentId; + const paymentId = typeof raw === 'string' && raw ? raw : null; + const confirming = ( + + ); + + return ( + + + {confirming} + + + ); +} diff --git a/apps/bull/src/app/(flow)/terms/subscription/loading.tsx b/apps/bull/src/app/(flow)/terms/subscription/loading.tsx new file mode 100644 index 0000000..345a829 --- /dev/null +++ b/apps/bull/src/app/(flow)/terms/subscription/loading.tsx @@ -0,0 +1,19 @@ +import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton'; + +import { i18n } from '../../../../i18n'; + +/** The terms before they arrive: a few paragraphs' worth of lines. */ +export default function Loading() { + return ( + + + + + + + ); +} diff --git a/apps/bull/src/app/(flow)/terms/subscription/page.tsx b/apps/bull/src/app/(flow)/terms/subscription/page.tsx new file mode 100644 index 0000000..ae716f1 --- /dev/null +++ b/apps/bull/src/app/(flow)/terms/subscription/page.tsx @@ -0,0 +1,47 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { MobileTopBar } from '@lumina/market/app/navigation'; +import { + SubscriptionTerms, + subscriptionTermsLabels, +} from '@lumina/market/app/screens/(flow)/terms/subscription/organisms/subscription-terms'; +import { supportChatUrls } from '@lumina/market/app/screens/organisms/support-entry'; +import { getEnv } from '@lumina/market/env'; +import type { Metadata } from 'next'; + +import { i18n } from '../../../../i18n'; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('terms:meta-title'), + description: i18n.t('terms:meta-description'), + }; +} + +/** + * «شرایط اشتراک» on mobile (S5 ۱.۱): a task page pushed from checkout, a suspended card or the + * support sheet, back · title · support and no bottom nav; back returns to where it was opened. + */ +export default function SubscriptionTermsPage() { + const labels = subscriptionTermsLabels( + i18n.getFixedT(null, 'terms'), + i18n.getFixedT(null, 'auth'), + getEnv().supportHours, + ); + + return ( + + + + + + + ); +} diff --git a/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/.gitkeep b/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/loading.tsx b/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/loading.tsx new file mode 100644 index 0000000..091d793 --- /dev/null +++ b/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/loading.tsx @@ -0,0 +1,15 @@ +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; + +import { i18n } from '../../../../../i18n'; + +/** The list before it arrives, card for card; the layout keeps the bar and the tabs. */ +export default function Loading() { + return ( + + ); +} diff --git a/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx b/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx new file mode 100644 index 0000000..6e39939 --- /dev/null +++ b/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx @@ -0,0 +1,43 @@ +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { SubscriptionList } from '@lumina/market/app/screens/(main)/dashboard/subscriptions/organisms/subscription-list'; +import type { Metadata } from 'next'; +import { Suspense } from 'react'; + +import { i18n } from '../../../../../i18n'; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('dashboard:subscriptions.meta-title'), + robots: { index: false }, + }; +} + +/** + * داشبورد › اشتراک‌ها (U2, U11): the investor's own subscriptions, in the browser only, behind + * cards of the same size. A failed read shows in place of the list; the tabs stay (U2 ۳.۴). + */ +export default function SubscriptionsPage() { + const skeleton = ( + + ); + + return ( + + + + + + + + ); +} diff --git a/apps/bull/src/app/(main)/dashboard/(investor)/transactions/.gitkeep b/apps/bull/src/app/(main)/dashboard/(investor)/transactions/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bull/src/app/(main)/dashboard/(investor)/transactions/loading.tsx b/apps/bull/src/app/(main)/dashboard/(investor)/transactions/loading.tsx new file mode 100644 index 0000000..de8a787 --- /dev/null +++ b/apps/bull/src/app/(main)/dashboard/(investor)/transactions/loading.tsx @@ -0,0 +1,16 @@ +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; + +import { i18n } from '../../../../../i18n'; + +/** The payments before they arrive, row for row; the layout keeps the bar and the tabs. */ +export default function Loading() { + return ( + + ); +} diff --git a/apps/bull/src/app/(main)/dashboard/(investor)/transactions/page.tsx b/apps/bull/src/app/(main)/dashboard/(investor)/transactions/page.tsx new file mode 100644 index 0000000..f71c6b2 --- /dev/null +++ b/apps/bull/src/app/(main)/dashboard/(investor)/transactions/page.tsx @@ -0,0 +1,44 @@ +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { TransactionList } from '@lumina/market/app/screens/(main)/dashboard/transactions/organisms/transaction-list'; +import type { Metadata } from 'next'; +import { Suspense } from 'react'; + +import { i18n } from '../../../../../i18n'; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('dashboard:transactions.meta-title'), + robots: { index: false }, + }; +} + +/** + * داشبورد › تراکنش‌ها (U4): the investor's own payments, in the browser only, behind rows of the + * same size. A failed read shows in place of the list, without the chips; the tabs stay (U4 ۴.۳). + */ +export default function TransactionsPage() { + const skeleton = ( + + ); + + return ( + + + + + + + + ); +} diff --git a/apps/bull/src/app/(main)/notifications/loading.tsx b/apps/bull/src/app/(main)/notifications/loading.tsx new file mode 100644 index 0000000..46a33f2 --- /dev/null +++ b/apps/bull/src/app/(main)/notifications/loading.tsx @@ -0,0 +1,22 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; +import { MobileTopBar } from '@lumina/market/app/navigation'; + +import { i18n } from '../../../i18n'; + +/** The centre before it arrives, under its bar. */ +export default function Loading() { + return ( + <> + + + + + + ); +} diff --git a/apps/bull/src/app/(main)/notifications/page.tsx b/apps/bull/src/app/(main)/notifications/page.tsx new file mode 100644 index 0000000..f28e7ab --- /dev/null +++ b/apps/bull/src/app/(main)/notifications/page.tsx @@ -0,0 +1,49 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { MobileTopBar } from '@lumina/market/app/navigation'; +import { NotificationCentre } from '@lumina/market/app/screens/(main)/notifications/organisms/notification-centre'; +import type { Metadata } from 'next'; +import { Suspense } from 'react'; + +import { i18n } from '../../../i18n'; + +export function generateMetadata(): Metadata { + return { + title: i18n.t('notifications:title'), + robots: { index: false }, + }; +} + +/** + * اعلان‌ها on mobile (U5 ۲.۱): a page pushed from the bell, back · «اعلان‌ها» · support, with the + * nav kept. The member's own notifications, in the browser only, behind rows of the same size. + */ +export default function NotificationsPage() { + const skeleton = ( + + ); + + return ( + <> + + + + + + + + + + + + ); +} diff --git a/apps/bull/src/app/(main)/terms/subscription/.gitkeep b/apps/bull/src/app/(main)/terms/subscription/.gitkeep deleted file mode 100644 index e69de29..0000000