feat(apps): checkout, payment, subscriptions, transactions and notifications routes in bull and bear
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
49372bc77e
commit
3b8c95a94e
|
|
@ -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 (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<DesktopHeader />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
justifyContent="justify-center"
|
||||
className="px-8 py-10"
|
||||
>
|
||||
<FlexBox
|
||||
direction="flex-col"
|
||||
gap="gap-4"
|
||||
className="w-full max-w-checkout"
|
||||
>
|
||||
<DesktopPageTitle title={i18n.t('payment:checkout.title')} />
|
||||
<CheckoutSkeleton
|
||||
layout="desktop"
|
||||
creator={<CheckoutCreatorSkeleton />}
|
||||
label={i18n.t('payment:checkout.loading')}
|
||||
/>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 <CheckoutTemplate channel={channel.data} />;
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<DesktopHeader />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
justifyContent="justify-center"
|
||||
className="px-8 py-10"
|
||||
>
|
||||
<FlexBox
|
||||
direction="flex-col"
|
||||
gap="gap-4"
|
||||
className="w-full max-w-checkout"
|
||||
>
|
||||
<DesktopPageTitle title={t('checkout.title')} />
|
||||
<PartBoundary
|
||||
name="checkout"
|
||||
description={t('checkout.error')}
|
||||
framed
|
||||
>
|
||||
<CheckoutPanel
|
||||
creatorId={channel.creatorId}
|
||||
channelHref={ROUTES.channel(channel.username)}
|
||||
layout="desktop"
|
||||
creator={
|
||||
<CheckoutCreator
|
||||
creator={channel}
|
||||
labels={{ verified: t('checkout.verified') }}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</PartBoundary>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export { CheckoutTemplate } from './CheckoutTemplate';
|
||||
export type { CheckoutTemplateProps } from './types';
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import type { PublicCreatorPayload } from '@lumina/market/features/channel';
|
||||
|
||||
export type CheckoutTemplateProps = { channel: PublicCreatorPayload };
|
||||
|
|
@ -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 (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<DesktopHeader />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
justifyContent="justify-center"
|
||||
className="px-8 py-10"
|
||||
>
|
||||
<FlexBox direction="flex-col" className="w-full max-w-checkout">
|
||||
<PaymentResultSkeleton
|
||||
layout="desktop"
|
||||
label={i18n.t('payment:result.loading')}
|
||||
/>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 = (
|
||||
<PaymentResultSkeleton
|
||||
layout="desktop"
|
||||
label={i18n.t('payment:result.loading')}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<DesktopHeader />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
justifyContent="justify-center"
|
||||
className="px-8 py-10"
|
||||
>
|
||||
<FlexBox direction="flex-col" className="w-full max-w-checkout">
|
||||
<PartBoundary
|
||||
name="payment-result"
|
||||
description={i18n.t('payment:result.error')}
|
||||
framed
|
||||
>
|
||||
<AuthGuard role="investor" fallback={skeleton}>
|
||||
<PaymentResult paymentId={paymentId} layout="desktop" />
|
||||
</AuthGuard>
|
||||
</PartBoundary>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<PaymentConfirming
|
||||
layout="desktop"
|
||||
labels={{
|
||||
title: i18n.t('payment:confirm.title'),
|
||||
description: i18n.t('payment:confirm.description'),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 = (
|
||||
<PaymentConfirming
|
||||
layout="desktop"
|
||||
labels={{
|
||||
title: i18n.t('payment:confirm.title'),
|
||||
description: i18n.t('payment:confirm.description'),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<AuthGuard role="investor" fallback={confirming}>
|
||||
<PartBoundary name="payment-return">
|
||||
<PaymentReturn paymentId={paymentId}>{confirming}</PaymentReturn>
|
||||
</PartBoundary>
|
||||
</AuthGuard>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<SkeletonRegion
|
||||
delayed
|
||||
label={i18n.t('terms:meta-title')}
|
||||
className="mx-auto w-full max-w-content p-4"
|
||||
>
|
||||
<Skeleton width="40%" height="1.25rem" className="mb-3" />
|
||||
<Skeleton lines={4} />
|
||||
<Skeleton width="35%" height="1.25rem" className="mt-6 mb-3" />
|
||||
<Skeleton lines={5} />
|
||||
</SkeletonRegion>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<DesktopHeader />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
justifyContent="justify-center"
|
||||
className="px-8 py-10"
|
||||
>
|
||||
<FlexBox
|
||||
direction="flex-col"
|
||||
gap="gap-4"
|
||||
className="w-full max-w-content"
|
||||
>
|
||||
<DesktopPageTitle title={labels.title} />
|
||||
<Card padding="lg">
|
||||
<SubscriptionTerms
|
||||
layout="desktop"
|
||||
chats={supportChatUrls()}
|
||||
labels={labels}
|
||||
/>
|
||||
</Card>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="lg"
|
||||
delayed
|
||||
label={i18n.t('dashboard:subscriptions.loading')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 = (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="lg"
|
||||
label={i18n.t('dashboard:subscriptions.loading')}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<PartBoundary
|
||||
name="subscription-list"
|
||||
description={i18n.t('dashboard:subscriptions.error')}
|
||||
framed
|
||||
>
|
||||
<AuthGuard role="investor" fallback={skeleton}>
|
||||
<Suspense fallback={skeleton}>
|
||||
<SubscriptionList layout="desktop" />
|
||||
</Suspense>
|
||||
</AuthGuard>
|
||||
</PartBoundary>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="lg"
|
||||
avatar={false}
|
||||
delayed
|
||||
label={i18n.t('dashboard:transactions.loading')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 = (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="lg"
|
||||
avatar={false}
|
||||
label={i18n.t('dashboard:transactions.loading')}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<PartBoundary
|
||||
name="transaction-list"
|
||||
description={i18n.t('dashboard:transactions.error')}
|
||||
framed
|
||||
>
|
||||
<AuthGuard role="investor" fallback={skeleton}>
|
||||
<Suspense fallback={skeleton}>
|
||||
<TransactionList layout="desktop" />
|
||||
</Suspense>
|
||||
</AuthGuard>
|
||||
</PartBoundary>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">
|
||||
<FlexBox
|
||||
direction="flex-col"
|
||||
gap="gap-4"
|
||||
className="w-full max-w-content"
|
||||
>
|
||||
<DesktopPageTitle title={i18n.t('notifications:title')} />
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
avatar={false}
|
||||
delayed
|
||||
label={i18n.t('notifications:loading')}
|
||||
/>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 = (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
avatar={false}
|
||||
label={i18n.t('notifications:loading')}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">
|
||||
<FlexBox
|
||||
direction="flex-col"
|
||||
gap="gap-4"
|
||||
className="w-full max-w-content"
|
||||
>
|
||||
<DesktopPageTitle title={i18n.t('notifications:title')} />
|
||||
<PartBoundary
|
||||
name="notification-centre"
|
||||
description={i18n.t('notifications:error')}
|
||||
framed
|
||||
>
|
||||
<AuthGuard fallback={skeleton}>
|
||||
<Suspense fallback={skeleton}>
|
||||
<NotificationCentre layout="page" supportPlacement="popover" />
|
||||
</Suspense>
|
||||
</AuthGuard>
|
||||
</PartBoundary>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<MobileTopBar title={i18n.t('payment:checkout.title')} />
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1">
|
||||
<CheckoutSkeleton
|
||||
layout="mobile"
|
||||
creator={<CheckoutCreatorSkeleton />}
|
||||
label={i18n.t('payment:checkout.loading')}
|
||||
/>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 <CheckoutTemplate channel={channel.data} />;
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<MobileTopBar title={t('checkout.title')} />
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1">
|
||||
<PartBoundary name="checkout" description={t('checkout.error')}>
|
||||
<CheckoutPanel
|
||||
creatorId={channel.creatorId}
|
||||
channelHref={ROUTES.channel(channel.username)}
|
||||
layout="mobile"
|
||||
creator={
|
||||
<CheckoutCreator
|
||||
creator={channel}
|
||||
labels={{ verified: t('checkout.verified') }}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</PartBoundary>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export { CheckoutTemplate } from './CheckoutTemplate';
|
||||
export type { CheckoutTemplateProps } from './types';
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import type { PublicCreatorPayload } from '@lumina/market/features/channel';
|
||||
|
||||
export type CheckoutTemplateProps = { channel: PublicCreatorPayload };
|
||||
|
|
@ -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 (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-surface">
|
||||
<MobileTopBar title={i18n.t('payment:result.title')} back={false} />
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1">
|
||||
<PaymentResultSkeleton
|
||||
layout="mobile"
|
||||
label={i18n.t('payment:result.loading')}
|
||||
/>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 = (
|
||||
<PaymentResultSkeleton
|
||||
layout="mobile"
|
||||
label={i18n.t('payment:result.loading')}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-surface">
|
||||
<MobileTopBar title={i18n.t('payment:result.title')} back={false} />
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1">
|
||||
<PartBoundary
|
||||
name="payment-result"
|
||||
description={i18n.t('payment:result.error')}
|
||||
>
|
||||
<AuthGuard role="investor" fallback={skeleton}>
|
||||
<PaymentResult paymentId={paymentId} layout="mobile" />
|
||||
</AuthGuard>
|
||||
</PartBoundary>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<PaymentConfirming
|
||||
layout="mobile"
|
||||
labels={{
|
||||
title: i18n.t('payment:confirm.title'),
|
||||
description: i18n.t('payment:confirm.description'),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 = (
|
||||
<PaymentConfirming
|
||||
layout="mobile"
|
||||
labels={{
|
||||
title: i18n.t('payment:confirm.title'),
|
||||
description: i18n.t('payment:confirm.description'),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<AuthGuard role="investor" fallback={confirming}>
|
||||
<PartBoundary name="payment-return">
|
||||
<PaymentReturn paymentId={paymentId}>{confirming}</PaymentReturn>
|
||||
</PartBoundary>
|
||||
</AuthGuard>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<SkeletonRegion
|
||||
delayed
|
||||
label={i18n.t('terms:meta-title')}
|
||||
className="mx-auto w-full max-w-content p-4"
|
||||
>
|
||||
<Skeleton width="40%" height="1.25rem" className="mb-3" />
|
||||
<Skeleton lines={4} />
|
||||
<Skeleton width="35%" height="1.25rem" className="mt-6 mb-3" />
|
||||
<Skeleton lines={5} />
|
||||
</SkeletonRegion>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-surface">
|
||||
<MobileTopBar title={labels.title} />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
direction="flex-col"
|
||||
className="flex-1 px-4 pt-4 pb-8"
|
||||
>
|
||||
<SubscriptionTerms
|
||||
layout="mobile"
|
||||
chats={supportChatUrls()}
|
||||
labels={labels}
|
||||
/>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="md"
|
||||
delayed
|
||||
label={i18n.t('dashboard:subscriptions.loading')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 = (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="md"
|
||||
label={i18n.t('dashboard:subscriptions.loading')}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<PartBoundary
|
||||
name="subscription-list"
|
||||
description={i18n.t('dashboard:subscriptions.error')}
|
||||
framed
|
||||
>
|
||||
<AuthGuard role="investor" fallback={skeleton}>
|
||||
<Suspense fallback={skeleton}>
|
||||
<SubscriptionList layout="mobile" />
|
||||
</Suspense>
|
||||
</AuthGuard>
|
||||
</PartBoundary>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="md"
|
||||
avatar={false}
|
||||
delayed
|
||||
label={i18n.t('dashboard:transactions.loading')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 = (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="md"
|
||||
avatar={false}
|
||||
label={i18n.t('dashboard:transactions.loading')}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<PartBoundary
|
||||
name="transaction-list"
|
||||
description={i18n.t('dashboard:transactions.error')}
|
||||
framed
|
||||
>
|
||||
<AuthGuard role="investor" fallback={skeleton}>
|
||||
<Suspense fallback={skeleton}>
|
||||
<TransactionList layout="mobile" />
|
||||
</Suspense>
|
||||
</AuthGuard>
|
||||
</PartBoundary>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<>
|
||||
<MobileTopBar title={i18n.t('notifications:title')} />
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1 p-4">
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
avatar={false}
|
||||
delayed
|
||||
label={i18n.t('notifications:loading')}
|
||||
/>
|
||||
</FlexBox>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 = (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
avatar={false}
|
||||
label={i18n.t('notifications:loading')}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<MobileTopBar title={i18n.t('notifications:title')} />
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1 p-4">
|
||||
<PartBoundary
|
||||
name="notification-centre"
|
||||
description={i18n.t('notifications:error')}
|
||||
>
|
||||
<AuthGuard fallback={skeleton}>
|
||||
<Suspense fallback={skeleton}>
|
||||
<NotificationCentre layout="page" supportPlacement="bottom" />
|
||||
</Suspense>
|
||||
</AuthGuard>
|
||||
</PartBoundary>
|
||||
</FlexBox>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in New Issue