feat: render every page except the landing in the browser

- Channel, post, checkout and analysts read their data in the browser; the
  server reads no back-end data outside the landing (0070).
- Only the landing is indexable; every other page is noindex, the rules
  pages through the terms layout (0071).
- Remove the landing's loading.tsx so all of it renders in the first flush.
- Remove the server caches and metadata helpers nothing uses any more.
- Update the page rendering docs; 0021, 0045 and 0055 are superseded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Amiram_se 2026-10-21 15:40:47 +04:00
parent 3e908ab0b7
commit 2a1b657a77
115 changed files with 1283 additions and 1146 deletions

View File

@ -1,8 +1,7 @@
import { ROUTES, withSearchParams } from '@lumina/market/app/navigation'; import { ROUTES, withSearchParams } from '@lumina/market/app/navigation';
import { getChannel, readOnServer } from '@lumina/market/server';
import { toChannelUsername } from '@lumina/market/shared/utils'; import { toChannelUsername } from '@lumina/market/shared/utils';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { notFound, permanentRedirect, redirect } from 'next/navigation'; import { notFound, permanentRedirect } from 'next/navigation';
import { i18n } from '../../../../i18n'; import { i18n } from '../../../../i18n';
import { CheckoutTemplate } from './templates/checkout-template'; import { CheckoutTemplate } from './templates/checkout-template';
@ -18,10 +17,10 @@ export const metadata: Metadata = {
}; };
/** /**
* Checkout for a creator's channel (U9), reached only from its «اشتراک». The server renders the * Checkout for a creator's channel (U9), reached only from its «اشتراک». It renders in the
* same page for everyone: the bar and who is being paid; the investor's own checkout loads in the * browser only (0070): the server reads nothing and sends the bar and the skeleton. Another
* browser. Another spelling of the username redirects to the stored one; a suspended channel * spelling of the username redirects to the stored one; a suspended channel sends the visitor to
* sends the visitor to the channel, which says it is unavailable. * the channel, which says it is unavailable.
*/ */
export default async function CheckoutPage({ export default async function CheckoutPage({
params, params,
@ -36,9 +35,6 @@ export default async function CheckoutPage({
withSearchParams(ROUTES.checkout(username), await searchParams), withSearchParams(ROUTES.checkout(username), await searchParams),
); );
} }
const channel = await readOnServer(() => getChannel(username));
if (channel.status !== 'ok') notFound();
if (channel.data.suspended) redirect(ROUTES.channel(username));
return <CheckoutTemplate channel={channel.data} />; return <CheckoutTemplate username={username} />;
} }

View File

@ -1,22 +1,66 @@
'use client';
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { PartBoundary } from '@lumina/market/app/error-boundaries'; import {
PartBoundary,
StatusEmptyState,
} from '@lumina/market/app/error-boundaries';
import { import {
DesktopHeader, DesktopHeader,
DesktopPageTitle, DesktopPageTitle,
ROUTES, ROUTES,
} from '@lumina/market/app/navigation'; } from '@lumina/market/app/navigation';
import { CheckoutCreator } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-creator'; import {
import { CheckoutPanel } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-panel'; CheckoutCreator,
CheckoutCreatorSkeleton,
} from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-creator';
import {
CheckoutPanel,
CheckoutSkeleton,
} from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-panel';
import { useCheckoutChannel } from '@lumina/market/features/checkout';
import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import { i18n } from '../../../../../../i18n';
import type { CheckoutTemplateProps } from './types'; import type { CheckoutTemplateProps } from './types';
/** /**
* Checkout on desktop (U9 ۹.۱): one centred column of 480 under the header, back beside the * 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. * title, and the pay block stuck to the bottom of the window while the tiers scroll. It renders
* in the browser only (0070): the header, the title and the skeleton stay until the channel
* arrives.
*/ */
export function CheckoutTemplate({ channel }: CheckoutTemplateProps) { export function CheckoutTemplate({ username }: CheckoutTemplateProps) {
const t = i18n.getFixedT(null, 'payment'); const { t } = useTranslation('payment');
const page = useCheckoutChannel(username);
const channelHref = ROUTES.channel(username);
let content: ReactNode;
if (page.status === 'pending') {
content = (
<CheckoutSkeleton
layout="desktop"
creator={<CheckoutCreatorSkeleton />}
label={t('checkout.loading')}
/>
);
} else if (page.status === 'not-found') {
content = <StatusEmptyState variant="not-found" size="page" />;
} else {
const { channel } = page;
content = (
<PartBoundary name="checkout" description={t('checkout.error')} framed>
<CheckoutPanel
creatorId={channel.creatorId}
channelHref={channelHref}
layout="desktop"
creator={<CheckoutCreator creator={channel} />}
creatorName={channel.displayName ?? channel.username}
creatorLinks={channel.socialLinks}
/>
</PartBoundary>
);
}
return ( return (
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page"> <FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
@ -33,22 +77,9 @@ export function CheckoutTemplate({ channel }: CheckoutTemplateProps) {
> >
<DesktopPageTitle <DesktopPageTitle
title={t('checkout.title')} title={t('checkout.title')}
parentHref={ROUTES.channel(channel.username)} parentHref={channelHref}
/> />
<PartBoundary {content}
name="checkout"
description={t('checkout.error')}
framed
>
<CheckoutPanel
creatorId={channel.creatorId}
channelHref={ROUTES.channel(channel.username)}
layout="desktop"
creator={<CheckoutCreator creator={channel} />}
creatorName={channel.displayName ?? channel.username}
creatorLinks={channel.socialLinks}
/>
</PartBoundary>
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>

View File

@ -1,3 +1,4 @@
import type { PublicCreatorPayload } from '@lumina/market/features/channel'; export type CheckoutTemplateProps = {
/** The channel's username as the API stores it (lower case). */
export type CheckoutTemplateProps = { channel: PublicCreatorPayload }; username: string;
};

View File

@ -10,9 +10,11 @@ import type { ReactNode } from 'react';
import { i18n } from '../../../i18n'; import { i18n } from '../../../i18n';
// Only the landing is indexed (0071); both tabs inherit this.
export const metadata: Metadata = { export const metadata: Metadata = {
title: i18n.t('rules:meta-title'), title: i18n.t('rules:meta-title'),
description: i18n.t('rules:meta-description'), description: i18n.t('rules:meta-description'),
robots: { index: false },
}; };
/** /**

View File

@ -1,36 +0,0 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { GridBox } from '@lumina/island/atoms/grid-box';
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { i18n } from '../../i18n';
/** The landing before it arrives: the header's height, then the hero's copy beside its picture. */
export default function Loading() {
return (
<SkeletonRegion
label={i18n.t('landing:loading')}
delayed
className="min-h-dvh bg-surface"
>
<FlexBox
alignItems="items-center"
className="h-16 border-b border-border-subtle px-8"
>
<Skeleton width="5rem" height="1.25rem" />
</FlexBox>
<GridBox
cols="grid-cols-2"
gap="gap-16"
alignItems="items-center"
className="mx-auto max-w-page px-8 py-14"
>
<FlexBox direction="flex-col" gap="gap-4">
<Skeleton height="3rem" width="90%" />
<Skeleton lines={3} height="1rem" />
<Skeleton shape="pill" width="12rem" height="3.25rem" />
</FlexBox>
<Skeleton shape="rect" width="100%" height="36rem" />
</GridBox>
</SkeletonRegion>
);
}

View File

@ -1,5 +1,4 @@
import { AnalystsDirectory } from '@lumina/market/app/screens/(main)/analysts/organisms/analysts-directory'; import { AnalystsDirectory } from '@lumina/market/app/screens/(main)/analysts/organisms/analysts-directory';
import { getFeaturedCreators, readOnServer } from '@lumina/market/server';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { i18n } from '../../../i18n'; import { i18n } from '../../../i18n';
@ -11,20 +10,15 @@ export const metadata: Metadata = {
}; };
/** /**
* «تحلیلگران منتخب», `/analysts` (J04-3): every featured analyst, read on the server, the same for * «تحلیلگران منتخب», `/analysts` (J04-3): every featured analyst, read in the browser only
* every visitor; follow (an investor) and the free registration card (a guest) join in the * (0070), the same for every visitor; follow (an investor) and the free registration card (a
* browser. Signed-in visitors are not sent anywhere. A failed read is the page's error state with * guest) join once the viewer is known. Signed-in visitors are not sent anywhere. A failed read
* its retry, never a partial list. * is the page's error state with its retry, never a partial list.
*/ */
export default async function AnalystsPage() { export default function AnalystsPage() {
const featured = await readOnServer(() => getFeaturedCreators());
return ( return (
<AnalystsTemplate> <AnalystsTemplate>
<AnalystsDirectory <AnalystsDirectory layout="desktop" />
analysts={featured.status === 'ok' ? featured.data : []}
layout="desktop"
/>
</AnalystsTemplate> </AnalystsTemplate>
); );
} }

View File

@ -1,16 +1,13 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Card } from '@lumina/island/molecules/card';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { DeskBack } from '@lumina/market/app/navigation'; import { DeskBack } from '@lumina/market/app/navigation';
import { i18n } from '../../../../i18n'; import { ChannelSkeleton } from './templates/channel-template';
/** /**
* The channel before it arrives, in the 640 column and its reading order: «بازگشت», the header * The channel before it arrives, in the 640 column under «بازگشت»: the header panel, the track
* panel, the track record, then a post. * record, then a post. The page shows the same skeleton until its read arrives.
*/ */
export default function Loading() { export default function Loading() {
const t = i18n.getFixedT(null, 'channel');
return ( return (
<FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10"> <FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">
<FlexBox <FlexBox
@ -19,11 +16,7 @@ export default function Loading() {
className="w-full max-w-content" className="w-full max-w-content"
> >
<DeskBack /> <DeskBack />
<Card padding="lg"> <ChannelSkeleton delayed />
<SkeletonPreset preset="header" framed delayed label={t('loading')} />
</Card>
<SkeletonPreset preset="stats" delayed label={t('stats.loading')} />
<SkeletonPreset preset="post-media" delayed label={t('feed.loading')} />
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>
); );

View File

@ -1,18 +1,11 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { ChannelNotFound } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { displayUrl } from '../../../../configs'; import { displayUrl } from '../../../../configs';
import { ChannelMissing } from './templates/channel-template';
export const metadata: Metadata = { robots: { index: false } }; export const metadata: Metadata = { robots: { index: false } };
/** No channel at this address, or not any more. */ /** An address that can't be a username; the page shows the same state for an unknown one. */
export default function ChannelNotFoundPage() { export default function ChannelNotFoundPage() {
return ( return <ChannelMissing siteHost={displayUrl('')} />;
<FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">
<FlexBox direction="flex-col" className="w-full max-w-content">
<ChannelNotFound layout="desktop" siteHost={displayUrl('')} />
</FlexBox>
</FlexBox>
);
} }

View File

@ -1,10 +1,4 @@
import { ROUTES, withSearchParams } from '@lumina/market/app/navigation'; import { ROUTES, withSearchParams } from '@lumina/market/app/navigation';
import {
channelMetadata,
getChannel,
getRequestTime,
readOnServer,
} from '@lumina/market/server';
import { toChannelUsername } from '@lumina/market/shared/utils'; import { toChannelUsername } from '@lumina/market/shared/utils';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { notFound, permanentRedirect } from 'next/navigation'; import { notFound, permanentRedirect } from 'next/navigation';
@ -18,33 +12,26 @@ type ChannelPageProps = {
searchParams: Promise<Record<string, string | string[] | undefined>>; searchParams: Promise<Record<string, string | string[] | undefined>>;
}; };
// The one kind of route whose metadata names its data (0055): it reads through the same per-request // From the address alone (0070): the server reads nothing for this page.
// cache as the page, so the first byte, held for the metadata in <head> (0054), waits for that
// one read.
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: ChannelPageProps): Promise<Metadata> { }: ChannelPageProps): Promise<Metadata> {
const username = toChannelUsername((await params).username); const username = toChannelUsername((await params).username);
if (!username) return { robots: { index: false } }; return {
const channel = await readOnServer(() => getChannel(username)); title: username
if (channel.status !== 'ok') return { robots: { index: false } }; ? i18n.t('channel:meta.title', { username })
if (channel.data.suspended) { : i18n.t('channel:meta.unavailable-title'),
return { description: username
title: i18n.t('channel:meta.unavailable-title'), ? i18n.t('channel:meta.description', { username })
robots: { index: false }, : undefined,
}; robots: { index: false },
} };
return channelMetadata({
channel: channel.data,
title: i18n.t('channel:meta.title', { username }),
description: i18n.t('channel:meta.description', { username }),
});
} }
/** /**
* A creator's channel, `/channels/username`. The same server render for every visitor: the * A creator's channel, `/channels/username`. It renders in the browser only (0070), the same for
* header, the track record and the first posts; subscribe, follow and the locked posts' gates * every visitor: the server reads nothing and sends the skeleton. Any other spelling of the
* load in the browser. Any other spelling of the username redirects to the one the API stores. * username redirects to the stored one, keeping an invite link's `?code=` (0059).
*/ */
export default async function ChannelPage({ export default async function ChannelPage({
params, params,
@ -53,20 +40,17 @@ export default async function ChannelPage({
const segment = (await params).username; const segment = (await params).username;
const username = toChannelUsername(segment); const username = toChannelUsername(segment);
if (!username) notFound(); if (!username) notFound();
// An invite link's `?code=` goes along (0059).
if (username !== segment) { if (username !== segment) {
permanentRedirect( permanentRedirect(
withSearchParams(ROUTES.channel(username), await searchParams), withSearchParams(ROUTES.channel(username), await searchParams),
); );
} }
const channel = await readOnServer(() => getChannel(username));
if (channel.status !== 'ok') notFound();
return ( return (
<ChannelTemplate <ChannelTemplate
channel={channel.data} username={username}
channelUrl={displayUrl(ROUTES.channel(username))} channelUrl={displayUrl(ROUTES.channel(username))}
now={getRequestTime()} siteHost={displayUrl('')}
/> />
); );
} }

View File

@ -1,18 +1,13 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { Card } from '@lumina/island/molecules/card';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { DeskBack } from '@lumina/market/app/navigation'; import { DeskBack } from '@lumina/market/app/navigation';
import { i18n } from '../../../../../../i18n'; import { PostSkeleton } from './templates/post-template';
/** /**
* The post before it arrives, in the 640 column (C4b ۱.۵): «بازگشت», the channel bar's panel * The post before it arrives, in the 640 column under «بازگشت»: the creator's panel, then the
* with the author row and the subscribe and follow row, then the post with its media. No lock is * post with its media. The page shows the same skeleton until its reads arrive.
* guessed meanwhile.
*/ */
export default function Loading() { export default function Loading() {
const t = i18n.getFixedT(null, 'channel');
return ( return (
<FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10"> <FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">
<FlexBox <FlexBox
@ -21,23 +16,7 @@ export default function Loading() {
className="w-full max-w-content" className="w-full max-w-content"
> >
<DeskBack /> <DeskBack />
<Card padding="lg"> <PostSkeleton delayed />
<SkeletonRegion delayed label={t('loading')}>
<FlexBox
alignItems="items-center"
gap="gap-3"
className="min-h-touch-target"
>
<Skeleton shape="circle" className="size-10" />
<Skeleton className="h-4 w-32" />
</FlexBox>
<FlexBox gap="gap-2">
<Skeleton shape="pill" className="h-control-md flex-1" />
<Skeleton shape="pill" className="h-control-md w-32" />
</FlexBox>
</SkeletonRegion>
</Card>
<SkeletonPreset preset="post-media" delayed label={t('post.loading')} />
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>
); );

View File

@ -1,12 +1,5 @@
import { ROUTES } from '@lumina/market/app/navigation'; import { ROUTES } from '@lumina/market/app/navigation';
import { POST_ID_PATTERN } from '@lumina/market/features/post'; import { POST_ID_PATTERN } from '@lumina/market/features/post';
import {
getChannel,
getRequestTime,
getPost,
postMetadata,
readOnServer,
} from '@lumina/market/server';
import { toChannelUsername } from '@lumina/market/shared/utils'; import { toChannelUsername } from '@lumina/market/shared/utils';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { notFound, permanentRedirect } from 'next/navigation'; import { notFound, permanentRedirect } from 'next/navigation';
@ -17,65 +10,37 @@ import { PostTemplate } from './templates/post-template';
type PostPageProps = { params: Promise<{ username: string; id: string }> }; type PostPageProps = { params: Promise<{ username: string; id: string }> };
/** The channel and the post, read together; a post that isn't this channel's is missing. */ // From the address alone (0070): the server reads nothing for this page.
async function readPostPage(username: string, id: string) {
const [channel, post] = await Promise.all([
readOnServer(() => getChannel(username)),
POST_ID_PATTERN.test(id)
? readOnServer(() => getPost(id))
: ({ status: 'not-found' } as const),
]);
if (channel.status !== 'ok') return null;
const found =
post.status === 'ok' && post.data.creatorId === channel.data.creatorId
? post.data
: null;
return { channel: channel.data, post: found };
}
// The one kind of route whose metadata names its data (0055): it reads through the same per-request
// cache as the page, so the first byte, held for the metadata in <head> (0054), waits for that
// one read.
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: PostPageProps): Promise<Metadata> { }: PostPageProps): Promise<Metadata> {
const { username: segment, id } = await params; const username = toChannelUsername((await params).username);
const username = toChannelUsername(segment); return {
const page = username ? await readPostPage(username, id) : null; title: username
if (!page?.post || page.channel.suspended) { ? i18n.t('channel:meta.post-title', { username })
return { : i18n.t('channel:meta.post-missing-title'),
title: i18n.t('channel:meta.post-missing-title'), robots: { index: false },
robots: { index: false }, };
};
}
return postMetadata({
channel: page.channel,
post: page.post,
fallbackTitle: i18n.t('channel:meta.post-title', {
username: page.channel.username,
}),
});
} }
/** /**
* One post, `/channels/username/posts/[id]`: where every shared link lands. The server renders it * One post, `/channels/username/posts/[id]`: where every shared link lands. It renders in the
* as every visitor sees it; a subscriber's or the creator's premium post opens in the browser. A * browser only (0070): the server reads nothing and sends the skeleton; a subscriber's or the
* deleted or unknown post keeps the channel's frame and leads back to the channel. * creator's premium post arrives open. A deleted or unknown post keeps the channel's frame and
* leads back to the channel, as does an id that can't be a post's.
*/ */
export default async function PostPage({ params }: PostPageProps) { export default async function PostPage({ params }: PostPageProps) {
const { username: segment, id } = await params; const { username: segment, id } = await params;
const username = toChannelUsername(segment); const username = toChannelUsername(segment);
if (!username) notFound(); if (!username) notFound();
if (username !== segment) permanentRedirect(ROUTES.post(username, id)); if (username !== segment) permanentRedirect(ROUTES.post(username, id));
const page = await readPostPage(username, id);
if (!page) notFound();
return ( return (
<PostTemplate <PostTemplate
channel={page.channel} username={username}
post={page.post} postId={POST_ID_PATTERN.test(id) ? id : null}
channelUrl={displayUrl(ROUTES.channel(username))} channelUrl={displayUrl(ROUTES.channel(username))}
now={getRequestTime()} siteHost={displayUrl('')}
/> />
); );
} }

View File

@ -0,0 +1,43 @@
'use client';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { Card } from '@lumina/island/molecules/card';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { useTranslation } from 'react-i18next';
import type { PostSkeletonProps } from './types';
/**
* The post before it arrives, in the 640 column under «بازگشت»: the creator's panel with its
* author row and the subscribe and follow row, then the post with its media. No lock is guessed
* meanwhile. The route's loading and the page's own wait share it.
*/
export function PostSkeleton({ delayed }: PostSkeletonProps) {
const { t } = useTranslation('channel');
return (
<>
<Card padding="lg">
<SkeletonRegion delayed={delayed} label={t('loading')}>
<FlexBox
alignItems="items-center"
gap="gap-3"
className="min-h-touch-target"
>
<Skeleton shape="circle" className="size-10" />
<Skeleton className="h-4 w-32" />
</FlexBox>
<FlexBox gap="gap-2">
<Skeleton shape="pill" className="h-control-md flex-1" />
<Skeleton shape="pill" className="h-control-md w-32" />
</FlexBox>
</SkeletonRegion>
</Card>
<SkeletonPreset
preset="post-media"
delayed={delayed}
label={t('post.loading')}
/>
</>
);
}

View File

@ -1,3 +1,5 @@
'use client';
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { DeskBack, ROUTES } from '@lumina/market/app/navigation'; import { DeskBack, ROUTES } from '@lumina/market/app/navigation';
@ -6,21 +8,70 @@ import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[
import { PostChannelBar } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-channel-bar'; import { PostChannelBar } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-channel-bar';
import { PostMissing } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-missing'; import { PostMissing } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-missing';
import { PostView } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-view'; import { PostView } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-view';
import { usePostPage } from '@lumina/market/features/post';
import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import { i18n } from '../../../../../../../../i18n'; import { ChannelMissing } from '../../../../templates/channel-template';
import { PostSkeleton } from './PostSkeleton';
import type { PostTemplateProps } from './types'; import type { PostTemplateProps } from './types';
/** /**
* The post on desktop, in the 640 column under «بازگشت»: the creator with subscribe and follow, * The post on desktop: one 640px column under «بازگشت», the creator's panel with subscribe and
* then the post in full. The action area loads in the browser. * follow, then the post in full. It renders in the browser only (0070): the server sends the
* column and the skeleton, which stay until the channel and the post arrive. The action area
* waits for the viewer.
*/ */
export function PostTemplate({ export function PostTemplate({
channel, username,
post, postId,
channelUrl, channelUrl,
now, siteHost,
}: PostTemplateProps) { }: PostTemplateProps) {
const t = i18n.getFixedT(null, 'channel'); const { t } = useTranslation('channel');
const page = usePostPage(username, postId);
if (page.status === 'not-found')
return <ChannelMissing siteHost={siteHost} />;
let content: ReactNode;
if (page.status === 'pending') {
content = <PostSkeleton />;
} else if (page.channel.suspended) {
content = <ChannelUnavailable context="post" />;
} else if (page.status === 'ok') {
const { channel, post, now } = page;
content = (
<>
<PostChannelBar
channel={channel}
layout="desktop"
verifiedLabel={t('header.verified')}
actions={
<PartBoundary name="post-channel-actions">
<ChannelActions
creatorId={channel.creatorId}
username={channel.username}
channelUrl={channelUrl}
layout="desktop"
saleOpen={channel.saleOpen}
/>
</PartBoundary>
}
/>
<PostView
post={post}
username={channel.username}
displayName={channel.displayName}
avatarUrl={channel.avatarUrl}
now={now}
layout="desktop"
/>
</>
);
} else {
content = <PostMissing username={username} />;
}
return ( return (
<FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10"> <FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">
@ -30,42 +81,8 @@ export function PostTemplate({
className="w-full max-w-content" className="w-full max-w-content"
> >
{/* A link opened on its own goes back to the post's channel (R14). */} {/* A link opened on its own goes back to the post's channel (R14). */}
<DeskBack <DeskBack parentHref={ROUTES.channel(username)} backToPrevious />
parentHref={ROUTES.channel(channel.username)} {content}
backToPrevious
/>
{channel.suspended ? (
<ChannelUnavailable context="post" />
) : post ? (
<>
<PostChannelBar
channel={channel}
layout="desktop"
verifiedLabel={t('header.verified')}
actions={
<PartBoundary name="post-channel-actions">
<ChannelActions
creatorId={channel.creatorId}
username={channel.username}
channelUrl={channelUrl}
layout="desktop"
saleOpen={channel.saleOpen}
/>
</PartBoundary>
}
/>
<PostView
post={post}
username={channel.username}
displayName={channel.displayName}
avatarUrl={channel.avatarUrl}
now={now}
layout="desktop"
/>
</>
) : (
<PostMissing username={channel.username} />
)}
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>
); );

View File

@ -1,2 +1,3 @@
export { PostSkeleton } from './PostSkeleton';
export { PostTemplate } from './PostTemplate'; export { PostTemplate } from './PostTemplate';
export type { PostTemplateProps } from './types'; export type { PostSkeletonProps, PostTemplateProps } from './types';

View File

@ -1,12 +1,15 @@
import type { PublicCreatorPayload } from '@lumina/market/features/channel';
import type { PostPayload } from '@lumina/market/features/post';
export type PostTemplateProps = { export type PostTemplateProps = {
channel: PublicCreatorPayload; /** The channel's username as the API stores it (lower case). */
/** `null`: deleted, unknown, or another channel's. */ username: string;
post: PostPayload | null; /** `null`: the address can't name a post, so the post is missing. */
postId: string | null;
/** «lumina.ir/channels/sara_gold», for the guest's login prompt. */ /** «lumina.ir/channels/sara_gold», for the guest's login prompt. */
channelUrl: string; channelUrl: string;
/** The render's time: the post's time counts from it. */ /** «lumina.ir», for the channel's not-found state. */
now: string; siteHost: string;
};
export type PostSkeletonProps = {
/** The route's loading: shown only when the wait is long enough to notice. */
delayed?: boolean;
}; };

View File

@ -0,0 +1,18 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { ChannelNotFound } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found';
import type { ChannelMissingProps } from './types';
/**
* No channel at this address, or not any more, in the 640 column. Its creator, before approval,
* sees their own tab here instead (C6 ۵.۲); the browser decides.
*/
export function ChannelMissing({ siteHost }: ChannelMissingProps) {
return (
<FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">
<FlexBox direction="flex-col" className="w-full max-w-content">
<ChannelNotFound layout="desktop" siteHost={siteHost} />
</FlexBox>
</FlexBox>
);
}

View File

@ -0,0 +1,37 @@
'use client';
import { Card } from '@lumina/island/molecules/card';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { useTranslation } from 'react-i18next';
import type { ChannelSkeletonProps } from './types';
/**
* The channel before it arrives, in the 640 column under «بازگشت»: the header panel, the track
* record, then a post. The route's loading and the page's own wait share it.
*/
export function ChannelSkeleton({ delayed }: ChannelSkeletonProps) {
const { t } = useTranslation('channel');
return (
<>
<Card padding="lg">
<SkeletonPreset
preset="header"
framed
delayed={delayed}
label={t('loading')}
/>
</Card>
<SkeletonPreset
preset="stats"
delayed={delayed}
label={t('stats.loading')}
/>
<SkeletonPreset
preset="post-media"
delayed={delayed}
label={t('feed.loading')}
/>
</>
);
}

View File

@ -1,125 +1,139 @@
'use client';
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { ApprovedWelcome } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/approved-welcome'; import { ApprovedWelcome } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/approved-welcome';
import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions'; import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions';
import { ChannelDeskBack } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-desk-back'; import { ChannelDeskBack } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-desk-back';
import { ChannelFeed } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-feed/server'; import { ChannelFeed } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-feed';
import { import {
ChannelHeader, ChannelHeader,
channelHeaderLabels, channelHeaderLabels,
} from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header'; } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header';
import { PendingChannelGate } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found'; import { PendingChannelGate } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found';
import { ChannelShare } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-share'; import { ChannelShare } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-share';
import { ChannelStats } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-stats/server'; import { ChannelStats } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-stats';
import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable'; import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable';
import { FollowNotice } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/follow-notice'; import { FollowNotice } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/follow-notice';
import { useChannelPage } from '@lumina/market/features/channel';
import { creatorStatsLabels } from '@lumina/market/shared/labels'; import { creatorStatsLabels } from '@lumina/market/shared/labels';
import type { ReactNode } from 'react';
import { Suspense } from 'react'; import { Suspense } from 'react';
import { useTranslation } from 'react-i18next';
import { i18n } from '../../../../../../i18n'; import { ChannelMissing } from './ChannelMissing';
import { ChannelSkeleton } from './ChannelSkeleton';
import type { ChannelTemplateProps } from './types'; import type { ChannelTemplateProps } from './types';
/** /**
* The channel on desktop: one 640px column, no side rail, under «بازگشت» (R14; none on the * The channel on desktop: one 640px column, no side rail, under «بازگشت» (R14; none on the
* creator's own tab). The header panel renders at once; the first follow's notice and the track * creator's own tab). It renders in the browser only (0070): the server sends the column with
* record follow it, then the feed, streaming in reading order, each in its own boundary, and the * «بازگشت» and the skeleton, which stay until the channel arrives. Then the header panel renders
* action area loads in the browser. * at once; the first follow's notice and the track record follow it, then the feed, each loading
* in its own boundary, and the action area waits for the viewer.
*/ */
export function ChannelTemplate({ export function ChannelTemplate({
channel, username,
channelUrl, channelUrl,
now, siteHost,
}: ChannelTemplateProps) { }: ChannelTemplateProps) {
const t = i18n.getFixedT(null, 'channel'); const { t, i18n } = useTranslation('channel');
const page = useChannelPage(username);
// Suspension outranks everything: no header, posts or actions, for anyone (U6 ۵.۳). if (page.status === 'not-found')
if (channel.suspended) { return <ChannelMissing siteHost={siteHost} />;
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"
>
<ChannelDeskBack creatorId={channel.creatorId} />
<ChannelUnavailable
context="channel"
channel={channel}
channelUrl={channelUrl}
layout="desktop"
/>
</FlexBox>
</FlexBox>
);
}
const publicChannel = ( const channel = page.status === 'ok' ? page.channel : null;
<> let content: ReactNode;
<ApprovedWelcome creatorId={channel.creatorId} layout="desktop" />
<ChannelHeader if (!channel) {
content = <ChannelSkeleton />;
} else if (channel.suspended) {
// Suspension outranks everything: no header, posts or actions, for anyone (U6 ۵.۳).
content = (
<ChannelUnavailable
context="channel"
channel={channel} channel={channel}
channelUrl={channelUrl}
layout="desktop" layout="desktop"
share={ />
<ChannelShare );
creatorId={channel.creatorId} } else {
username={channel.username} const publicChannel = (
channelUrl={channelUrl} <>
layout="desktop" <ApprovedWelcome creatorId={channel.creatorId} layout="desktop" />
/> <ChannelHeader
} channel={channel}
stats={ layout="desktop"
<> share={
<FollowNotice creatorId={channel.creatorId} /> <ChannelShare
<PartBoundary
name="channel-stats"
title={t('stats.error-title')}
description={t('stats.error-description')}
framed
>
<Suspense
fallback={
<SkeletonPreset preset="stats" label={t('stats.loading')} />
}
>
<ChannelStats
creatorId={channel.creatorId}
labels={creatorStatsLabels(i18n.getFixedT(null, 'content'))}
/>
</Suspense>
</PartBoundary>
</>
}
actions={
<PartBoundary name="channel-actions">
<ChannelActions
creatorId={channel.creatorId} creatorId={channel.creatorId}
username={channel.username} username={channel.username}
channelUrl={channelUrl} channelUrl={channelUrl}
layout="desktop" layout="desktop"
saleOpen={channel.saleOpen}
inviteNoteName={channel.displayName}
/> />
</PartBoundary>
}
labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))}
verified={!channel.verificationPending}
/>
<PartBoundary name="channel-feed">
<Suspense
fallback={
<SkeletonPreset preset="post" count={2} label={t('feed.loading')} />
} }
> stats={
<ChannelFeed channel={channel} now={now} layout="desktop" /> <>
</Suspense> <FollowNotice creatorId={channel.creatorId} />
</PartBoundary> <PartBoundary
</> name="channel-stats"
); title={t('stats.error-title')}
description={t('stats.error-description')}
framed
>
<Suspense
fallback={
<SkeletonPreset preset="stats" label={t('stats.loading')} />
}
>
<ChannelStats
creatorId={channel.creatorId}
labels={creatorStatsLabels(i18n.getFixedT(null, 'content'))}
/>
</Suspense>
</PartBoundary>
</>
}
actions={
<PartBoundary name="channel-actions">
<ChannelActions
creatorId={channel.creatorId}
username={channel.username}
channelUrl={channelUrl}
layout="desktop"
saleOpen={channel.saleOpen}
inviteNoteName={channel.displayName}
/>
</PartBoundary>
}
labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))}
verified={!channel.verificationPending}
/>
<PartBoundary name="channel-feed">
<Suspense
fallback={
<SkeletonPreset
preset="post"
count={2}
label={t('feed.loading')}
/>
}
>
<ChannelFeed channel={channel} layout="desktop" />
</Suspense>
</PartBoundary>
</>
);
content = channel.verificationPending ? (
<PendingChannelGate layout="desktop" channelUrl={channelUrl}>
{publicChannel}
</PendingChannelGate>
) : (
publicChannel
);
}
return ( return (
<FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10"> <FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">
@ -128,14 +142,8 @@ export function ChannelTemplate({
gap="gap-4" gap="gap-4"
className="w-full max-w-content" className="w-full max-w-content"
> >
<ChannelDeskBack creatorId={channel.creatorId} /> <ChannelDeskBack creatorId={channel?.creatorId} />
{channel.verificationPending ? ( {content}
<PendingChannelGate layout="desktop" channelUrl={channelUrl}>
{publicChannel}
</PendingChannelGate>
) : (
publicChannel
)}
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>
); );

View File

@ -1,2 +1,8 @@
export { ChannelMissing } from './ChannelMissing';
export { ChannelSkeleton } from './ChannelSkeleton';
export { ChannelTemplate } from './ChannelTemplate'; export { ChannelTemplate } from './ChannelTemplate';
export type { ChannelTemplateProps } from './types'; export type {
ChannelMissingProps,
ChannelSkeletonProps,
ChannelTemplateProps,
} from './types';

View File

@ -1,9 +1,17 @@
import type { PublicCreatorPayload } from '@lumina/market/features/channel';
export type ChannelTemplateProps = { export type ChannelTemplateProps = {
channel: PublicCreatorPayload; /** The username as the API stores it (lower case). */
username: string;
/** «lumina.ir/channels/sara_gold». */ /** «lumina.ir/channels/sara_gold». */
channelUrl: string; channelUrl: string;
/** The render's time: the posts' relative times count from it. */ /** «lumina.ir», for the not-found state. */
now: string; siteHost: string;
};
export type ChannelSkeletonProps = {
/** The route's loading: shown only when the wait is long enough to notice. */
delayed?: boolean;
};
export type ChannelMissingProps = {
siteHost: string;
}; };

View File

@ -1,8 +1,7 @@
import { ROUTES, withSearchParams } from '@lumina/market/app/navigation'; import { ROUTES, withSearchParams } from '@lumina/market/app/navigation';
import { getChannel, readOnServer } from '@lumina/market/server';
import { toChannelUsername } from '@lumina/market/shared/utils'; import { toChannelUsername } from '@lumina/market/shared/utils';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { notFound, permanentRedirect, redirect } from 'next/navigation'; import { notFound, permanentRedirect } from 'next/navigation';
import { i18n } from '../../../../i18n'; import { i18n } from '../../../../i18n';
import { CheckoutTemplate } from './templates/checkout-template'; import { CheckoutTemplate } from './templates/checkout-template';
@ -18,10 +17,10 @@ export const metadata: Metadata = {
}; };
/** /**
* Checkout for a creator's channel (U9), reached only from its «اشتراک». The server renders the * Checkout for a creator's channel (U9), reached only from its «اشتراک». It renders in the
* same page for everyone: the bar and who is being paid; the investor's own checkout loads in the * browser only (0070): the server reads nothing and sends the bar and the skeleton. Another
* browser. Another spelling of the username redirects to the stored one; a suspended channel * spelling of the username redirects to the stored one; a suspended channel sends the visitor to
* sends the visitor to the channel, which says it is unavailable. * the channel, which says it is unavailable.
*/ */
export default async function CheckoutPage({ export default async function CheckoutPage({
params, params,
@ -36,9 +35,6 @@ export default async function CheckoutPage({
withSearchParams(ROUTES.checkout(username), await searchParams), withSearchParams(ROUTES.checkout(username), await searchParams),
); );
} }
const channel = await readOnServer(() => getChannel(username));
if (channel.status !== 'ok') notFound();
if (channel.data.suspended) redirect(ROUTES.channel(username));
return <CheckoutTemplate channel={channel.data} />; return <CheckoutTemplate username={username} />;
} }

View File

@ -1,36 +1,75 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; 'use client';
import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { CheckoutCreator } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-creator'; import {
import { CheckoutPanel } from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-panel'; PartBoundary,
StatusEmptyState,
} from '@lumina/market/app/error-boundaries';
import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation';
import {
CheckoutCreator,
CheckoutCreatorSkeleton,
} from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-creator';
import {
CheckoutPanel,
CheckoutSkeleton,
} from '@lumina/market/app/screens/(flow)/checkout/[username]/organisms/checkout-panel';
import { useCheckoutChannel } from '@lumina/market/features/checkout';
import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import { i18n } from '../../../../../../i18n';
import type { CheckoutTemplateProps } from './types'; import type { CheckoutTemplateProps } from './types';
/** /**
* Checkout on mobile: a task page pushed from the channel, back · «خرید اشتراک» · support and no * 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. * bottom nav (U9 §۲), with the pay block pinned to the bottom of the screen. It renders in the
* browser only (0070): the bar and the skeleton stay until the channel arrives.
*/ */
export function CheckoutTemplate({ channel }: CheckoutTemplateProps) { export function CheckoutTemplate({ username }: CheckoutTemplateProps) {
const t = i18n.getFixedT(null, 'payment'); const { t } = useTranslation('payment');
const page = useCheckoutChannel(username);
const channelHref = ROUTES.channel(username);
let content: ReactNode;
if (page.status === 'pending') {
content = (
<CheckoutSkeleton
layout="mobile"
creator={<CheckoutCreatorSkeleton />}
label={t('checkout.loading')}
/>
);
} else if (page.status === 'not-found') {
content = (
<FlexBox
direction="flex-col"
justifyContent="justify-center"
className="flex-1 px-4"
>
<StatusEmptyState variant="not-found" size="page" />
</FlexBox>
);
} else {
const { channel } = page;
content = (
<PartBoundary name="checkout" description={t('checkout.error')}>
<CheckoutPanel
creatorId={channel.creatorId}
channelHref={channelHref}
layout="mobile"
creator={<CheckoutCreator creator={channel} />}
creatorName={channel.displayName ?? channel.username}
creatorLinks={channel.socialLinks}
/>
</PartBoundary>
);
}
return ( return (
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page"> <FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
<MobileTopBar <MobileTopBar title={t('checkout.title')} parentHref={channelHref} />
title={t('checkout.title')}
parentHref={ROUTES.channel(channel.username)}
/>
<FlexBox tag="main" direction="flex-col" className="flex-1"> <FlexBox tag="main" direction="flex-col" className="flex-1">
<PartBoundary name="checkout" description={t('checkout.error')}> {content}
<CheckoutPanel
creatorId={channel.creatorId}
channelHref={ROUTES.channel(channel.username)}
layout="mobile"
creator={<CheckoutCreator creator={channel} />}
creatorName={channel.displayName ?? channel.username}
creatorLinks={channel.socialLinks}
/>
</PartBoundary>
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>
); );

View File

@ -1,3 +1,4 @@
import type { PublicCreatorPayload } from '@lumina/market/features/channel'; export type CheckoutTemplateProps = {
/** The channel's username as the API stores it (lower case). */
export type CheckoutTemplateProps = { channel: PublicCreatorPayload }; username: string;
};

View File

@ -10,9 +10,11 @@ import type { ReactNode } from 'react';
import { i18n } from '../../../i18n'; import { i18n } from '../../../i18n';
// Only the landing is indexed (0071); both tabs inherit this.
export const metadata: Metadata = { export const metadata: Metadata = {
title: i18n.t('rules:meta-title'), title: i18n.t('rules:meta-title'),
description: i18n.t('rules:meta-description'), description: i18n.t('rules:meta-description'),
robots: { index: false },
}; };
/** /**

View File

@ -1,31 +0,0 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { i18n } from '../../i18n';
/** The landing before it arrives: the header's height, then the hero's picture and copy. */
export default function Loading() {
return (
<SkeletonRegion
label={i18n.t('landing:loading')}
delayed
className="min-h-dvh bg-surface"
>
<FlexBox
alignItems="items-center"
className="h-14 border-b border-border-subtle px-4 tablet:h-16 tablet:px-8"
>
<Skeleton width="5rem" height="1.25rem" />
</FlexBox>
<FlexBox
direction="flex-col"
gap="gap-4"
className="px-4 pt-7 tablet:px-8"
>
<Skeleton shape="rect" width="100%" height="24rem" />
<Skeleton lines={3} height="1rem" />
<Skeleton shape="pill" width="100%" height="3.25rem" />
</FlexBox>
</SkeletonRegion>
);
}

View File

@ -1,5 +1,4 @@
import { AnalystsDirectory } from '@lumina/market/app/screens/(main)/analysts/organisms/analysts-directory'; import { AnalystsDirectory } from '@lumina/market/app/screens/(main)/analysts/organisms/analysts-directory';
import { getFeaturedCreators, readOnServer } from '@lumina/market/server';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { i18n } from '../../../i18n'; import { i18n } from '../../../i18n';
@ -11,20 +10,15 @@ export const metadata: Metadata = {
}; };
/** /**
* «تحلیلگران منتخب», `/analysts` (J04-3): every featured analyst, read on the server, the same for * «تحلیلگران منتخب», `/analysts` (J04-3): every featured analyst, read in the browser only
* every visitor; follow (an investor) and the free registration card (a guest) join in the * (0070), the same for every visitor; follow (an investor) and the free registration card (a
* browser. Signed-in visitors are not sent anywhere. A failed read is the page's error state with * guest) join once the viewer is known. Signed-in visitors are not sent anywhere. A failed read
* its retry, never a partial list. * is the page's error state with its retry, never a partial list.
*/ */
export default async function AnalystsPage() { export default function AnalystsPage() {
const featured = await readOnServer(() => getFeaturedCreators());
return ( return (
<AnalystsTemplate> <AnalystsTemplate>
<AnalystsDirectory <AnalystsDirectory layout="mobile" />
analysts={featured.status === 'ok' ? featured.data : []}
layout="mobile"
/>
</AnalystsTemplate> </AnalystsTemplate>
); );
} }

View File

@ -1,29 +1,19 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { MobileTopBar } from '@lumina/market/app/navigation'; import { MobileTopBar } from '@lumina/market/app/navigation';
import { i18n } from '../../../../i18n'; import { i18n } from '../../../../i18n';
import { ChannelSkeleton } from './templates/channel-template';
/** /**
* The channel before it arrives, in its reading order: the real top bar, the header, the track * The channel before it arrives, in its reading order: the real top bar, the header, the track
* record, then a post. * record, then a post. The page shows the same skeleton until its read arrives.
*/ */
export default function Loading() { export default function Loading() {
const t = i18n.getFixedT(null, 'channel');
return ( return (
<> <>
<MobileTopBar title={t('top-bar.channel')} /> <MobileTopBar title={i18n.t('channel:top-bar.channel')} />
<FlexBox tag="main" direction="flex-col" className="flex-1"> <FlexBox tag="main" direction="flex-col" className="flex-1">
{/* The skeleton draws the header's flush band itself. */} <ChannelSkeleton delayed />
<SkeletonPreset preset="header" delayed label={t('loading')} />
<FlexBox direction="flex-col" gap="gap-4" className="p-4">
<SkeletonPreset preset="stats" delayed label={t('stats.loading')} />
<SkeletonPreset
preset="post-media"
delayed
label={t('feed.loading')}
/>
</FlexBox>
</FlexBox> </FlexBox>
</> </>
); );

View File

@ -1,27 +1,17 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import {
ChannelNotFound,
ChannelNotFoundTopBar,
} from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { displayUrl } from '../../../../configs'; import { displayUrl } from '../../../../configs';
import { i18n } from '../../../../i18n'; import { i18n } from '../../../../i18n';
import { ChannelMissing } from './templates/channel-template';
export const metadata: Metadata = { robots: { index: false } }; export const metadata: Metadata = { robots: { index: false } };
/** /** An address that can't be a username; the page shows the same state for an unknown one. */
* No channel at this address, or not any more. Its creator, before approval, sees their own tab
* here instead (C6 ۱.۲), under their tab bar; both are decided in the browser. The main is flush
* for that tab's banner strip and header; the message keeps its own inset.
*/
export default function ChannelNotFoundPage() { export default function ChannelNotFoundPage() {
return ( return (
<> <ChannelMissing
<ChannelNotFoundTopBar title={i18n.t('channel:top-bar.channel')} /> title={i18n.t('channel:top-bar.channel')}
<FlexBox tag="main" direction="flex-col" className="flex-1"> siteHost={displayUrl('')}
<ChannelNotFound layout="mobile" siteHost={displayUrl('')} /> />
</FlexBox>
</>
); );
} }

View File

@ -1,10 +1,4 @@
import { ROUTES, withSearchParams } from '@lumina/market/app/navigation'; import { ROUTES, withSearchParams } from '@lumina/market/app/navigation';
import {
channelMetadata,
getChannel,
getRequestTime,
readOnServer,
} from '@lumina/market/server';
import { toChannelUsername } from '@lumina/market/shared/utils'; import { toChannelUsername } from '@lumina/market/shared/utils';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { notFound, permanentRedirect } from 'next/navigation'; import { notFound, permanentRedirect } from 'next/navigation';
@ -18,33 +12,26 @@ type ChannelPageProps = {
searchParams: Promise<Record<string, string | string[] | undefined>>; searchParams: Promise<Record<string, string | string[] | undefined>>;
}; };
// The one kind of route whose metadata names its data (0055): it reads through the same per-request // From the address alone (0070): the server reads nothing for this page.
// cache as the page, so the first byte, held for the metadata in <head> (0054), waits for that
// one read.
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: ChannelPageProps): Promise<Metadata> { }: ChannelPageProps): Promise<Metadata> {
const username = toChannelUsername((await params).username); const username = toChannelUsername((await params).username);
if (!username) return { robots: { index: false } }; return {
const channel = await readOnServer(() => getChannel(username)); title: username
if (channel.status !== 'ok') return { robots: { index: false } }; ? i18n.t('channel:meta.title', { username })
if (channel.data.suspended) { : i18n.t('channel:meta.unavailable-title'),
return { description: username
title: i18n.t('channel:meta.unavailable-title'), ? i18n.t('channel:meta.description', { username })
robots: { index: false }, : undefined,
}; robots: { index: false },
} };
return channelMetadata({
channel: channel.data,
title: i18n.t('channel:meta.title', { username }),
description: i18n.t('channel:meta.description', { username }),
});
} }
/** /**
* A creator's channel, `/channels/username`. The same server render for every visitor: the * A creator's channel, `/channels/username`. It renders in the browser only (0070), the same for
* header, the track record and the first posts; subscribe, follow and the locked posts' gates * every visitor: the server reads nothing and sends the skeleton. Any other spelling of the
* load in the browser. Any other spelling of the username redirects to the one the API stores. * username redirects to the stored one, keeping an invite link's `?code=` (0059).
*/ */
export default async function ChannelPage({ export default async function ChannelPage({
params, params,
@ -53,20 +40,17 @@ export default async function ChannelPage({
const segment = (await params).username; const segment = (await params).username;
const username = toChannelUsername(segment); const username = toChannelUsername(segment);
if (!username) notFound(); if (!username) notFound();
// An invite link's `?code=` goes along (0059).
if (username !== segment) { if (username !== segment) {
permanentRedirect( permanentRedirect(
withSearchParams(ROUTES.channel(username), await searchParams), withSearchParams(ROUTES.channel(username), await searchParams),
); );
} }
const channel = await readOnServer(() => getChannel(username));
if (channel.status !== 'ok') notFound();
return ( return (
<ChannelTemplate <ChannelTemplate
channel={channel.data} username={username}
channelUrl={displayUrl(ROUTES.channel(username))} channelUrl={displayUrl(ROUTES.channel(username))}
now={getRequestTime()} siteHost={displayUrl('')}
/> />
); );
} }

View File

@ -1,46 +1,19 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { MobileTopBar } from '@lumina/market/app/navigation'; import { MobileTopBar } from '@lumina/market/app/navigation';
import { i18n } from '../../../../../../i18n'; import { i18n } from '../../../../../../i18n';
import { PostSkeleton } from './templates/post-template';
/** /**
* The post before it arrives, in the real layout (C4b ۱.۵): the live top bar, the channel bar's * The post before it arrives, in the real layout (C4b ۱.۵): the live top bar, the channel bar's
* band with the author row and the subscribe and follow row, then the post with its media. No lock * band, then the post with its media. The page shows the same skeleton until its reads arrive.
* is guessed meanwhile.
*/ */
export default function Loading() { export default function Loading() {
const t = i18n.getFixedT(null, 'channel');
return ( return (
<> <>
<MobileTopBar title={t('top-bar.post')} /> <MobileTopBar title={i18n.t('channel:top-bar.post')} />
<FlexBox tag="main" direction="flex-col" className="flex-1"> <FlexBox tag="main" direction="flex-col" className="flex-1">
<SkeletonRegion <PostSkeleton delayed />
delayed
label={t('loading')}
className="border-b border-border-subtle bg-surface p-4"
>
<FlexBox
alignItems="items-center"
gap="gap-3"
className="min-h-touch-target"
>
<Skeleton shape="circle" className="size-10" />
<Skeleton className="h-4 w-32" />
</FlexBox>
<FlexBox gap="gap-2">
<Skeleton shape="pill" className="h-control-md flex-1" />
<Skeleton shape="pill" className="h-control-md w-32" />
</FlexBox>
</SkeletonRegion>
<FlexBox direction="flex-col" className="p-4">
<SkeletonPreset
preset="post-media"
delayed
label={t('post.loading')}
/>
</FlexBox>
</FlexBox> </FlexBox>
</> </>
); );

View File

@ -1,12 +1,5 @@
import { ROUTES } from '@lumina/market/app/navigation'; import { ROUTES } from '@lumina/market/app/navigation';
import { POST_ID_PATTERN } from '@lumina/market/features/post'; import { POST_ID_PATTERN } from '@lumina/market/features/post';
import {
getChannel,
getRequestTime,
getPost,
postMetadata,
readOnServer,
} from '@lumina/market/server';
import { toChannelUsername } from '@lumina/market/shared/utils'; import { toChannelUsername } from '@lumina/market/shared/utils';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { notFound, permanentRedirect } from 'next/navigation'; import { notFound, permanentRedirect } from 'next/navigation';
@ -17,65 +10,37 @@ import { PostTemplate } from './templates/post-template';
type PostPageProps = { params: Promise<{ username: string; id: string }> }; type PostPageProps = { params: Promise<{ username: string; id: string }> };
/** The channel and the post, read together; a post that isn't this channel's is missing. */ // From the address alone (0070): the server reads nothing for this page.
async function readPostPage(username: string, id: string) {
const [channel, post] = await Promise.all([
readOnServer(() => getChannel(username)),
POST_ID_PATTERN.test(id)
? readOnServer(() => getPost(id))
: ({ status: 'not-found' } as const),
]);
if (channel.status !== 'ok') return null;
const found =
post.status === 'ok' && post.data.creatorId === channel.data.creatorId
? post.data
: null;
return { channel: channel.data, post: found };
}
// The one kind of route whose metadata names its data (0055): it reads through the same per-request
// cache as the page, so the first byte, held for the metadata in <head> (0054), waits for that
// one read.
export async function generateMetadata({ export async function generateMetadata({
params, params,
}: PostPageProps): Promise<Metadata> { }: PostPageProps): Promise<Metadata> {
const { username: segment, id } = await params; const username = toChannelUsername((await params).username);
const username = toChannelUsername(segment); return {
const page = username ? await readPostPage(username, id) : null; title: username
if (!page?.post || page.channel.suspended) { ? i18n.t('channel:meta.post-title', { username })
return { : i18n.t('channel:meta.post-missing-title'),
title: i18n.t('channel:meta.post-missing-title'), robots: { index: false },
robots: { index: false }, };
};
}
return postMetadata({
channel: page.channel,
post: page.post,
fallbackTitle: i18n.t('channel:meta.post-title', {
username: page.channel.username,
}),
});
} }
/** /**
* One post, `/channels/username/posts/[id]`: where every shared link lands. The server renders it * One post, `/channels/username/posts/[id]`: where every shared link lands. It renders in the
* as every visitor sees it; a subscriber's or the creator's premium post opens in the browser. A * browser only (0070): the server reads nothing and sends the skeleton; a subscriber's or the
* deleted or unknown post keeps the channel's frame and leads back to the channel. * creator's premium post arrives open. A deleted or unknown post keeps the channel's frame and
* leads back to the channel, as does an id that can't be a post's.
*/ */
export default async function PostPage({ params }: PostPageProps) { export default async function PostPage({ params }: PostPageProps) {
const { username: segment, id } = await params; const { username: segment, id } = await params;
const username = toChannelUsername(segment); const username = toChannelUsername(segment);
if (!username) notFound(); if (!username) notFound();
if (username !== segment) permanentRedirect(ROUTES.post(username, id)); if (username !== segment) permanentRedirect(ROUTES.post(username, id));
const page = await readPostPage(username, id);
if (!page) notFound();
return ( return (
<PostTemplate <PostTemplate
channel={page.channel} username={username}
post={page.post} postId={POST_ID_PATTERN.test(id) ? id : null}
channelUrl={displayUrl(ROUTES.channel(username))} channelUrl={displayUrl(ROUTES.channel(username))}
now={getRequestTime()} siteHost={displayUrl('')}
/> />
); );
} }

View File

@ -0,0 +1,46 @@
'use client';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { useTranslation } from 'react-i18next';
import type { PostSkeletonProps } from './types';
/**
* The post before it arrives, in the real layout (C4b ۱.۵), under the live top bar: the channel
* bar's band with the author row and the subscribe and follow row, then the post with its media.
* No lock is guessed meanwhile. The route's loading and the page's own wait share it.
*/
export function PostSkeleton({ delayed }: PostSkeletonProps) {
const { t } = useTranslation('channel');
return (
<>
<SkeletonRegion
delayed={delayed}
label={t('loading')}
className="border-b border-border-subtle bg-surface p-4"
>
<FlexBox
alignItems="items-center"
gap="gap-3"
className="min-h-touch-target"
>
<Skeleton shape="circle" className="size-10" />
<Skeleton className="h-4 w-32" />
</FlexBox>
<FlexBox gap="gap-2">
<Skeleton shape="pill" className="h-control-md flex-1" />
<Skeleton shape="pill" className="h-control-md w-32" />
</FlexBox>
</SkeletonRegion>
<FlexBox direction="flex-col" className="p-4">
<SkeletonPreset
preset="post-media"
delayed={delayed}
label={t('post.loading')}
/>
</FlexBox>
</>
);
}

View File

@ -1,3 +1,5 @@
'use client';
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation'; import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation';
@ -6,67 +8,88 @@ import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[
import { PostChannelBar } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-channel-bar'; import { PostChannelBar } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-channel-bar';
import { PostMissing } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-missing'; import { PostMissing } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-missing';
import { PostView } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-view'; import { PostView } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-view';
import { usePostPage } from '@lumina/market/features/post';
import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import { i18n } from '../../../../../../../../i18n'; import { ChannelMissing } from '../../../../templates/channel-template';
import { PostSkeleton } from './PostSkeleton';
import type { PostTemplateProps } from './types'; import type { PostTemplateProps } from './types';
/** /**
* The post on mobile, pushed from خانه or the channel: the creator with subscribe and follow, * The post on mobile, pushed from خانه or the channel: the creator with subscribe and follow,
* then the post in full. The action area loads in the browser. * then the post in full. It renders in the browser only (0070): the server sends the top bar and
* the skeleton, which stay until the channel and the post arrive. The action area waits for the
* viewer.
*/ */
export function PostTemplate({ export function PostTemplate({
channel, username,
post, postId,
channelUrl, channelUrl,
now, siteHost,
}: PostTemplateProps) { }: PostTemplateProps) {
const t = i18n.getFixedT(null, 'channel'); const { t, i18n } = useTranslation('channel');
const page = usePostPage(username, postId);
if (page.status === 'not-found') {
return <ChannelMissing title={t('top-bar.channel')} siteHost={siteHost} />;
}
let content: ReactNode;
if (page.status === 'pending') {
content = <PostSkeleton />;
} else if (page.channel.suspended) {
content = <ChannelUnavailable context="post" />;
} else if (page.status === 'ok') {
const { channel, post, now } = page;
content = (
<>
<PostChannelBar
channel={channel}
layout="mobile"
verifiedLabel={t('header.verified')}
actions={
<PartBoundary name="post-channel-actions">
<ChannelActions
creatorId={channel.creatorId}
username={channel.username}
channelUrl={channelUrl}
layout="mobile"
saleOpen={channel.saleOpen}
/>
</PartBoundary>
}
/>
<FlexBox direction="flex-col" className="p-4">
<PostView
post={post}
username={channel.username}
displayName={channel.displayName}
avatarUrl={channel.avatarUrl}
now={now}
layout="mobile"
/>
</FlexBox>
</>
);
} else {
content = (
<FlexBox direction="flex-col" className="flex-1 bg-surface px-4">
<PostMissing username={username} />
</FlexBox>
);
}
return ( return (
<> <>
<MobileTopBar <MobileTopBar
title={t('top-bar.post')} title={t('top-bar.post')}
previewTitle={i18n.t('content:preview.title')} previewTitle={i18n.t('content:preview.title')}
parentHref={ROUTES.channel(channel.username)} parentHref={ROUTES.channel(username)}
backToPrevious backToPrevious
/> />
<FlexBox tag="main" direction="flex-col" className="flex-1"> <FlexBox tag="main" direction="flex-col" className="flex-1">
{channel.suspended ? ( {content}
<ChannelUnavailable context="post" />
) : post ? (
<>
<PostChannelBar
channel={channel}
layout="mobile"
verifiedLabel={t('header.verified')}
actions={
<PartBoundary name="post-channel-actions">
<ChannelActions
creatorId={channel.creatorId}
username={channel.username}
channelUrl={channelUrl}
layout="mobile"
saleOpen={channel.saleOpen}
/>
</PartBoundary>
}
/>
<FlexBox direction="flex-col" className="p-4">
<PostView
post={post}
username={channel.username}
displayName={channel.displayName}
avatarUrl={channel.avatarUrl}
now={now}
layout="mobile"
/>
</FlexBox>
</>
) : (
<FlexBox direction="flex-col" className="flex-1 bg-surface px-4">
<PostMissing username={channel.username} />
</FlexBox>
)}
</FlexBox> </FlexBox>
</> </>
); );

View File

@ -1,2 +1,3 @@
export { PostSkeleton } from './PostSkeleton';
export { PostTemplate } from './PostTemplate'; export { PostTemplate } from './PostTemplate';
export type { PostTemplateProps } from './types'; export type { PostSkeletonProps, PostTemplateProps } from './types';

View File

@ -1,12 +1,15 @@
import type { PublicCreatorPayload } from '@lumina/market/features/channel';
import type { PostPayload } from '@lumina/market/features/post';
export type PostTemplateProps = { export type PostTemplateProps = {
channel: PublicCreatorPayload; /** The channel's username as the API stores it (lower case). */
/** `null`: deleted, unknown, or another channel's. */ username: string;
post: PostPayload | null; /** `null`: the address can't name a post, so the post is missing. */
postId: string | null;
/** «lumina.ir/channels/sara_gold», for the guest's login prompt. */ /** «lumina.ir/channels/sara_gold», for the guest's login prompt. */
channelUrl: string; channelUrl: string;
/** The render's time: the post's time counts from it. */ /** «lumina.ir», for the channel's not-found state. */
now: string; siteHost: string;
};
export type PostSkeletonProps = {
/** The route's loading: shown only when the wait is long enough to notice. */
delayed?: boolean;
}; };

View File

@ -0,0 +1,23 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import {
ChannelNotFound,
ChannelNotFoundTopBar,
} from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found';
import type { ChannelMissingProps } from './types';
/**
* No channel at this address, or not any more. Its creator, before approval, sees their own tab
* here instead (C6 ۱.۲), under their tab bar; both are decided in the browser. The main is flush
* for that tab's banner strip and header; the message keeps its own inset.
*/
export function ChannelMissing({ title, siteHost }: ChannelMissingProps) {
return (
<>
<ChannelNotFoundTopBar title={title} />
<FlexBox tag="main" direction="flex-col" className="flex-1">
<ChannelNotFound layout="mobile" siteHost={siteHost} />
</FlexBox>
</>
);
}

View File

@ -0,0 +1,33 @@
'use client';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { useTranslation } from 'react-i18next';
import type { ChannelSkeletonProps } from './types';
/**
* The channel before it arrives, in its reading order, under the real top bar: the header, the
* track record, then a post. The route's loading and the page's own wait share it.
*/
export function ChannelSkeleton({ delayed }: ChannelSkeletonProps) {
const { t } = useTranslation('channel');
return (
<>
{/* The skeleton draws the header's flush band itself. */}
<SkeletonPreset preset="header" delayed={delayed} label={t('loading')} />
<FlexBox direction="flex-col" gap="gap-4" className="p-4">
<SkeletonPreset
preset="stats"
delayed={delayed}
label={t('stats.loading')}
/>
<SkeletonPreset
preset="post-media"
delayed={delayed}
label={t('feed.loading')}
/>
</FlexBox>
</>
);
}

View File

@ -1,36 +1,67 @@
'use client';
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { MobileTopBar } from '@lumina/market/app/navigation'; import { MobileTopBar } from '@lumina/market/app/navigation';
import { ApprovedWelcome } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/approved-welcome'; import { ApprovedWelcome } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/approved-welcome';
import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions'; import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions';
import { ChannelFeed } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-feed/server'; import { ChannelFeed } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-feed';
import { import {
ChannelHeader, ChannelHeader,
channelHeaderLabels, channelHeaderLabels,
} from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header'; } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header';
import { PendingChannelGate } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found'; import { PendingChannelGate } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found';
import { ChannelShare } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-share'; import { ChannelShare } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-share';
import { ChannelStats } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-stats/server'; import { ChannelStats } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-stats';
import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable'; import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable';
import { FollowNotice } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/follow-notice'; import { FollowNotice } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/follow-notice';
import { useChannelPage } from '@lumina/market/features/channel';
import { creatorStatsLabels } from '@lumina/market/shared/labels'; import { creatorStatsLabels } from '@lumina/market/shared/labels';
import { Suspense } from 'react'; import { Suspense } from 'react';
import { useTranslation } from 'react-i18next';
import { i18n } from '../../../../../../i18n'; import { ChannelMissing } from './ChannelMissing';
import { ChannelSkeleton } from './ChannelSkeleton';
import type { ChannelTemplateProps } from './types'; import type { ChannelTemplateProps } from './types';
/** /**
* The channel on mobile: a page pushed from خانه (the creator's own کانال tab). The header renders * The channel on mobile: a page pushed from خانه (the creator's own کانال tab). It renders in the
* at once; the first follow's notice and the track record open the padded column, then the feed, * browser only (0070): the server sends the top bar and the skeleton, which stay until the
* streaming in reading order, each in its own boundary, and the action area loads in the browser. * channel arrives. Then the header renders at once; the first follow's notice and the track
* record open the padded column, then the feed, each loading in its own boundary, and the action
* area waits for the viewer.
*/ */
export function ChannelTemplate({ export function ChannelTemplate({
channel, username,
channelUrl, channelUrl,
now, siteHost,
}: ChannelTemplateProps) { }: ChannelTemplateProps) {
const t = i18n.getFixedT(null, 'channel'); const { t, i18n } = useTranslation('channel');
const page = useChannelPage(username);
if (page.status === 'not-found') {
return <ChannelMissing title={t('top-bar.channel')} siteHost={siteHost} />;
}
const channel = page.status === 'ok' ? page.channel : null;
const topBar = (
<MobileTopBar
title={t('top-bar.channel')}
tabOwnerId={channel?.creatorId}
/>
);
if (!channel) {
return (
<>
{topBar}
<FlexBox tag="main" direction="flex-col" className="flex-1">
<ChannelSkeleton />
</FlexBox>
</>
);
}
// Suspension outranks everything: no header, posts or actions, for anyone (U6 ۱.۳). Its creator // Suspension outranks everything: no header, posts or actions, for anyone (U6 ۱.۳). Its creator
// sees their suspended tab under their tab bar (C6 ۱.۳); the browser decides. The main is flush // sees their suspended tab under their tab bar (C6 ۱.۳); the browser decides. The main is flush
@ -38,10 +69,7 @@ export function ChannelTemplate({
if (channel.suspended) { if (channel.suspended) {
return ( return (
<> <>
<MobileTopBar {topBar}
title={t('top-bar.channel')}
tabOwnerId={channel.creatorId}
/>
<FlexBox tag="main" direction="flex-col" className="flex-1"> <FlexBox tag="main" direction="flex-col" className="flex-1">
<ChannelUnavailable <ChannelUnavailable
context="channel" context="channel"
@ -116,7 +144,7 @@ export function ChannelTemplate({
/> />
} }
> >
<ChannelFeed channel={channel} now={now} layout="mobile" /> <ChannelFeed channel={channel} layout="mobile" />
</Suspense> </Suspense>
</PartBoundary> </PartBoundary>
</FlexBox> </FlexBox>
@ -125,10 +153,7 @@ export function ChannelTemplate({
return ( return (
<> <>
<MobileTopBar {topBar}
title={t('top-bar.channel')}
tabOwnerId={channel.creatorId}
/>
<FlexBox tag="main" direction="flex-col" className="flex-1"> <FlexBox tag="main" direction="flex-col" className="flex-1">
{channel.verificationPending ? ( {channel.verificationPending ? (
<PendingChannelGate layout="mobile" channelUrl={channelUrl}> <PendingChannelGate layout="mobile" channelUrl={channelUrl}>

View File

@ -1,2 +1,8 @@
export { ChannelMissing } from './ChannelMissing';
export { ChannelSkeleton } from './ChannelSkeleton';
export { ChannelTemplate } from './ChannelTemplate'; export { ChannelTemplate } from './ChannelTemplate';
export type { ChannelTemplateProps } from './types'; export type {
ChannelMissingProps,
ChannelSkeletonProps,
ChannelTemplateProps,
} from './types';

View File

@ -1,9 +1,19 @@
import type { PublicCreatorPayload } from '@lumina/market/features/channel';
export type ChannelTemplateProps = { export type ChannelTemplateProps = {
channel: PublicCreatorPayload; /** The username as the API stores it (lower case). */
username: string;
/** «lumina.ir/channels/sara_gold». */ /** «lumina.ir/channels/sara_gold». */
channelUrl: string; channelUrl: string;
/** The render's time: the posts' relative times count from it. */ /** «lumina.ir», for the not-found state. */
now: string; siteHost: string;
};
export type ChannelSkeletonProps = {
/** The route's loading: shown only when the wait is long enough to notice. */
delayed?: boolean;
};
export type ChannelMissingProps = {
/** The top bar's title: «کانال». */
title: string;
siteHost: string;
}; };

View File

@ -1,6 +1,6 @@
# 0021 A channel's feed starts from the server's first page as initial data # 0021 A channel's feed starts from the server's first page as initial data
Status: Proposed · Area: architecture · Date: 2026-10-07 · Decided by: agent Status: Superseded by 0070 · Area: architecture · Date: 2026-10-07 · Decided by: agent
## Context ## Context
The channel feed and the post page must be in the server HTML for search and first paint, stay live in the browser (older pages, edits, deletes, a subscriber's unlocked posts), and the platform can't reach the app's per-request `getQueryClient()` to prefetch and dehydrate. The channel feed and the post page must be in the server HTML for search and first paint, stay live in the browser (older pages, edits, deletes, a subscriber's unlocked posts), and the platform can't reach the app's per-request `getQueryClient()` to prefetch and dehydrate.

View File

@ -1,6 +1,6 @@
# 0045 The channel's server read carries the public follower count # 0045 The channel's server read carries the public follower count
Status: Proposed · Area: architecture · Date: 2026-10-09 · Decided by: agent Status: Superseded by 0070 · Area: architecture · Date: 2026-10-09 · Decided by: agent
## Context ## Context
The new channel header shows the follower count to everyone and «مشترک فعال» only to the owner (R15). The new channel header shows the follower count to everyone and «مشترک فعال» only to the owner (R15).

View File

@ -1,6 +1,6 @@
# 0055 Static `metadata` everywhere but the channel and post pages # 0055 Static `metadata` everywhere but the channel and post pages
Status: Accepted · Area: architecture · Date: 2026-10-09 · Decided by: user Status: Superseded by 0070 · Area: architecture · Date: 2026-10-09 · Decided by: user
## Context ## Context
Adapted from kasra-pay's decision 0036. Under blocking metadata (0054), any data a `generateMetadata` awaits delays the page's first byte. Almost every Lumina route's title and description is fixed copy from i18next. The channel (`/@username`) and post (`/@username/posts/[id]`) pages are the exception: search results and shared-link previews need the channel's and post's name, image and noindex state. Adapted from kasra-pay's decision 0036. Under blocking metadata (0054), any data a `generateMetadata` awaits delays the page's first byte. Almost every Lumina route's title and description is fixed copy from i18next. The channel (`/@username`) and post (`/@username/posts/[id]`) pages are the exception: search results and shared-link previews need the channel's and post's name, image and noindex state.

View File

@ -0,0 +1,26 @@
# 0070 Render every page except the landing in the browser
Status: Accepted · Area: architecture · Date: 2026-10-21 · Decided by: user · Supersedes: 0021, 0045, 0055
## Context
A creator can announce a post for a set time, and tens of thousands of visitors may open the same channel or post at once. Each server render of a channel cost five back-end reads, a post four. The user wants the Next.js servers free of that pressure, and accepts losing search results and rich link previews for channels and posts.
## Decision
- The landing (`/`) is the only page whose content the server renders, all of it in the first flush, with no `loading.tsx`.
- Every other page renders its content in the browser, for guests and members alike. The server reads no back-end data: it sends the frame, a same-size skeleton, and the metadata. This now includes `/channels/[username]`, `/channels/[username]/posts/[id]`, `/checkout/[username]` and `/analysts`.
- Channel and post pages are `noindex` and keep a `loading.tsx`. Their `generateMetadata` reads only the URL's params; every other page exports static `metadata`.
- The server still checks a URL's shape without reading data: a username in another spelling answers 308, a malformed one 404.
## Alternatives
- Server-render the channel header and post text from one back-end-cached read (hybrid): keeps link previews and SEO for one cache hit per request. The user chose to keep the server free of reads.
- Server metadata only (one read per request) so link previews name the channel: rejected for the same reason.
## Consequences
- The back-end load stays: the same reads now come from browsers, with the session's cookies. The back end needs its own cache for public reads before a spike.
- Shared channel and post links show the generic site card, and search engines index no channel or post content.
- Channel and post content paints later on a first visit: after the JavaScript, then the read.
- A missing channel or post answers 200, and its not-found state renders in the browser.

View File

@ -0,0 +1,22 @@
# 0071 Index only the landing
Status: Accepted · Area: architecture · Date: 2026-10-21 · Decided by: user
## Context
After 0070, the landing is the only page whose content the server renders. The user confirmed that no page except the landing needs search engines: channels, posts and the rules pages included.
## Decision
- The landing (`/`) is the only indexable page in bull and bear.
- Every other page is `noindex`, set in its own or its layout's `metadata`, and has no canonical or JSON-LD. The rules pages (`/terms`, `/terms/subscription`) get it from the `terms` layout.
- A new page is `noindex` unless a later decision says otherwise.
## Alternatives
- Keep the rules pages indexable: they read no data and render on the server, but the user wants no search presence beyond the landing.
## Consequences
- A rendering doc's Index column is `no` for every section outside the landing, and the ready-for-review checks for `primary` and `secondary` rows apply only to the landing.
- A sitemap, if one is ever added, lists only `/`.

View File

@ -18,7 +18,6 @@
- 0052 Evict the service worker's least recently used entry first, with the key order kept in memory and older-half hits stored again. - 0052 Evict the service worker's least recently used entry first, with the key order kept in memory and older-half hits stored again.
- 0053 Ship bull and bear with the same worker options and `NEXT_PUBLIC_SERVICE_WORKER_ENABLED`; both serve the manifest from `platforms/market/src/app/manifest`. - 0053 Ship bull and bear with the same worker options and `NEXT_PUBLIC_SERVICE_WORKER_ENABLED`; both serve the manifest from `platforms/market/src/app/manifest`.
- 0054 Set `htmlLimitedBots: /.*/` in both apps' `next.config.ts`, so every visitor gets metadata in `<head>`. - 0054 Set `htmlLimitedBots: /.*/` in both apps' `next.config.ts`, so every visitor gets metadata in `<head>`.
- 0055 Export static `metadata` from every layout and page; only the channel and post pages use `generateMetadata`, through the page's cached read.
- 0057 Back links to `parentHref` and traverses history only when that is the previous entry; `backToPrevious` pages (and pages without `parentHref`) accept any previous page. - 0057 Back links to `parentHref` and traverses history only when that is the previous entry; `backToPrevious` pages (and pages without `parentHref`) accept any previous page.
- 0058 Opening notifications records "seen" and clears the bell; a row stays unread until tapped; creators filter one list by «همه · پیش‌بینی‌ها · مالی · حساب». - 0058 Opening notifications records "seen" and clears the bell; a row stays unread until tapped; creators filter one list by «همه · پیش‌بینی‌ها · مالی · حساب».
- 0059 Checkout and the channel save `?code=` into the per-creator checkout draft on arrival; checkout then strips it from the URL. - 0059 Checkout and the channel save `?code=` into the per-creator checkout draft on arrival; checkout then strips it from the URL.
@ -28,6 +27,8 @@
- 0066 Give every app `INTERNAL_END_POINT` (server calls) and `NEXT_PUBLIC_CLIENT_END_POINT` (the API's public origin, called directly by the browser with credentials), both set in the bootstraps; no `next.config.ts` rewrite. - 0066 Give every app `INTERNAL_END_POINT` (server calls) and `NEXT_PUBLIC_CLIENT_END_POINT` (the API's public origin, called directly by the browser with credentials), both set in the bootstraps; no `next.config.ts` rewrite.
- 0067 Run each app as one container publishing `HTTP_PORT`, with no per-app nginx; `tools/deploy.sh` checks the new release's `/healthz` off to the side, then replaces the old release. - 0067 Run each app as one container publishing `HTTP_PORT`, with no per-app nginx; `tools/deploy.sh` checks the new release's `/healthz` off to the side, then replaces the old release.
- 0068 Keep the previous release as a stopped `<app>-<UTC time>` container with its env folder; `tools/rollback.sh <app>` starts it in place of the serving one. - 0068 Keep the previous release as a stopped `<app>-<UTC time>` container with its env folder; `tools/rollback.sh <app>` starts it in place of the serving one.
- 0070 Render every page except the landing in the browser: the server reads no data and sends the frame, a skeleton and metadata; channel and post are `noindex`, their metadata from params only.
- 0071 Index only the landing in bull and bear; every other page is `noindex` with no canonical or JSON-LD, new pages included.
## Proposed ## Proposed
@ -39,7 +40,6 @@
- 0016 architecture: Keep a creator who hasn't finished step 5 out of publishing and pricing through the session's `needsProfile`, with `OnboardingGuard` in those routes' layouts and `GuestGuard`. - 0016 architecture: Keep a creator who hasn't finished step 5 out of publishing and pricing through the session's `needsProfile`, with `OnboardingGuard` in those routes' layouts and `GuestGuard`.
- 0017 architecture: Give every auth and onboarding route its own `loading.tsx` matching its frame; an index route with nested steps sits in its own route group. - 0017 architecture: Give every auth and onboarding route its own `loading.tsx` matching its frame; an index route with nested steps sits in its own route group.
- 0020 architecture: Server-rendered platform organisms take their text as `labels` built by the app's template from its server i18n; client organisms use `useTranslation`. - 0020 architecture: Server-rendered platform organisms take their text as `labels` built by the app's template from its server i18n; client organisms use `useTranslation`.
- 0021 architecture: A channel's feed and post page start from the server's read as query `initialData`, re-read in the browser for the creator or a subscriber, and update in place after mutations.
- 0022 architecture: The API enforces post rules (2000 characters, four JPG/PNG/WebP images of 5 MB, 15-minute edit window, approved creators only); the composer mirrors them in `POST_LIMITS`. - 0022 architecture: The API enforces post rules (2000 characters, four JPG/PNG/WebP images of 5 MB, 15-minute edit window, approved creators only); the composer mirrors them in `POST_LIMITS`.
- 0023 architecture: On desktop «پست جدید», post edit and «پیش‌بینی جدید» are dialogs over the page through bear's `@modal` intercepts; slots are emptied by explicit null pages, never a catch-all, and a hard load gets the full page. - 0023 architecture: On desktop «پست جدید», post edit and «پیش‌بینی جدید» are dialogs over the page through bear's `@modal` intercepts; slots are emptied by explicit null pages, never a catch-all, and a hard load gets the full page.
- 0025 architecture: The investor's داشبورد is a tabbed section, one route per tab in `dashboard/(investor)`, whose layout holds the top bar or heading and `DashboardTabs`; each tab has its own loading. - 0025 architecture: The investor's داشبورد is a tabbed section, one route per tab in `dashboard/(investor)`, whose layout holds the top bar or heading and `DashboardTabs`; each tab has its own loading.
@ -57,7 +57,6 @@
- 0041 architecture: Confirm sign-out, call `auth.logout`, then reload to the landing. - 0041 architecture: Confirm sign-out, call `auth.logout`, then reload to the landing.
- 0042 architecture: When a session ends mid-use, show the session-ended state and keep drafts; only an explicit sign-out clears drafts and `session.*` keys. - 0042 architecture: When a session ends mid-use, show the session-ended state and keep drafts; only an explicit sign-out clears drafts and `session.*` keys.
- 0043 architecture: Freeze every network action offline with island `useOfflineFreeze`, showing the reason. - 0043 architecture: Freeze every network action offline with island `useOfflineFreeze`, showing the reason.
- 0045 architecture: The channel's server read carries the public follower count; the browser keeps it live and shows «مشترک فعال» only to the owner.
- 0046 architecture: Serve `/account/profile` in `(flow)` for both roles, switching investor form and creator profile edit in the browser. - 0046 architecture: Serve `/account/profile` in `(flow)` for both roles, switching investor form and creator profile edit in the browser.
- 0047 architecture: The pwa lib keeps the browser's install offer; offer install at `/account/install` and once on bull's خانه with a 30-day snooze; the manifest starts at `/feed`. - 0047 architecture: The pwa lib keeps the browser's install offer; offer install at `/account/install` and once on bull's خانه with a 30-day snooze; the manifest starts at `/feed`.
- 0049 design: A page error keeps the page's own bar, derived from the path; route groups without a frame pass `standalone`. - 0049 design: A page error keeps the page's own bar, derived from the path; route groups without a frame pass `standalone`.

View File

@ -6,6 +6,8 @@ bull (mobile) and bear (desktop) share one doc per route under `market/`, with b
## market ## market
Only `/` is indexable (0071), and it is the only page whose content the server renders (0070). Every other page is `noindex`; all but the rules pages render their content in the browser.
Layouts and error pages: Layouts and error pages:
- root layout · [layout.md](market/layout.md) · — · — · browser: NetworkStatus, Toaster, ToastPlacementMarker (bear) - root layout · [layout.md](market/layout.md) · — · — · browser: NetworkStatus, Toaster, ToastPlacementMarker (bear)
@ -15,19 +17,19 @@ Layouts and error pages:
- `(main)/dashboard/(investor)` layout · [layout-dashboard-investor.md](market/layout-dashboard-investor.md) · — · — · browser: notification bell and account avatar (bull) - `(main)/dashboard/(investor)` layout · [layout-dashboard-investor.md](market/layout-dashboard-investor.md) · — · — · browser: notification bell and account avatar (bull)
- not-found and error · [not-found.md](market/not-found.md) · noindex · none · browser: not-found top bar, every group `error.tsx`, `global-error.tsx` - not-found and error · [not-found.md](market/not-found.md) · noindex · none · browser: not-found top bar, every group `error.tsx`, `global-error.tsx`
Indexable: Rendered on the server:
- `/` · [home.md](market/home.md) · index · FAQPage · browser: LandingRedirect - `/` · [home.md](market/home.md) · index · FAQPage · browser: LandingRedirect
- `/channels/[username]` · [channels-username.md](market/channels-username.md) · index; noindex when invalid, missing or suspended · none · browser: MobileTopBar (bull), ApprovedWelcome, ChannelActions, FollowNotice, locked post gate, Load more, PostLightbox - `/terms` · [terms.md](market/terms.md) · noindex · none · browser: none
- `/channels/[username]/posts/[id]` · [channels-username-posts-id.md](market/channels-username-posts-id.md) · index; noindex when the post is missing, belongs to another channel, or the channel is suspended · none · browser: MobileTopBar (bull), ChannelActions, locked post gate, PreviewBanner, PostLightbox, access-ended toast - `/terms/subscription` · [terms-subscription.md](market/terms-subscription.md) · noindex · none · browser: none
- `/terms` · [terms.md](market/terms.md) · index · none · browser: none
- `/terms/subscription` · [terms-subscription.md](market/terms-subscription.md) · index · none · browser: none
`(main)`: `(main)`:
- `/channels/[username]` · [channels-username.md](market/channels-username.md) · noindex · none · browser: every section (header, counts, actions, stats, feed, ChannelMissing, ChannelUnavailable), ApprovedWelcome, FollowNotice, Load more, PostLightbox
- `/channels/[username]/posts/[id]` · [channels-username-posts-id.md](market/channels-username-posts-id.md) · noindex · none · browser: every section (PostChannelBar, ChannelActions, PostView, PostMissing, ChannelMissing, ChannelUnavailable), PreviewBanner, PostLightbox, access-ended toast
- `/feed` · [feed.md](market/feed.md) · noindex · none · browser: top-bar bell/avatar/login, HomeGuard, HomeFeed (featured row, post cards, empty state), PostLightbox, InstallPrompt (bull) - `/feed` · [feed.md](market/feed.md) · noindex · none · browser: top-bar bell/avatar/login, HomeGuard, HomeFeed (featured row, post cards, empty state), PostLightbox, InstallPrompt (bull)
- `/search` · [search.md](market/search.md) · noindex · none · browser: top-bar bell/avatar/login, SearchPanel (field, recent searches, featured, results) - `/search` · [search.md](market/search.md) · noindex · none · browser: top-bar bell/avatar/login, SearchPanel (field, recent searches, featured, results)
- `/analysts` · [analysts.md](market/analysts.md) · noindex · none · browser: top-bar title/brand/login, AnalystFollowButton, GuestSignupCard - `/analysts` · [analysts.md](market/analysts.md) · noindex · none · browser: top-bar title/brand/login, AnalystsDirectory (heading, note, AnalystList), AnalystFollowButton, GuestSignupCard
- `/notifications` · [notifications.md](market/notifications.md) · noindex · none · browser: top-bar title/login, NotificationCentre (filter chips, rows) - `/notifications` · [notifications.md](market/notifications.md) · noindex · none · browser: top-bar title/login, NotificationCentre (filter chips, rows)
- `/account` · [account.md](market/account.md) · noindex · none · browser: top-bar title/login, AccountOverview (identity, lists, sign-out), SupportDialog, SignOutConfirm - `/account` · [account.md](market/account.md) · noindex · none · browser: top-bar title/login, AccountOverview (identity, lists, sign-out), SupportDialog, SignOutConfirm
- `/account/install` · [account-install.md](market/account-install.md) · noindex · none · browser: top-bar title/login, InstallApp - `/account/install` · [account-install.md](market/account-install.md) · noindex · none · browser: top-bar title/login, InstallApp
@ -43,7 +45,7 @@ Indexable:
`(flow)`: `(flow)`:
- `/account/profile` · [account-profile.md](market/account-profile.md) · noindex · none · browser: AccountProfile (investor form or creator profile edit), LeaveDialog - `/account/profile` · [account-profile.md](market/account-profile.md) · noindex · none · browser: AccountProfile (investor form or creator profile edit), LeaveDialog
- `/checkout/[username]` · [checkout-username.md](market/checkout-username.md) · noindex · none · browser: CheckoutPanel, CheckoutForm (tiers, code, pay footer), CheckoutHalts, NoCodeSheet - `/checkout/[username]` · [checkout-username.md](market/checkout-username.md) · noindex · none · browser: CheckoutCreator, CheckoutPanel, CheckoutForm (tiers, code, pay footer), CheckoutHalts, NoCodeSheet
- `/compose/post` · [compose-post.md](market/compose-post.md) · noindex · none · browser: PostComposer, ComposerForm, LeaveConfirm, PostComposerDialog (bear `@modal`) - `/compose/post` · [compose-post.md](market/compose-post.md) · noindex · none · browser: PostComposer, ComposerForm, LeaveConfirm, PostComposerDialog (bear `@modal`)
- `/compose/post/[id]` · [compose-post-id.md](market/compose-post-id.md) · noindex · none · browser: PostComposer, EditComposer, LeaveConfirm, PostComposerDialog (bear `@modal`) - `/compose/post/[id]` · [compose-post-id.md](market/compose-post-id.md) · noindex · none · browser: PostComposer, EditComposer, LeaveConfirm, PostComposerDialog (bear `@modal`)
- `/compose/prediction` · [compose-prediction.md](market/compose-prediction.md) · noindex · none · browser: PredictionComposer, ComposerPage, SymbolPicker, ConfirmPublish, LeaveConfirm, PredictionComposerDialog (bear `@modal`) - `/compose/prediction` · [compose-prediction.md](market/compose-prediction.md) · noindex · none · browser: PredictionComposer, ComposerPage, SymbolPicker, ConfirmPublish, LeaveConfirm, PredictionComposerDialog (bear `@modal`)

View File

@ -2,31 +2,31 @@
`/analysts` · `apps/{bull,bear}/src/app/(main)/analysts/page.tsx` · Type: category and brand listing · Layout: [layout-main.md](layout-main.md), [layout.md](layout.md) `/analysts` · `apps/{bull,bear}/src/app/(main)/analysts/page.tsx` · Type: category and brand listing · Layout: [layout-main.md](layout-main.md), [layout.md](layout.md)
| Field | Value | | Field | Value |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Robots | `noindex` (page `metadata`) | | Robots | `noindex` (page `metadata`) |
| Status | `200`; a failed read shows `(main)/error.tsx` with 200; a 404 or 403 read shows the empty state | | Status | `200`; a failed read throws to `(main)/error.tsx` in the browser; no 404 or 403 case |
| loading.tsx | `(main)/analysts/loading.tsx`: the frame and three analyst cards | | loading.tsx | `(main)/analysts/loading.tsx`: the frame and three analyst cards |
| First flush | none: the page entry awaits `getFeaturedCreators()` through `readOnServer`, under `loading.tsx`, so the list streams | | First flush | none: the server reads nothing (0070); `useAnalystsPage` reads `featuredCreatorsQuery()` in the browser, shared with خانه's featured row, and the directory shows `AnalystListSkeleton` (not delayed) until it arrives |
| Canonical | none | | Canonical | none |
| H1 | `home:analysts.title` in `PageHeader`; bull: inside `AnalystsDirectory`, shown while the viewer is unknown or a guest, and removed for a member, whose top bar names the page | | H1 | `home:analysts.title` in `PageHeader`; bull: inside `AnalystsDirectory`, shown while the viewer is unknown or a guest, and removed for a member, whose top bar names the page |
| JSON-LD | none | | JSON-LD | none |
| Scripts | none beyond the layout's | | Scripts | none beyond the layout's |
## Sections ## Sections
In bull's document order. In bull's document order.
| Section | Data | HTML | JS | Index | Notes | | Section | Data | HTML | JS | Index | Notes |
| ----------------------------------- | ----------------------- | ----------- | ------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------------------------------- | ------------------------- | ----------- | ------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MobileTopBar (bull) | config | first flush | hydrate | no | a pushed page's bar: back and support | | MobileTopBar (bull) | config | first flush | hydrate | no | a pushed page's bar: back and support |
| ↳ Title, brand or login link (bull) | viewer | skeleton | hydrate | no | member: the title; guest: the brand and «ورود/ثبت‌نام» | | ↳ Title, brand or login link (bull) | viewer | skeleton | hydrate | no | member: the title; guest: the brand and «ورود/ثبت‌نام» |
| DeskBack, PageHeader (bear) | config | first flush | hydrate | no | «بازگشت» to خانه, or to the landing for a guest | | DeskBack, PageHeader (bear) | config | first flush | hydrate | no | «بازگشت» to خانه, or to the landing for a guest |
| AnalystsDirectory heading and note | `getFeaturedCreators()` | streamed | hydrate | no | bull's H1 and the «chosen by Lumina, not a ranking» note | | AnalystsDirectory heading and note | `featuredCreatorsQuery()` | skeleton | hydrate | no | bull's H1 and the «chosen by Lumina, not a ranking» note |
| AnalystList | `getFeaturedCreators()` | streamed | hydrate | no | every featured analyst in the admin's order, each card an `<a href>` to `/channels/username`; bull: one column; bear: three; empty: an `EmptyState` card | | AnalystList | `featuredCreatorsQuery()` | skeleton | hydrate | no | every featured analyst in the admin's order, each card an `<a href>` to `/channels/username`; bull: one column; bear: three; empty: an `EmptyState` card |
| ↳ AnalystFollowButton | viewer | none | hydrate | no | investors only, once their follows are known; unfollow asks first | | ↳ AnalystFollowButton | viewer | none | hydrate | no | investors only, once their follows are known; unfollow asks first |
| GuestSignupCard | viewer | none | hydrate | no | guests only: register and login links | | GuestSignupCard | viewer | none | hydrate | no | guests only: register and login links |
## Notes ## Notes
- The page is `noindex`, but its channel links are server HTML, so crawlers that fetch it can follow them to the indexable channel pages. - The channel links render in the browser, and the channel pages are `noindex` too (0070): this page is no crawl path.

View File

@ -2,39 +2,39 @@
`/channels/[username]/posts/[id]` · `apps/{bull,bear}/src/app/(main)/channels/[username]/posts/[id]/page.tsx` · Type: blog article · Layout: [layout-main.md](layout-main.md), [layout.md](layout.md) `/channels/[username]/posts/[id]` · `apps/{bull,bear}/src/app/(main)/channels/[username]/posts/[id]/page.tsx` · Type: blog article · Layout: [layout-main.md](layout-main.md), [layout.md](layout.md)
| Field | Value | | Field | Value |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Robots | `index; noindex when` the post is missing, belongs to another channel, or the channel is suspended (`generateMetadata`) | | Robots | `noindex` (`generateMetadata`, from the URL's params only: title `پست @username`; no read, 0070) |
| Status | `200`; `308` when the username segment isn't the stored spelling (`ROUTES.post`), and from `/@username/…` (0064); `200` with `not-found.tsx` when the username is invalid or the channel is missing, because `loading.tsx` wraps the page; `200` with `noindex` and `PostMissing` when the post is missing (debt) | | Status | `200`; another spelling of the username redirects in the stream (meta refresh) to `ROUTES.post`, because `loading.tsx` wraps the page; `/@username/…` answers a real 308 (0064); a username that can't be one renders the channel's `not-found.tsx` (`ChannelMissing`), 200; an id that can't be a post's, or a missing post, renders `PostMissing` in the channel's frame, 200 |
| loading.tsx | `apps/{bull,bear}/src/app/(main)/channels/[username]/posts/[id]/loading.tsx` (debt, Notes) | | loading.tsx | `apps/{bull,bear}/src/app/(main)/channels/[username]/posts/[id]/loading.tsx`: bull: `MobileTopBar` and `PostSkeleton delayed`; bear: `DeskBack` and `PostSkeleton delayed`. The page shows the same `PostSkeleton` (not delayed) until its reads arrive |
| First flush | `getChannel(username)` and `getPost(id)` in one `Promise.all` through `readOnServer`, which the page entry and `generateMetadata` await (0055) | | First flush | none: the server reads nothing (0070); `usePostPage` reads `channelPageQuery(username)` and `postKeys.detail(id)` in the browser |
| Canonical | `/channels/username/posts/id`, from `postMetadata`; drops `?preview=` | | Canonical | none |
| H1 | none (debt) | | H1 | none (debt) |
| JSON-LD | none (debt, Notes) | | JSON-LD | none |
| Scripts | none | | Scripts | none |
## Sections ## Sections
In bull's document order. In bull's document order.
| Section | Data | HTML | JS | Index | Notes | | Section | Data | HTML | JS | Index | Notes |
| -------------------- | ---------------------- | ----------- | ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | -------------------- | ---------------------------- | -------- | ----------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------ |
| MobileTopBar (bull) | viewer | skeleton | hydrate | no | back to the channel (`parentHref`, `backToPrevious`, 0057); the title waits for the viewer | | MobileTopBar (bull) | viewer | skeleton | hydrate | no | back to the channel (`parentHref` from the URL, `backToPrevious`, 0057); the title waits for the viewer |
| DeskBack (bear) | — | first flush | hydrate | no | «بازگشت» to the channel | | DeskBack (bear) | — | streamed | hydrate | no | «بازگشت» to the channel, drawn while the reads load |
| PostChannelBar | `getChannel(username)` | first flush | none | primary | `<a href>` to the channel: avatar, name, `@username` | | PostChannelBar | `channelPageQuery(username)` | skeleton | hydrate | no | `<a href>` to the channel: avatar, name, `@username` |
| ↳ ChannelActions | viewer | skeleton | hydrate | no | follow and subscribe; own `PartBoundary` | | ↳ ChannelActions | viewer | skeleton | hydrate | no | follow and subscribe; own `PartBoundary` |
| PostView | `getPost(id)` | first flush | hydrate | primary | a free post's caption and images; a premium post's `captionPreview` and media count only; re-read in the browser for the creator or a subscriber (0021) | | PostView | `postKeys.detail(id)` | skeleton | hydrate | no | read with the session, so a subscriber's or the creator's premium post arrives open; read again if the session was restored after it |
| ↳ Locked post gate | viewer | skeleton | hydrate | no | guest: login back here; investor: checkout | | ↳ Locked post gate | viewer | skeleton | hydrate | no | guest: login back here; investor: checkout |
| ↳ PreviewBanner | viewer | none | hydrate | no | the creator's `?preview=` of their own premium post | | ↳ PreviewBanner | viewer | none | hydrate | no | the creator's `?preview=` of their own premium post |
| ↳ PostLightbox | — | none | interaction | no | `next/dynamic`, mounted on the first image tap | | ↳ PostLightbox | — | none | interaction | no | `next/dynamic`, mounted on the first image tap |
| ↳ Access-ended toast | viewer | none | hydrate | no | the info toast when access ends mid-read (0050) | | ↳ Access-ended toast | viewer | none | hydrate | no | the info toast when access ends mid-read (0050) |
| PostMissing | `getChannel(username)` | first flush | hydrate | no | instead of `PostView` when the post is missing; a link back to the channel | | PostMissing | `postKeys.detail(id)` | none | hydrate | no | instead of `PostView` when the post is missing, another channel's, or the id can't be a post's; a link back to the channel |
| ChannelUnavailable | `getChannel(username)` | first flush | hydrate | no | replaces the bar and post when the channel is suspended | | ChannelMissing | `channelPageQuery(username)` | none | hydrate | no | the channel is unknown |
| ChannelUnavailable | `channelPageQuery(username)` | none | hydrate | no | replaces the bar and post when the channel is suspended |
## Notes ## Notes
- bull: under `MobileTopBar`, a padded column; bear: the 640px column under «بازگشت». Both hold the same primary rows. - bull: under `MobileTopBar`, a padded column; bear: the 640px column under «بازگشت».
- Debt: `loading.tsx` wraps an indexable entity page: a missing channel answers 200, and past 12,800 bytes the post follows the skeleton. Delete it. - A 404 on the post read is the `missing` state, not a boundary; any other failed first read throws to `(main)/error.tsx`. A deleted post's page renders again with `router.refresh()` and reads the post afresh.
- Debt: a missing post answers 200 with `PostMissing` (`PostTemplate.tsx:67`), a soft 404. Call `notFound()` in the page entry and move `PostMissing` into a route `not-found.tsx`. - 0070's accepted cost: search engines get no post content, and a shared link shows the site card with the `پست @username` title.
- Debt: no H1. Make the post's first line, the text `postMetadata` titles it with, the H1 in both apps. - Debt: no H1 in either app. Make the post's first line the H1.
- Debt: no JSON-LD; an article-type page gets `BreadcrumbList`. The repo has no json-ld lib yet.

View File

@ -2,44 +2,43 @@
`/channels/[username]` · `apps/{bull,bear}/src/app/(main)/channels/[username]/page.tsx` · Type: seller · Layout: [layout-main.md](layout-main.md), [layout.md](layout.md) `/channels/[username]` · `apps/{bull,bear}/src/app/(main)/channels/[username]/page.tsx` · Type: seller · Layout: [layout-main.md](layout-main.md), [layout.md](layout.md)
| Field | Value | | Field | Value |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Robots | `index; noindex when` the username is invalid, the channel is missing, or it is suspended (`generateMetadata`; `not-found.tsx` `metadata`) | | Robots | `noindex` (`generateMetadata`, from the URL's params only: title `@username`, description `channel:meta.description`; no read, 0070) |
| Status | `200`; `308` when the segment isn't the stored spelling (`toChannelUsername`), keeping the query for `?code=` (0059), and from `/@username/…` (`next.config.ts` redirect, 0064); `200` with `not-found.tsx` and `noindex` when invalid or missing, because `loading.tsx` wraps the page (debt); `200` with `noindex` and `ChannelUnavailable` when suspended | | Status | `200`; another spelling of the username redirects in the stream (meta refresh) to the stored one, keeping `?code=` (0059), because `loading.tsx` wraps the page; `/@username/…` answers a real 308 from `next.config.ts` (0064); a username that can't be one renders `not-found.tsx` (`ChannelMissing`), 200; an unknown channel renders `ChannelMissing` in the browser, 200 |
| loading.tsx | `apps/{bull,bear}/src/app/(main)/channels/[username]/loading.tsx` (debt, Notes) | | loading.tsx | `apps/{bull,bear}/src/app/(main)/channels/[username]/loading.tsx`: bull: `MobileTopBar` and `ChannelSkeleton delayed`; bear: `DeskBack` and `ChannelSkeleton delayed`. The page shows the same `ChannelSkeleton` (not delayed) until its read arrives |
| First flush | `getChannel(username)` through `readOnServer`, which the page entry and `generateMetadata` await (0055) | | First flush | none: the server reads nothing (0070); `channelPageQuery(username)` runs in the browser |
| Canonical | `/channels/username`, from `channelMetadata`; drops `?code=` and every other parameter | | Canonical | none |
| H1 | the display name, in `ChannelHeader` | | H1 | the display name, in `ChannelHeader`, rendered in the browser |
| JSON-LD | none (debt, Notes) | | JSON-LD | none |
| Scripts | none | | Scripts | none |
## Sections ## Sections
In bull's document order. In bull's document order.
| Section | Data | HTML | JS | Index | Notes | | Section | Data | HTML | JS | Index | Notes |
| -------------------------- | ------------------------------- | ----------- | ----------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | -------------------------- | --------------------------------- | -------- | ----------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| MobileTopBar (bull) | viewer | skeleton | hydrate | no | `tabOwnerId`: back and title wait for the viewer; the creator on their own channel gets the tab bar | | MobileTopBar (bull) | viewer | skeleton | hydrate | no | `tabOwnerId` once the channel is known: the creator on their own channel gets the tab bar |
| ChannelDeskBack (bear) | viewer | first flush | hydrate | no | «بازگشت»; removed for the owner | | ChannelDeskBack (bear) | viewer | streamed | hydrate | no | «بازگشت», drawn while the channel loads; removed for the owner |
| ApprovedWelcome | viewer | none | hydrate | no | once, on the creator's first visit after approval; bull: sheet; bear: modal | | ApprovedWelcome | viewer | none | hydrate | no | once, on the creator's first visit after approval; bull: sheet; bear: modal |
| ChannelHeader, with the H1 | `getChannel(username)` | first flush | none | primary | avatar, name, `@username`, bio, markets, social links; bear: in a card | | ChannelHeader, with the H1 | `channelPageQuery(username)` | skeleton | hydrate | no | avatar, name, `@username`, bio, markets, social links; bear: in a card |
| ↳ ChannelShare | — | first flush | hydrate | no | the owner's share sheet opens on click | | ↳ ChannelShare | — | skeleton | hydrate | no | the owner's share sheet opens on click |
| ↳ ChannelCounts | `getChannel(username)`, query | first flush | hydrate | no | follower count from the server read as `initialData`, kept live (0045); the owner's «مشترک فعال» is browser-only | | ↳ ChannelCounts | `channelPageQuery`, query | skeleton | hydrate | no | the follower count read with the channel, kept live in `channelKeys.followerCount`; the owner's «مشترک فعال» |
| ↳ ChannelActions | viewer | skeleton | hydrate | no | guest prompt, follow, subscribe, sale and invite notes; own `PartBoundary` | | ↳ ChannelActions | viewer | skeleton | hydrate | no | guest prompt, follow, subscribe, sale and invite notes; own `PartBoundary` |
| FollowNotice | viewer | none | hydrate | no | after the first follow | | FollowNotice | viewer | none | hydrate | no | after the first follow |
| ChannelStats | `getPredictionStats(creatorId)` | streamed | none | secondary | own `<Suspense>` and `PartBoundary`; `CreatorStats`, empty when the record isn't public | | ChannelStats | `predictionKeys.stats(creatorId)` | skeleton | hydrate | no | `useCreatorStatsPart`, a suspense query in its own `<Suspense>` and `PartBoundary`; empty when the record isn't public |
| ChannelFeed | `getCreatorPosts(creatorId)` | streamed | hydrate | primary | own `<Suspense>` and `PartBoundary`; an `<a href>` per post, the only links to post pages; re-read in the browser for the creator or a subscriber (0021) | | ChannelFeed | `postKeys.channelFeed(creatorId)` | skeleton | hydrate | no | `useChannelFeedPart`, a suspense infinite query sent with the session, in its own `<Suspense>` and `PartBoundary`; an `<a href>` per post |
| ↳ Locked post gate | viewer | skeleton | hydrate | no | guest: login back here; investor: checkout | | ↳ Locked post gate | viewer | skeleton | hydrate | no | guest: login back here; investor: checkout |
| ↳ Load more | query | none | hydrate | no | a `<button>` that reads the next page | | ↳ Load more | query | none | hydrate | no | a `<button>` that reads the next page |
| ↳ PostLightbox | — | none | interaction | no | `next/dynamic`, mounted on the first image tap | | ↳ PostLightbox | — | none | interaction | no | `next/dynamic`, mounted on the first image tap |
| ChannelMissing | `channelPageQuery(username)` | none | hydrate | no | an unknown channel; its creator before approval sees their own tab (C6 ۱.۲) |
| ChannelUnavailable | `channelPageQuery(username)` | none | hydrate | no | replaces everything when the channel is suspended |
## Notes ## Notes
- bull: under `MobileTopBar`, a padded column; bear: one 640px column under «بازگشت», header in a card. Both hold the same primary and secondary rows. - 0070 supersedes 0021 and 0045: the feed, the stats and the follower count are browser reads, with no server `initialData`. Mutations update them in the query cache (`replaceCachedPost`, `removeCachedPost`, `applyClosedPrediction`).
- A channel under review (`verificationPending`) is public and indexable, but `PendingChannelGate` renders the header skeleton for every visitor until the viewer is known, so its server HTML holds no primary content. - bull: under `MobileTopBar`, a padded column; bear: one 640px column under «بازگشت», the header in a card.
- A channel under review (`verificationPending`) renders behind `PendingChannelGate`, which decides for its owner in the browser.
- bear's `@modal/channels/[username]/page.tsx` returns `null`: it empties the `@modal` slot after publishing lands here (0023). - bear's `@modal/channels/[username]/page.tsx` returns `null`: it empties the `@modal` slot after publishing lands here (0023).
- Debt: `loading.tsx` wraps an indexable entity page: a missing channel answers 200, and past 12,800 bytes the content follows the skeleton. Delete it; the channel's links are `NavLink`s. - 0070's accepted cost: search engines get no channel content, and a shared link shows the site card with the `@username` title and description. The back end needs its own cache for these public reads before a traffic spike.
- Debt: `ChannelFeed` is primary but sits in `<Suspense>` (`ChannelTemplate.tsx`: bull line 110, bear line 113). Await `getCreatorPosts` in the page entry beside `getChannel`.
- Debt: older posts are reachable only through «Load more» (`ChannelFeedList.tsx:109`). Add `?page=` pagination with `<a href>` links.
- Debt: `PendingChannelGate` (`ChannelTemplate.tsx`: bull line 134, bear line 133) keeps a public channel's primary content out of the server HTML. Render the public channel on the server and swap only for the owner, or set `noindex` while pending.
- Debt: no JSON-LD; a seller-type page gets `BreadcrumbList`. The repo has no json-ld lib yet.

View File

@ -2,34 +2,35 @@
`/checkout/[username]` · `apps/{bull,bear}/src/app/(flow)/checkout/[username]/page.tsx` · Type: cart and checkout · Layout: [layout.md](layout.md) `/checkout/[username]` · `apps/{bull,bear}/src/app/(flow)/checkout/[username]/page.tsx` · Type: cart and checkout · Layout: [layout.md](layout.md)
| Field | Value | | Field | Value |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Robots | `noindex` (page `metadata`) | | Robots | `noindex` (page `metadata`) |
| Status | `200`, because `loading.tsx` streams the page: an invalid or unknown username renders the not-found UI in the stream; another spelling of the username redirects in the stream to the stored one, with `?code=` kept (0059), not a 308; a suspended channel redirects in the stream to the channel | | Status | `200`, because `loading.tsx` wraps the page: an invalid username renders the not-found UI in the stream; another spelling of the username redirects in the stream to the stored one, with `?code=` kept (0059), not a 308; an unknown channel shows `StatusEmptyState` (not-found) in the page; a suspended channel sends the visitor to the channel with `router.replace` in the browser (`useCheckoutChannel`) |
| loading.tsx | `checkout/[username]/loading.tsx`: bull: the bar; bear: the header and title; then `CheckoutSkeleton` with `CheckoutCreatorSkeleton`, `delayed` | | loading.tsx | `checkout/[username]/loading.tsx`: bull: the bar; bear: the header and title; then `CheckoutSkeleton` with `CheckoutCreatorSkeleton`, `delayed` |
| First flush | none: the page entry awaits `getChannel(username)` through `readOnServer` under `loading.tsx`, so the page streams behind the skeleton | | First flush | none: the server reads nothing (0070); `useCheckoutChannel` reads `channelPageQuery(username)` in the browser, and the page shows `CheckoutSkeleton` (not delayed) until it arrives |
| Canonical | none: `noindex` | | Canonical | none: `noindex` |
| H1 | bull: none (the bar's name isn't a heading); bear: `DesktopPageTitle`, `payment:checkout.title` | | H1 | bull: none (the bar's name isn't a heading); bear: `DesktopPageTitle`, `payment:checkout.title` |
| JSON-LD | none | | JSON-LD | none |
| Scripts | none beyond the layout's | | Scripts | none beyond the layout's |
## Sections ## Sections
In bull's document order. In bull's document order.
| Section | Data | HTML | JS | Index | Notes | | Section | Data | HTML | JS | Index | Notes |
| ------------------------------------------------------- | ---------------------- | -------- | ------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ------------------------------------------------------- | ---------------------------- | -------- | ------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MobileTopBar (bull) | config | streamed | hydrate | no | back to the channel; no bottom nav | | MobileTopBar (bull) | config | streamed | hydrate | no | back to the channel (`parentHref` from the URL); no bottom nav |
| DesktopHeader (bear) | viewer | streamed | hydrate | no | rows as in [layout-main.md](layout-main.md) | | DesktopHeader (bear) | viewer | streamed | hydrate | no | rows as in [layout-main.md](layout-main.md) |
| DesktopPageTitle (bear) | config | streamed | hydrate | no | back to the channel, beside the title | | DesktopPageTitle (bear) | config | streamed | hydrate | no | back to the channel, beside the title |
| CheckoutCreator | `getChannel(username)` | streamed | none | no | avatar, name and @username; a Server Component passed into the client panel, so the skeleton shows it too | | CheckoutCreator | `channelPageQuery(username)` | skeleton | hydrate | no | avatar, name and @username; `CheckoutCreatorSkeleton` inside the page's skeleton until the read arrives |
| CheckoutPanel | viewer | skeleton | hydrate | no | `AuthGuard role="investor"`: a guest goes to login and back, a creator gets no-access; `useInviteLink` keeps `?code=` for this creator on arrival (0059, 0030); its own `PartBoundary` | | CheckoutPanel | viewer | skeleton | hydrate | no | `AuthGuard role="investor"`: a guest goes to login and back, a creator gets no-access; `useInviteLink` keeps `?code=` for this creator on arrival (0059, 0030); its own `PartBoundary` |
| ↳ CheckoutForm: tiers, invite note and code, pay footer | query | skeleton | hydrate | no | `useCheckoutPage`'s browser read; the skeleton stays while a payment left at the bank settles (0033); a reactivation shows the start-today note instead of the code (U11) | | ↳ CheckoutForm: tiers, invite note and code, pay footer | query | skeleton | hydrate | no | `useCheckoutPage`'s browser read; the skeleton stays while a payment left at the bank settles (0033); a reactivation shows the start-today note instead of the code (U11) |
| ↳ CheckoutHalts | query | none | hydrate | no | dialogs when the investor can't pay here | | ↳ CheckoutHalts | query | none | hydrate | no | dialogs when the investor can't pay here |
| ↳ NoCodeSheet | `getChannel(username)` | none | hydrate | no | «کد ندارم»: where to get a code, from the creator's links; mounts when opened | | ↳ NoCodeSheet | `channelPageQuery(username)` | none | hydrate | no | «کد ندارم»: where to get a code, from the creator's links; mounts when opened |
## Notes ## Notes
- bull pins the pay block to the bottom of the screen; bear sticks it to the bottom of the window in a 480 column. Same sections otherwise. - bull pins the pay block to the bottom of the screen; bear sticks it to the bottom of the window in a 480 column. Same sections otherwise.
- The redirect and not-found cases run after the skeleton is sent, so they never set the status line. That is fine for a `noindex` page reached only from the channel's «اشتراک». - The redirect and not-found cases run after the skeleton is sent, so they never set the status line. That is fine for a `noindex` page reached only from the channel's «اشتراک».
- 0070: the page shares `channelPageQuery` with the channel, so a visitor coming from the channel finds it cached.
- Debt: different H1 per app. bull has no `h1`; add a screen-reader `h1` to `CheckoutTemplate` in bull (`apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx:19`). - Debt: different H1 per app. bull has no `h1`; add a screen-reader `h1` to `CheckoutTemplate` in bull (`apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx:19`).

View File

@ -6,7 +6,7 @@
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Robots | `index` | | Robots | `index` |
| Status | `200`; prerendered with `force-static` and `revalidate = 600` (0026), so a failed revalidation keeps serving the last good page | | Status | `200`; prerendered with `force-static` and `revalidate = 600` (0026), so a failed revalidation keeps serving the last good page |
| loading.tsx | `apps/{bull,bear}/src/app/(landing)/loading.tsx` (debt, Notes) | | loading.tsx | `none`: the whole landing is in the first flush (0070) |
| First flush | `loadLandingPage()` → `getFeaturedCreators()`, awaited by the page entry at build and at each revalidation; the metadata is fixed, in the `metadata` export (`landingMetadata`) | | First flush | `loadLandingPage()` → `getFeaturedCreators()`, awaited by the page entry at build and at each revalidation; the metadata is fixed, in the `metadata` export (`landingMetadata`) |
| Canonical | `/`, from `landingMetadata` | | Canonical | `/`, from `landingMetadata` |
| H1 | `landing:hero.title` from i18n, in `LandingHero` | | H1 | `landing:hero.title` from i18n, in `LandingHero` |
@ -37,7 +37,7 @@ In bull's document order. The header and footer belong to `LandingTemplate`, not
## Notes ## Notes
- 0070: the landing is the only page whose content the server renders; every other page reads its data in the browser.
- bull: `layout="mobile"`; bear: `layout="desktop"`, which adds the header's section links and opens support as a popover. Both apps hold the same primary and secondary sections. - bull: `layout="mobile"`; bear: `layout="desktop"`, which adds the header's section links and opens support as a popover. Both apps hold the same primary and secondary sections.
- `force-static` contradicts the skill's "never static rendering"; accepted decision 0026 overrides it. The page reads no session, so the prerender is the same for every visitor. - `force-static` contradicts the skill's "never static rendering"; accepted decision 0026 overrides it. The page reads no session, so the prerender is the same for every visitor.
- Debt: `apps/{bull,bear}/src/app/(landing)/loading.tsx` wraps an indexable page. Once the prerendered HTML passes 12,800 bytes, the whole landing follows the skeleton in a hidden `<div>`. Delete it; links to `/` are `NavLink`s.
- Debt: `FAQPage` markup (`platforms/market/src/app/seo/landing.ts:31`), which Google no longer shows; the home page gets `Organization` and `WebSite` from config instead. The graph is a raw `Element` script after the template (`apps/{bull,bear}/src/app/(landing)/page.tsx:58`), not one `<JsonLd>` before it: the repo has no json-ld lib or island `JsonLd` yet. - Debt: `FAQPage` markup (`platforms/market/src/app/seo/landing.ts:31`), which Google no longer shows; the home page gets `Organization` and `WebSite` from config instead. The graph is a raw `Element` script after the template (`apps/{bull,bear}/src/app/(landing)/page.tsx:58`), not one `<JsonLd>` before it: the repo has no json-ld lib or island `JsonLd` yet.

View File

@ -24,5 +24,5 @@ Scripts: none.
- bull and bear build separately, so a client component that one app renders never ships to the other. - bull and bear build separately, so a client component that one app renders never ships to the other.
- `apps/bear/src/app/(main)/default.tsx` is the `children` default: when a soft navigation lands on a `@modal` intercept with no main page under it, it reloads the URL so the full `/compose/*` page renders. - `apps/bear/src/app/(main)/default.tsx` is the `children` default: when a soft navigation lands on a `@modal` intercept with no main page under it, it reloads the URL so the full `/compose/*` page renders.
- A failed page shows `(main)/error.tsx`: `PageError` with the page's own bar (0049); bull keeps the BottomNav under it. - A failed page shows `(main)/error.tsx`: `PageError` with the page's own bar (0049); bull keeps the BottomNav under it.
- Debt: the server HTML links the brand to `/feed`, a `noindex` page behind `AuthGuard`, on every main page, including the indexable channel and post pages (`platforms/market/src/app/navigation/hooks/use-home-href.ts:18`). Link `/` while the viewer is unknown; `LandingRedirect` sends a member on (0027). - Debt: the server HTML links the brand to `/feed`, a `noindex` page behind `AuthGuard`, on every main page (`platforms/market/src/app/navigation/hooks/use-home-href.ts:18`). Low priority since 0070 made every `(main)` page `noindex`. Link `/` while the viewer is unknown; `LandingRedirect` sends a member on (0027).
- Debt: the header search is not a `GET` form to `/search`, so it does nothing before hydration (`platforms/market/src/app/navigation/components/desktop-header/DesktopHeader.tsx:46`). It is member-only, so the cost is low. - Debt: the header search is not a `GET` form to `/search`, so it does nothing before hydration (`platforms/market/src/app/navigation/components/desktop-header/DesktopHeader.tsx:46`). It is member-only, so the cost is low.

View File

@ -2,12 +2,12 @@
`apps/{bull,bear}/src/app/(flow)/terms/layout.tsx` · wraps `/terms` and `/terms/subscription` · it awaits no read: its text is server i18n (`rules`), so it adds nothing to the first byte `apps/{bull,bear}/src/app/(flow)/terms/layout.tsx` · wraps `/terms` and `/terms/subscription` · it awaits no read: its text is server i18n (`rules`), so it adds nothing to the first byte
| Section | Data | HTML | JS | Index | Notes | | Section | Data | HTML | JS | Index | Notes |
| ------------------------------------ | ------ | ----------- | ------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | ------------------------------------ | ------ | ----------- | ------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| MobileTopBar (bull) | viewer | skeleton | hydrate | no | back to where the rules were opened, and support, in the first flush; the title «قوانین لومینا» waits for the viewer | | MobileTopBar (bull) | viewer | skeleton | hydrate | no | back to where the rules were opened, and support, in the first flush; the title «قوانین لومینا» waits for the viewer |
| DesktopHeader (bear) | viewer | skeleton | hydrate | no | brand `<a href>` and support in the first flush; nav, bell, account menu and login wait for the viewer ([layout-main.md](layout-main.md)) | | DesktopHeader (bear) | viewer | skeleton | hydrate | no | brand `<a href>` and support in the first flush; nav, bell, account menu and login wait for the viewer ([layout-main.md](layout-main.md)) |
| DesktopPageTitle, with the H1 (bear) | config | first flush | hydrate | no | «بازگشت» and the H1 `rules:title`; bull puts its H1 in each page instead | | DesktopPageTitle, with the H1 (bear) | config | first flush | hydrate | no | «بازگشت» and the H1 `rules:title`; bull puts its H1 in each page instead |
| RulesTabs | config | first flush | hydrate | primary | `TabLinks`: `<a href>` to `/terms` and `/terms/subscription`; `usePathname` marks the current tab | | RulesTabs | config | first flush | hydrate | no | `TabLinks`: `<a href>` to `/terms` and `/terms/subscription`; `usePathname` marks the current tab |
Scripts: none. Scripts: none.

View File

@ -4,15 +4,15 @@
Every case below is `noindex`. No page answers 410, and the repo sets up no reverse proxy, so 503 under overload comes from whatever sits in front of the app's port. Every case below is `noindex`. No page answers 410, and the repo sets up no reverse proxy, so 503 under overload comes from whatever sits in front of the app's port.
| Case | Status | The server HTML holds | | Case | Status | The server HTML holds |
| ----------------------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ----------------------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| A URL no route matches | 404 | the root `not-found.tsx`: `noindex` from its `metadata`, `StatusEmptyState` (not-found, page size) in the first flush; bull: the `MobileTopBar` behind a same-size frame; bear: the `DesktopHeader` behind one (both read the address in the browser) | | A URL no route matches | 404 | the root `not-found.tsx`: `noindex` from its `metadata`, `StatusEmptyState` (not-found, page size) in the first flush; bull: the `MobileTopBar` behind a same-size frame; bear: the `DesktopHeader` behind one (both read the address in the browser) |
| `/@username/…` | 308 to `/channels/username/…` | nothing; `redirects()` in `next.config.ts` answers before any render (0064) | | `/@username/…` | 308 to `/channels/username/…` | nothing; `redirects()` in `next.config.ts` answers before any render (0064) |
| A channel or post that doesn't exist | 200 | `noindex` and the route's `loading.tsx` skeleton: both routes keep a `loading.tsx`, so `notFound()` runs after the status is sent; the channel's `not-found.tsx` renders in the browser. See [channels-username.md](channels-username.md) and [channels-username-posts-id.md](channels-username-posts-id.md) | | A channel or post that doesn't exist | 200 | `noindex` and the page's skeleton: the server reads nothing (0070), so the browser's read finds the channel or post missing and renders `ChannelMissing` or `PostMissing` in the page's frame. See [channels-username.md](channels-username.md) and [channels-username-posts-id.md](channels-username-posts-id.md) |
| `notFound()` on any other page, all under a `loading.tsx` | 200 | the skeleton and `noindex`; the not-found UI renders in the browser | | `notFound()` on any other page, all under a `loading.tsx` | 200 | the skeleton and `noindex`; the not-found UI renders in the browser |
| A failed read on a page under its `loading.tsx` | 200 | the skeleton and the page's `noindex`; the group's `error.tsx` renders `PageError` in the browser, with its own `noindex` | | A failed browser read of a page's data | 200 | the skeleton and the page's `noindex`; the read throws to the group's `error.tsx`, which renders `PageError` with its own `noindex` |
| A failed read on a page with no `loading.tsx` above it | 500 | `noindex` and an empty `<body>`; the group's `error.tsx` renders in the browser. No page is in this case today: every route keeps a `loading.tsx`. The channel and post pages join it once theirs goes (Notes) | | A failed read on a page with no `loading.tsx` above it | 500 | `noindex` and an empty `<body>`; the group's `error.tsx` renders in the browser. Only the landing reads data on the server, and it is prerendered (0026): a failed revalidation keeps the last good page |
| An error the group boundaries don't catch (root layout, AppShell) | 500 | `global-error.tsx`: its own document with `AppCrash` and `<meta name="robots" content="noindex">`, rendered in the browser | | An error the group boundaries don't catch (root layout, AppShell) | 500 | `global-error.tsx`: its own document with `AppCrash` and `<meta name="robots" content="noindex">`, rendered in the browser |
## Boundaries ## Boundaries
@ -26,4 +26,4 @@ Every case below is `noindex`. No page answers 410, and the repo sets up no reve
## Notes ## Notes
- `PageError` and `global-error.tsx` render `<meta name="robots" content="noindex">`; the root `not-found.tsx` sets it in `metadata`. - `PageError` and `global-error.tsx` render `<meta name="robots" content="noindex">`; the root `not-found.tsx` sets it in `metadata`.
- Debt: the channel and post pages are indexable but keep a `loading.tsx`, so a missing channel or post answers 200 instead of a real 404. See those docs. - A missing channel or post answers 200 by design: both pages are `noindex` and read in the browser (0070).

View File

@ -4,11 +4,11 @@
| Field | Value | | Field | Value |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Robots | `index` | | Robots | `noindex` (`terms` layout `metadata`, 0071) |
| Status | `200` | | Status | `200` |
| loading.tsx | `apps/{bull,bear}/src/app/(flow)/terms/subscription/loading.tsx` (debt, Notes) | | loading.tsx | `apps/{bull,bear}/src/app/(flow)/terms/subscription/loading.tsx` (debt, Notes) |
| First flush | none: config, server i18n (`terms`, `auth`) and `getEnv().supportHours` | | First flush | none: config, server i18n (`terms`, `auth`) and `getEnv().supportHours` |
| Canonical | none set (debt, Notes) | | Canonical | none: `noindex` |
| H1 | bull: `terms:title` «شرایط اشتراک», screen-reader-only, in `SubscriptionTerms`; bear: `rules:title` «قوانین لومینا» from the layout (debt) | | H1 | bull: `terms:title` «شرایط اشتراک», screen-reader-only, in `SubscriptionTerms`; bear: `rules:title` «قوانین لومینا» from the layout (debt) |
| JSON-LD | none | | JSON-LD | none |
| Scripts | none | | Scripts | none |
@ -17,14 +17,12 @@
In bull's document order. In bull's document order.
| Section | Data | HTML | JS | Index | Notes | | Section | Data | HTML | JS | Index | Notes |
| ------------------------- | ------ | ----------- | ---- | --------- | ---------------------------------------------------------------------------------------------- | | ------------------------- | ------ | ----------- | ---- | ----- | ---------------------------------------------------------------------------------------------- |
| SubscriptionTerms | config | first flush | none | primary | one `<section>` per term with its heading; bear: in a `Card` | | SubscriptionTerms | config | first flush | none | no | one `<section>` per term with its heading; bear: in a `Card` |
| ↳ Support hours and chats | config | first flush | none | secondary | island `SupportSheet` rows: `<a href>` to the Bale and Telegram chats, inside the last section | | ↳ Support hours and chats | config | first flush | none | no | island `SupportSheet` rows: `<a href>` to the Bale and Telegram chats, inside the last section |
## Notes ## Notes
- The landing footer links here; checkout, a suspended card and the support sheet open it too. - The landing footer links here; checkout, a suspended card and the support sheet open it too.
- Debt: `loading.tsx` wraps an indexable page. Delete it.
- Debt: no canonical. Add `alternates: { canonical: ROUTES.rules.subscription }` to the page's `metadata`.
- Debt: the H1 differs between the apps ([layout-terms.md](layout-terms.md)). - Debt: the H1 differs between the apps ([layout-terms.md](layout-terms.md)).

View File

@ -4,11 +4,11 @@
| Field | Value | | Field | Value |
| ----------- | ------------------------------------------------------------------------------------------------------ | | ----------- | ------------------------------------------------------------------------------------------------------ |
| Robots | `index` | | Robots | `noindex` (`terms` layout `metadata`, 0071) |
| Status | `200` | | Status | `200` |
| loading.tsx | `apps/{bull,bear}/src/app/(flow)/terms/loading.tsx` (debt, Notes) | | loading.tsx | `apps/{bull,bear}/src/app/(flow)/terms/loading.tsx` (debt, Notes) |
| First flush | none: config and server i18n (`rules`) | | First flush | none: config and server i18n (`rules`) |
| Canonical | none set (debt, Notes) | | Canonical | none: `noindex` |
| H1 | `rules:title`; bull: a screen-reader-only H1 in `GeneralRules`; bear: `DesktopPageTitle` in the layout | | H1 | `rules:title`; bull: a screen-reader-only H1 in `GeneralRules`; bear: `DesktopPageTitle` in the layout |
| JSON-LD | none | | JSON-LD | none |
| Scripts | none | | Scripts | none |
@ -17,11 +17,8 @@
In bull's document order. In bull's document order.
| Section | Data | HTML | JS | Index | Notes | | Section | Data | HTML | JS | Index | Notes |
| ------------ | ------ | ----------- | ---- | ------- | ---------------------------------------------------------------------------------------- | | ------------ | ------ | ----------- | ---- | ----- | ---------------------------------------------------------------------------------------- |
| GeneralRules | config | first flush | none | primary | one `<section>` per rule with its heading, then the last-updated line; bear: in a `Card` | | GeneralRules | config | first flush | none | no | one `<section>` per rule with its heading, then the last-updated line; bear: in a `Card` |
## Notes ## Notes
- Debt: `loading.tsx` wraps an indexable page. Delete it; the tab links are `<a href>` and need no pending skeleton for crawlers.
- Debt: no canonical. Add `alternates: { canonical: ROUTES.rules.general }` to the page's `metadata`.

View File

@ -8,26 +8,41 @@ import { EmptyState } from '@lumina/island/molecules/empty-state';
import { PageHeader } from '@lumina/island/molecules/page-header'; import { PageHeader } from '@lumina/island/molecules/page-header';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useAnalystsPage } from '../../../../../../features/discovery';
import { useViewerStatus } from '../../../../../../stores/auth'; import { useViewerStatus } from '../../../../../../stores/auth';
import { AnalystList } from '../../../organisms/analyst-list'; import {
AnalystList,
AnalystListSkeleton,
} from '../../../organisms/analyst-list';
import { GuestSignupCard } from './components/GuestSignupCard'; import { GuestSignupCard } from './components/GuestSignupCard';
import type { AnalystsDirectoryProps } from './types'; import type { AnalystsDirectoryProps } from './types';
/** /**
* «تحلیلگران منتخب» (J04-3): every featured analyst, in the admin's order, no paging, under the * «تحلیلگران منتخب» (J04-3): every featured analyst, in the admin's order, no paging, under the
* note that Lumina's team chooses them and it is no ranking. The list renders on the server, the * note that Lumina's team chooses them and it is no ranking. The list is read in the browser
* same for everyone; in the browser an investor gets follow on each card, and a guest the free * only (0070), the same for everyone, behind the route's skeleton; an investor gets follow on each
* registration card at the end (3b). On mobile a guest has no title in the bar, so the page keeps * card, and a guest the free registration card at the end (3b). On mobile a guest has no title in
* its own heading, also while the viewer is unknown (most visitors are guests). * the bar, so the page keeps its own heading, also while the viewer is unknown (most visitors are
* guests).
*/ */
export function AnalystsDirectory({ export function AnalystsDirectory({ layout }: AnalystsDirectoryProps) {
analysts,
layout,
}: AnalystsDirectoryProps) {
const { t } = useTranslation('home'); const { t } = useTranslation('home');
const status = useViewerStatus(); const status = useViewerStatus();
const page = useAnalystsPage();
const isDesktop = layout === 'desktop'; const isDesktop = layout === 'desktop';
if (page.status === 'pending') {
return (
<AnalystListSkeleton
layout={layout}
columns={3}
count={3}
label={t('analysts.loading')}
/>
);
}
const { analysts } = page;
return ( return (
<FlexBox direction="flex-col" gap={isDesktop ? 'gap-4' : 'gap-3'}> <FlexBox direction="flex-col" gap={isDesktop ? 'gap-4' : 'gap-3'}>
{!isDesktop && status !== 'member' && ( {!isDesktop && status !== 'member' && (

View File

@ -1,10 +1,6 @@
import type { CreatorSummaryPayload } from '../../../../../../features/discovery';
export type AnalystsDirectoryLayout = 'mobile' | 'desktop'; export type AnalystsDirectoryLayout = 'mobile' | 'desktop';
export type AnalystsDirectoryProps = { export type AnalystsDirectoryProps = {
/** Every featured analyst, in the admin's order, from the server's read. */
analysts: CreatorSummaryPayload[];
layout: AnalystsDirectoryLayout; layout: AnalystsDirectoryLayout;
}; };

View File

@ -15,6 +15,6 @@ export function ChannelDeskBack({
}: ChannelDeskBackProps) { }: ChannelDeskBackProps) {
const account = useCurrentAccount(); const account = useCurrentAccount();
if (account?.id === creatorId) return null; if (creatorId && account?.id === creatorId) return null;
return <DeskBack parentHref={parentHref} />; return <DeskBack parentHref={parentHref} />;
} }

View File

@ -1,6 +1,6 @@
export type ChannelDeskBackProps = { export type ChannelDeskBackProps = {
/** The channel's creator, who gets no back on their own tab. */ /** The channel's creator, who gets no back on their own tab; unknown while the channel loads. */
creatorId: string; creatorId?: string;
/** Where back goes when nothing of this site is behind the page: a post's channel; else home. */ /** Where back goes when nothing of this site is behind the page: a post's channel; else home. */
parentHref?: string; parentHref?: string;
}; };

View File

@ -1,21 +1,17 @@
import { getCreatorPosts } from '../../../../../../../features/post/caches/server';
import { ChannelFeedList } from './components/ChannelFeedList'; import { ChannelFeedList } from './components/ChannelFeedList';
import type { ChannelFeedProps } from './types'; import type { ChannelFeedProps } from './types';
/** /**
* The channel's feed part: the first page read on the server, so search engines and the first * The channel's feed part, read in the browser only (0070): it suspends until the first page
* paint have the posts, handed to the list that keeps it live in the browser. * arrives, so its `<Suspense>` shows the posts' skeleton.
*/ */
export async function ChannelFeed({ channel, now, layout }: ChannelFeedProps) { export function ChannelFeed({ channel, layout }: ChannelFeedProps) {
const firstPage = await getCreatorPosts(channel.creatorId);
return ( return (
<ChannelFeedList <ChannelFeedList
creatorId={channel.creatorId} creatorId={channel.creatorId}
username={channel.username} username={channel.username}
displayName={channel.displayName} displayName={channel.displayName}
avatarUrl={channel.avatarUrl} avatarUrl={channel.avatarUrl}
firstPage={firstPage}
now={now}
layout={layout} layout={layout}
/> />
); );

View File

@ -29,7 +29,7 @@ const PostLightbox = dynamic(() =>
/** /**
* The channel's posts, newest first, locked premium posts in their place among the free ones. The * The channel's posts, newest first, locked premium posts in their place among the free ones. The
* server renders the first page as every visitor sees it; the gates wait for the viewer, and a * browser reads them with the visitor's session (0070); the gates wait for the viewer, and a
* subscriber's or the creator's locked posts open in place. Older pages load on request; one that * subscriber's or the creator's locked posts open in place. Older pages load on request; one that
* fails shows an inline retry at the end while the posts stay. The creator's newest premium post * fails shows an inline retry at the end while the posts stay. The creator's newest premium post
* says when no one subscribes yet (C5 ۱.۴), in the browser only. * says when no one subscribes yet (C5 ۱.۴), in the browser only.
@ -43,8 +43,6 @@ export function ChannelFeedList({
username, username,
displayName, displayName,
avatarUrl, avatarUrl,
firstPage,
now,
layout, layout,
}: ChannelFeedListProps) { }: ChannelFeedListProps) {
const { t } = useTranslation(['channel', 'errors']); const { t } = useTranslation(['channel', 'errors']);
@ -52,12 +50,15 @@ export function ChannelFeedList({
const entitled = useChannelEntitled(creatorId); const entitled = useChannelEntitled(creatorId);
const gate = useChannelGate(creatorId); const gate = useChannelGate(creatorId);
const standing = useChannelStanding(creatorId); const standing = useChannelStanding(creatorId);
const { posts, isEmpty, hasMore, loadMore, isLoadingMore, loadMoreError } = const {
useChannelFeedPart({ posts,
creatorId, isEmpty,
firstPage, hasMore,
entitled, loadMore,
}); isLoadingMore,
loadMoreError,
now,
} = useChannelFeedPart({ creatorId, entitled });
// The last image tapped stays after the viewer closes, so it closes in place: it fades out and // The last image tapped stays after the viewer closes, so it closes in place: it fades out and
// focus goes back to the image. // focus goes back to the image.
const [viewed, setViewed] = useState<ViewedImage | null>(null); const [viewed, setViewed] = useState<ViewedImage | null>(null);

View File

@ -1,4 +1,2 @@
import 'server-only';
export { ChannelFeed } from './ChannelFeed'; export { ChannelFeed } from './ChannelFeed';
export type { ChannelFeedLayout, ChannelFeedProps } from './types'; export type { ChannelFeedLayout, ChannelFeedProps } from './types';

View File

@ -1,12 +1,9 @@
import type { PublicCreatorPayload } from '../../../../../../../features/channel'; import type { PublicCreatorPayload } from '../../../../../../../features/channel';
import type { PostPagePayload } from '../../../../../../../features/post';
export type ChannelFeedLayout = 'mobile' | 'desktop'; export type ChannelFeedLayout = 'mobile' | 'desktop';
export type ChannelFeedProps = { export type ChannelFeedProps = {
channel: PublicCreatorPayload; channel: PublicCreatorPayload;
/** What the posts' relative times count from: the server render's time. */
now: string;
layout: ChannelFeedLayout; layout: ChannelFeedLayout;
}; };
@ -15,8 +12,6 @@ export type ChannelFeedListProps = {
username: string; username: string;
displayName: string | null; displayName: string | null;
avatarUrl: string | null; avatarUrl: string | null;
firstPage: PostPagePayload;
now: string;
layout: ChannelFeedLayout; layout: ChannelFeedLayout;
}; };

View File

@ -21,7 +21,7 @@ export type ChannelHeaderLabels = {
}; };
export type ChannelHeaderProps = { export type ChannelHeaderProps = {
/** Its `followerCount`, from the server's `getChannel`, renders the follower count at once. */ /** Its `followerCount`, read with the channel, renders the follower count at once. */
channel: PublicCreatorPayload; channel: PublicCreatorPayload;
/** /**
* @deprecated No longer shown: the sub-line is @username (DS v6.1, R15). Kept so the callers * @deprecated No longer shown: the sub-line is @username (DS v6.1, R15). Kept so the callers

View File

@ -1,19 +1,19 @@
'use client';
import { CreatorStats } from '@lumina/island/organisms/creator-stats'; import { CreatorStats } from '@lumina/island/organisms/creator-stats';
import { getPredictionStats } from '../../../../../../../features/prediction/caches/server'; import { useCreatorStatsPart } from '../../../../../../../features/prediction';
import type { ChannelStatsProps } from './types'; import type { ChannelStatsProps } from './types';
/** /**
* The creator's track record in the header, the same for every visitor. All or nothing: below the * The creator's track record in the header, the same for every visitor and read in the browser
* API's threshold (`public: false`) it renders nothing, never zeros, and the header closes the gap. * (0070). All or nothing: below the API's threshold (`public: false`) it renders nothing, never
* zeros, and the header closes the gap. It suspends while reading, so its `<Suspense>` shows the
* stats skeleton.
*/ */
export async function ChannelStats({ creatorId, labels }: ChannelStatsProps) { export function ChannelStats({ creatorId, labels }: ChannelStatsProps) {
const stats = await getPredictionStats(creatorId); const { stats } = useCreatorStatsPart(creatorId);
return ( return (
<CreatorStats <CreatorStats stats={stats} trendOrder="oldest-first" labels={labels} />
stats={stats.isPublic ? stats : null}
trendOrder="oldest-first"
labels={labels}
/>
); );
} }

View File

@ -1,4 +1,2 @@
import 'server-only';
export { ChannelStats } from './ChannelStats'; export { ChannelStats } from './ChannelStats';
export type { ChannelStatsProps } from './types'; export type { ChannelStatsProps } from './types';

View File

@ -3,7 +3,7 @@ import type { ReactNode } from 'react';
import type { PublicCreatorPayload } from '../../../../../../../../../features/channel'; import type { PublicCreatorPayload } from '../../../../../../../../../features/channel';
export type PostChannelBarProps = { export type PostChannelBarProps = {
/** Its `followerCount`, from the server's `getChannel`, renders the follower count at once. */ /** Its `followerCount`, read with the channel, renders the follower count at once. */
channel: PublicCreatorPayload; channel: PublicCreatorPayload;
/** mobile: a card in a padded strip under the top bar. desktop: a panel in the 640 column. */ /** mobile: a card in a padded strip under the top bar. desktop: a panel in the 640 column. */
layout: 'mobile' | 'desktop'; layout: 'mobile' | 'desktop';

View File

@ -7,7 +7,7 @@ export type PostViewProps = {
/** The creator's display name for the card's header; absent, @username alone. */ /** The creator's display name for the card's header; absent, @username alone. */
displayName?: string | null; displayName?: string | null;
avatarUrl: string | null; avatarUrl: string | null;
/** What the time counts from: the server render's time. */ /** What the time counts from: when the post was read. */
now: string; now: string;
layout: 'mobile' | 'desktop'; layout: 'mobile' | 'desktop';
}; };

View File

@ -1,3 +0,0 @@
/** Search results cut titles and descriptions around these lengths. */
export const TITLE_MAX_LENGTH = 60;
export const DESCRIPTION_MAX_LENGTH = 160;

View File

@ -1,76 +0,0 @@
import 'server-only';
import type { Metadata } from 'next';
import { ROUTES } from '../navigation/navigation';
import { DESCRIPTION_MAX_LENGTH, TITLE_MAX_LENGTH } from './constants';
import type { ChannelMetadataArgs, PostMetadataArgs } from './types';
/** Cut at a word, with «…», when it runs past `max`. */
function clip(text: string, max: number): string {
if (text.length <= max) return text;
const cut = text.slice(0, max - 1);
const space = cut.lastIndexOf(' ');
return `${(space > max / 2 ? cut.slice(0, space) : cut).trimEnd()}…`;
}
/** A channel's title, description, canonical `/channels/username` and profile card. */
export function channelMetadata({
channel,
title,
description,
}: ChannelMetadataArgs): Metadata {
const url = ROUTES.channel(channel.username);
const summary = clip(
channel.bio?.replace(/\s+/g, ' ') ?? description,
DESCRIPTION_MAX_LENGTH,
);
return {
title,
description: summary,
alternates: { canonical: url },
openGraph: {
type: 'profile',
title,
description: summary,
url,
username: channel.username,
images: channel.avatarUrl ? [channel.avatarUrl] : undefined,
},
};
}
/**
* A post's metadata from what every visitor may read: a premium post's teaser, never its full
* text, and never its images, which are paywalled. The first line of text names it.
*/
export function postMetadata({
channel,
post,
fallbackTitle,
}: PostMetadataArgs): Metadata {
const text = (post.locked ? post.captionPreview : post.caption)?.trim();
const firstLine = text
?.split('\n')
.find((line) => line.trim())
?.trim();
const title = firstLine ? clip(firstLine, TITLE_MAX_LENGTH) : fallbackTitle;
const description = text
? clip(text.replace(/\s+/g, ' '), DESCRIPTION_MAX_LENGTH)
: undefined;
const url = ROUTES.post(channel.username, post.id);
return {
title,
description,
alternates: { canonical: url },
openGraph: {
type: 'article',
title,
description,
url,
publishedTime: post.publishedAt ?? undefined,
authors: [ROUTES.channel(channel.username)],
images: channel.avatarUrl ? [channel.avatarUrl] : undefined,
},
};
}

View File

@ -1,10 +1,4 @@
import 'server-only'; import 'server-only';
export { faqJsonLd, landingMetadata } from './landing'; export { faqJsonLd, landingMetadata } from './landing';
export { channelMetadata, postMetadata } from './metadata'; export type { FaqJsonLdItem, LandingMetadataArgs } from './types';
export type {
ChannelMetadataArgs,
FaqJsonLdItem,
LandingMetadataArgs,
PostMetadataArgs,
} from './types';

View File

@ -1,21 +1,3 @@
import type { PublicCreatorPayload } from '../../features/channel';
import type { PostPayload } from '../../features/post';
export type ChannelMetadataArgs = {
channel: PublicCreatorPayload;
/** «@sara_gold»; the root layout adds « · لومینا». */
title: string;
description: string;
};
export type PostMetadataArgs = {
channel: PublicCreatorPayload;
/** As every visitor sees it: a premium post is its teaser. */
post: PostPayload;
/** When the post has no text to name it: «پست @sara_gold». */
fallbackTitle: string;
};
export type LandingMetadataArgs = { export type LandingMetadataArgs = {
/** The whole title, brand included: «لومینا — …». */ /** The whole title, brand included: «لومینا — …». */
title: string; title: string;

View File

@ -1,33 +0,0 @@
import 'server-only';
import { cache } from 'react';
import { channelRepository } from '../repositories/channel';
import type { PublicCreatorPayload } from '../repositories/channel';
import { getPublicTiers } from './public-tiers';
/**
* The channel at `/channels/username`, once per render per username: the page and its metadata
* share one request. Pass the username as the API stores it (lower case). 404 reaches the caller.
* It carries the public follower count for the header (a failed count is left to the browser) and
* whether anything can be bought (J05-1g): an approved creator with a priced tier. Failed tiers
* leave the sale open, so checkout decides.
*/
export const getChannel = cache(
async (username: string): Promise<PublicCreatorPayload> => {
const channel = await channelRepository.getCreatorByUsername({ username });
// A suspended channel shows no header, so no count.
if (channel.suspended) return channel;
const [followerCount, hasPricedTier] = await Promise.all([
channelRepository
.getFollowerCount({ creatorId: channel.creatorId })
.catch(() => null),
getPublicTiers(channel.creatorId).then(
(tiers) => tiers.some((tier) => (tier.priceToman ?? 0) > 0),
() => true,
),
]);
const saleOpen = !channel.verificationPending && hasPricedTier;
return { ...channel, followerCount, saleOpen };
},
);

View File

@ -1,12 +0,0 @@
import 'server-only';
import { cache } from 'react';
import { channelRepository } from '../repositories/channel';
import type { PublicCreatorPayload } from '../repositories/channel';
/** An approved creator's public profile, once per render per id. 404 reaches the caller. */
export const getPublicCreator = cache(
(creatorId: string): Promise<PublicCreatorPayload> =>
channelRepository.getCreator({ creatorId }),
);

View File

@ -1,12 +0,0 @@
import 'server-only';
import { cache } from 'react';
import { channelRepository } from '../repositories/channel';
import type { PublicTierPayload } from '../repositories/channel';
/** A creator's active tiers, once per render per id; the channel and checkout share it. */
export const getPublicTiers = cache(
(creatorId: string): Promise<PublicTierPayload[]> =>
channelRepository.listTiers({ creatorId }),
);

View File

@ -1,5 +0,0 @@
import 'server-only';
export { getChannel } from './channel';
export { getPublicCreator } from './public-creator';
export { getPublicTiers } from './public-tiers';

View File

@ -18,6 +18,8 @@ export type {
ChannelCountsPartModel, ChannelCountsPartModel,
UseChannelCountsPartOptions, UseChannelCountsPartOptions,
} from './models/channel-counts'; } from './models/channel-counts';
export { channelPageQuery, useChannelPage } from './models/channel-page';
export type { ChannelPageModel } from './models/channel-page';
export { syncFollowCaches } from './models/follow-caches'; export { syncFollowCaches } from './models/follow-caches';
export { useFollowingPart } from './models/following'; export { useFollowingPart } from './models/following';
export type { FollowingPartModel } from './models/following'; export type { FollowingPartModel } from './models/following';

View File

@ -0,0 +1,49 @@
import { classifyError } from '@lumina/libs/error-handler';
import { queryOptions } from '@tanstack/react-query';
import { channelKeys, channelRepository } from '../../repositories/channel';
import type { PublicCreatorPayload } from '../../repositories/channel';
/**
* The channel at `/channels/username` with its public follower count (a failed count is left to
* the header) and whether anything can be bought (J05-1g): an approved creator with a priced
* tier. Failed tiers leave the sale open, so checkout decides. `null` when no channel has this
* username; any other failure rejects to the page's boundary.
*/
async function readChannelPage(
username: string,
signal: AbortSignal,
): Promise<PublicCreatorPayload | null> {
let channel: PublicCreatorPayload;
try {
channel = await channelRepository.getCreatorByUsername(
{ username },
{ signal },
);
} catch (error) {
if (classifyError(error).read === 'not-found') return null;
throw error;
}
// A suspended channel shows no header, so no count.
if (channel.suspended) return channel;
const [followerCount, hasPricedTier] = await Promise.all([
channelRepository
.getFollowerCount({ creatorId: channel.creatorId }, { signal })
.catch(() => null),
channelRepository
.listTiers({ creatorId: channel.creatorId }, { signal })
.then(
(tiers) => tiers.some((tier) => (tier.priceToman ?? 0) > 0),
() => true,
),
]);
const saleOpen = !channel.verificationPending && hasPricedTier;
return { ...channel, followerCount, saleOpen };
}
/** The channel page's one read, shared by the channel, its posts and checkout (0070). */
export const channelPageQuery = (username: string) =>
queryOptions({
queryKey: channelKeys.page(username),
queryFn: ({ signal }) => readChannelPage(username, signal),
});

View File

@ -0,0 +1,3 @@
export { channelPageQuery } from './channel-page-query';
export { useChannelPage } from './use-channel-page';
export type { ChannelPageModel } from './types';

View File

@ -0,0 +1,8 @@
import type { PublicCreatorPayload } from '../../repositories/channel';
export type ChannelPageModel =
/** Still reading: the page keeps its skeleton. */
| { status: 'pending' }
/** No channel has this username, or not any more. */
| { status: 'not-found' }
| { status: 'ok'; channel: PublicCreatorPayload };

View File

@ -0,0 +1,16 @@
import { useQuery } from '@tanstack/react-query';
import { channelPageQuery } from './channel-page-query';
import type { ChannelPageModel } from './types';
/**
* The channel a page shows, read in the browser only (0070): the server render has no data, so it
* sends the page's skeleton, which stays until this read arrives. The same for every visitor.
*/
export function useChannelPage(username: string): ChannelPageModel {
const { data } = useQuery(channelPageQuery(username));
// A failed first read throws to the page's boundary, so no data means it is still loading.
if (data === undefined) return { status: 'pending' };
if (data === null) return { status: 'not-found' };
return { status: 'ok', channel: data };
}

View File

@ -21,6 +21,8 @@ export const channelKeys = {
[...channelKeys.creator(creatorId), 'follower-count'] as const, [...channelKeys.creator(creatorId), 'follower-count'] as const,
byUsername: (username: string) => byUsername: (username: string) =>
[...channelKeys.all, 'username', username] as const, [...channelKeys.all, 'username', username] as const,
/** The channel page's read: the header with its follower count and sale state, or `null`. */
page: (username: string) => [...channelKeys.all, 'page', username] as const,
/** The signed-in investor's follow and subscription with this creator. */ /** The signed-in investor's follow and subscription with this creator. */
standing: (creatorId: string) => standing: (creatorId: string) =>
[...channelKeys.creator(creatorId), 'standing'] as const, [...channelKeys.creator(creatorId), 'standing'] as const,

View File

@ -38,15 +38,15 @@ export type PublicCreatorPayload = {
verificationPending?: boolean; verificationPending?: boolean;
/** /**
* Whether anything can be bought: the creator is approved and has a priced tier. Read with the * Whether anything can be bought: the creator is approved and has a priced tier. Read with the
* channel only by the server's `getChannel`, for every visitor's action area; `true` when the * channel only by `channelPageQuery`, for every visitor's action area; `true` when the
* tiers couldn't be read, so checkout stays the gate. An investor's own checkout screen says it * tiers couldn't be read, so checkout stays the gate. An investor's own checkout screen says it
* again (`ChannelStanding.saleClosed`). * again (`ChannelStanding.saleClosed`).
*/ */
saleOpen?: boolean; saleOpen?: boolean;
/** /**
* The public follower count, read with the channel only by the server's `getChannel`, so the * The public follower count, read with the channel only by `channelPageQuery`, so the header
* header renders it: absent from every other read, and `null` when that read failed. Either * renders it with the channel: absent from every other read, and `null` when that read failed,
* way the header reads it again in the browser. * which the header then reads on its own.
*/ */
followerCount?: number | null; followerCount?: number | null;
}; };

View File

@ -23,6 +23,8 @@ export type {
CodeSource, CodeSource,
UseCheckoutPageOptions, UseCheckoutPageOptions,
} from './models/checkout'; } from './models/checkout';
export { useCheckoutChannel } from './models/checkout-channel';
export type { CheckoutChannelModel } from './models/checkout-channel';
export { useInviteLink } from './models/invite-link'; export { useInviteLink } from './models/invite-link';
export type { InviteLinkModel } from './models/invite-link'; export type { InviteLinkModel } from './models/invite-link';
export { usePaymentResultPage } from './models/payment-result'; export { usePaymentResultPage } from './models/payment-result';

View File

@ -0,0 +1,2 @@
export { useCheckoutChannel } from './use-checkout-channel';
export type { CheckoutChannelModel } from './types';

View File

@ -0,0 +1,4 @@
import type { ChannelPageModel } from '../../../channel';
/** The channel being paid; a suspended one stays `pending` while the page leaves for it. */
export type CheckoutChannelModel = ChannelPageModel;

View File

@ -0,0 +1,23 @@
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';
import { ROUTES } from '../../../../app/navigation/navigation';
import { useChannelPage } from '../../../channel';
import type { CheckoutChannelModel } from './types';
/**
* Who is being paid on `/checkout/username`, read in the browser only (0070), the same for every
* visitor. A suspended channel sends the visitor to the channel, which says it is unavailable;
* the page keeps its skeleton meanwhile.
*/
export function useCheckoutChannel(username: string): CheckoutChannelModel {
const router = useRouter();
const page = useChannelPage(username);
const suspended = page.status === 'ok' && page.channel.suspended;
useEffect(() => {
if (suspended) router.replace(ROUTES.channel(username));
}, [suspended, router, username]);
return suspended ? { status: 'pending' } : page;
}

View File

@ -5,6 +5,8 @@ export type {
AnalystFollowState, AnalystFollowState,
UseAnalystFollowPartOptions, UseAnalystFollowPartOptions,
} from './models/analyst-follow'; } from './models/analyst-follow';
export { useAnalystsPage } from './models/analysts-page';
export type { AnalystsPageModel } from './models/analysts-page';
export { export {
isSearchable, isSearchable,
SEARCH_MIN_LENGTH, SEARCH_MIN_LENGTH,

View File

@ -0,0 +1,2 @@
export { useAnalystsPage } from './use-analysts-page';
export type { AnalystsPageModel } from './types';

View File

@ -0,0 +1,7 @@
import type { CreatorSummaryPayload } from '../../repositories/discovery';
export type AnalystsPageModel =
/** Still reading: the page keeps its skeleton. */
| { status: 'pending' }
/** Every featured analyst, in the admin's order. */
| { status: 'ok'; analysts: CreatorSummaryPayload[] };

View File

@ -0,0 +1,17 @@
import { useQuery } from '@tanstack/react-query';
import { featuredCreatorsQuery } from '../featured-creators/featured-creators-query';
import type { AnalystsPageModel } from './types';
/**
* «تحلیلگران منتخب» (J04-3): every featured analyst, read in the browser only (0070), the same
* for every visitor and shared with خانه's featured row. A failed read is the page's error state
* with its retry, never a partial list.
*/
export function useAnalystsPage(): AnalystsPageModel {
const { data } = useQuery(featuredCreatorsQuery());
// A failed first read throws to the page's boundary, so no data means it is still loading.
return data === undefined
? { status: 'pending' }
: { status: 'ok', analysts: data };
}

View File

@ -1,21 +0,0 @@
import 'server-only';
import { cache } from 'react';
import { POST_PAGE_LIMIT, postRepository } from '../repositories/post';
import type { PostPagePayload } from '../repositories/post';
/**
* A channel's first page as every visitor sees it: server reads carry no session, so drafts are
* left out and premium posts come locked. The creator's drafts and a subscriber's unlocked posts
* load in the browser, in the auth-dependent part that replaces this page. Later pages load on the
* client with the same `POST_PAGE_LIMIT`.
*/
export const getCreatorPosts = cache(
async (creatorId: string): Promise<PostPagePayload> =>
postRepository.listByCreator({
creatorId,
page: 1,
limit: POST_PAGE_LIMIT,
}),
);

View File

@ -1,16 +0,0 @@
import 'server-only';
import { cache } from 'react';
import { postRepository } from '../repositories/post';
import type { PostPayload } from '../repositories/post';
/**
* One post as every visitor sees it: server reads carry no session, so a premium post comes locked
* and the full post loads in the browser for a subscriber. A missing post or any draft, the
* creator's own included, rejects with a 404 for `readOnServer`; the creator opens a draft from a
* page that reads it in the browser.
*/
export const getPost = cache(
async (id: string): Promise<PostPayload> => postRepository.get(id),
);

View File

@ -1,4 +0,0 @@
import 'server-only';
export { getCreatorPosts } from './creator-posts';
export { getPost } from './post';

View File

@ -50,6 +50,8 @@ export type {
UseOwnPostsPartOptions, UseOwnPostsPartOptions,
} from './models/own-posts'; } from './models/own-posts';
export { usePostPart } from './models/post'; export { usePostPart } from './models/post';
export { usePostPage } from './models/post-page';
export type { PostPageModel } from './models/post-page';
export { usePublishAccess } from './models/publish-access'; export { usePublishAccess } from './models/publish-access';
export type { export type {
BlockedStanding, BlockedStanding,

View File

@ -1,13 +1,14 @@
import type { PostPagePayload, PostPayload } from '../../repositories/post'; import type { PostPayload } from '../../repositories/post';
import type { PostListModel } from '../post-list'; import type { PostListModel } from '../post-list';
export type UseChannelFeedPartOptions = { export type UseChannelFeedPartOptions = {
/** The creator's account id. */ /** The creator's account id. */
creatorId: string; creatorId: string;
/** The first page as the server read it: every visitor's view, premium posts locked. */ /** The creator or an active subscriber: the pages are read again once their session is known. */
firstPage: PostPagePayload;
/** The creator or an active subscriber: the pages are read again with their session. */
entitled: boolean; entitled: boolean;
}; };
export type ChannelFeedPartModel = PostListModel<PostPayload>; export type ChannelFeedPartModel = PostListModel<PostPayload> & {
/** When the first page was read: the posts' relative times count from it. */
now: string;
};

View File

@ -1,4 +1,4 @@
import { useInfiniteQuery } from '@tanstack/react-query'; import { useSuspenseInfiniteQuery } from '@tanstack/react-query';
import { import {
POST_PAGE_LIMIT, POST_PAGE_LIMIT,
@ -9,18 +9,17 @@ import { usePostList } from '../post-list';
import type { ChannelFeedPartModel, UseChannelFeedPartOptions } from './types'; import type { ChannelFeedPartModel, UseChannelFeedPartOptions } from './types';
/** /**
* A channel's posts, page after page. The first page comes from the server render, which carries * A channel's posts, page after page, read in the browser only (0070) with the visitor's session,
* no session, so premium posts arrive locked; for the creator or a subscriber the loaded pages are * so a subscriber's premium posts arrive open. A session restored after the first read makes the
* read again in the browser and those posts open in place. Drafts reach only the creator and * creator or a subscriber entitled, and the loaded pages are read again for them. Drafts reach
* stay out of the channel. A post read in full stays open while the list is mounted (C5 §۵), as * only the creator and stay out of the channel. A post read in full stays open while the list is
* `usePostList` keeps it. * mounted (C5 §۵), as `usePostList` keeps it.
*/ */
export function useChannelFeedPart({ export function useChannelFeedPart({
creatorId, creatorId,
firstPage,
entitled, entitled,
}: UseChannelFeedPartOptions): ChannelFeedPartModel { }: UseChannelFeedPartOptions): ChannelFeedPartModel {
const feed = useInfiniteQuery({ const feed = useSuspenseInfiniteQuery({
queryKey: postKeys.channelFeed(creatorId), queryKey: postKeys.channelFeed(creatorId),
queryFn: ({ pageParam, signal }) => queryFn: ({ pageParam, signal }) =>
postRepository.listByCreator( postRepository.listByCreator(
@ -30,8 +29,10 @@ export function useChannelFeedPart({
initialPageParam: 1, initialPageParam: 1,
getNextPageParam: ({ page, limit, total }) => getNextPageParam: ({ page, limit, total }) =>
page * limit < total ? page + 1 : undefined, page * limit < total ? page + 1 : undefined,
initialData: { pages: [firstPage], pageParams: [1] },
}); });
return usePostList({ query: feed, entitled }); return {
...usePostList({ query: feed, entitled }),
now: new Date(feed.dataUpdatedAt).toISOString(),
};
} }

View File

@ -38,9 +38,8 @@ export function useOwnerPostPart({
setIsConfirmingDelete(false); setIsConfirmingDelete(false);
removeCachedPost(queryClient, post); removeCachedPost(queryClient, post);
showToast({ tone: 'success', message: t('post.delete.deleted') }); showToast({ tone: 'success', message: t('post.delete.deleted') });
// The channel's first page and track record are rendered on the server: the page it goes // The post page it stays on renders again and reads the post afresh, which is now missing.
// to is read fresh, and one it stays on renders again. Refreshed before leaving, the post // Refreshed before leaving, the post page would flash its «deleted» state first.
// page would flash its «deleted» state first.
if (onDeleted) onDeleted(); if (onDeleted) onDeleted();
else router.refresh(); else router.refresh();
}; };

Some files were not shown because too many files have changed in this diff Show More