Compare commits
3 Commits
636430640d
...
9877d7bf14
| Author | SHA1 | Date |
|---|---|---|
|
|
9877d7bf14 | |
|
|
7949eb0d64 | |
|
|
88384fa72d |
|
|
@ -0,0 +1,27 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { DesktopHeader } from '@lumina/market/app/navigation';
|
||||
|
||||
import { i18n } from '../../../../../i18n';
|
||||
|
||||
/** The composer before it arrives, under the real header. */
|
||||
export default function Loading() {
|
||||
return (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<DesktopHeader />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
justifyContent="justify-center"
|
||||
className="px-8 py-10"
|
||||
>
|
||||
<SkeletonPreset
|
||||
preset="form"
|
||||
count={2}
|
||||
delayed
|
||||
label={i18n.t('content:composer.loading')}
|
||||
className="w-full max-w-content"
|
||||
/>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||
import { DesktopHeader } from '@lumina/market/app/navigation';
|
||||
import { PostComposer } from '@lumina/market/app/screens/(flow)/compose/post/organisms/post-composer';
|
||||
import { POST_ID_PATTERN } from '@lumina/market/features/post';
|
||||
import type { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
import { i18n } from '../../../../../i18n';
|
||||
|
||||
type EditPostPageProps = { params: Promise<{ id: string }> };
|
||||
|
||||
export function generateMetadata(): Metadata {
|
||||
return {
|
||||
title: i18n.t('content:composer.edit-title'),
|
||||
robots: { index: false },
|
||||
};
|
||||
}
|
||||
|
||||
/** Editing a published post, in its first 15 minutes; in the browser only. */
|
||||
export default async function EditPostPage({ params }: EditPostPageProps) {
|
||||
const { id } = await params;
|
||||
// The API answers a malformed id with a 500, not a 404.
|
||||
if (!POST_ID_PATTERN.test(id)) notFound();
|
||||
return (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<DesktopHeader />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
justifyContent="justify-center"
|
||||
className="px-8 py-10"
|
||||
>
|
||||
<AuthGuard
|
||||
role="creator"
|
||||
fallback={
|
||||
<SkeletonPreset
|
||||
preset="form"
|
||||
count={2}
|
||||
label={i18n.t('content:composer.loading')}
|
||||
className="w-full max-w-content"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<PostComposer layout="desktop" postId={id} />
|
||||
</AuthGuard>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { DesktopHeader } from '@lumina/market/app/navigation';
|
||||
|
||||
import { i18n } from '../../../../i18n';
|
||||
|
||||
/** The composer before it arrives, under the real header. */
|
||||
export default function Loading() {
|
||||
return (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<DesktopHeader />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
justifyContent="justify-center"
|
||||
className="px-8 py-10"
|
||||
>
|
||||
<SkeletonPreset
|
||||
preset="form"
|
||||
count={2}
|
||||
delayed
|
||||
label={i18n.t('content:composer.loading')}
|
||||
className="w-full max-w-content"
|
||||
/>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||
import { DesktopHeader } from '@lumina/market/app/navigation';
|
||||
import { PostComposer } from '@lumina/market/app/screens/(flow)/compose/post/organisms/post-composer';
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
import { i18n } from '../../../../i18n';
|
||||
|
||||
export function generateMetadata(): Metadata {
|
||||
return {
|
||||
title: i18n.t('content:composer.new-title'),
|
||||
robots: { index: false },
|
||||
};
|
||||
}
|
||||
|
||||
/** A new post (C4 ۷.۳): the 640px composer under the header, in the browser only. */
|
||||
export default function ComposePostPage() {
|
||||
return (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<DesktopHeader />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
justifyContent="justify-center"
|
||||
className="px-8 py-10"
|
||||
>
|
||||
<AuthGuard
|
||||
role="creator"
|
||||
fallback={
|
||||
<SkeletonPreset
|
||||
preset="form"
|
||||
count={2}
|
||||
label={i18n.t('content:composer.loading')}
|
||||
className="w-full max-w-content"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<PostComposer layout="desktop" />
|
||||
</AuthGuard>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import { HomeFeedSkeleton } from '@lumina/market/app/screens/(main)/organisms/home-feed';
|
||||
|
||||
import { i18n } from '../../../i18n';
|
||||
import { HomeTemplate } from './templates/home-template';
|
||||
|
||||
/** خانه before it arrives: the heading, then three post skeletons in the 640 column (S1-03). */
|
||||
export default function Loading() {
|
||||
return (
|
||||
<HomeTemplate>
|
||||
<HomeFeedSkeleton
|
||||
layout="desktop"
|
||||
delayed
|
||||
label={i18n.t('home:feed.loading')}
|
||||
/>
|
||||
</HomeTemplate>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
import { PartBoundary } from '@lumina/market/app/error-boundaries';
|
||||
import { ROUTES } from '@lumina/market/app/navigation';
|
||||
import {
|
||||
EXAMPLE_CHANNEL_USERNAME,
|
||||
HomeFeed,
|
||||
HomeFeedSkeleton,
|
||||
HomeGuard,
|
||||
} from '@lumina/market/app/screens/(main)/organisms/home-feed';
|
||||
import type { Metadata } from 'next';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
import { displayUrl } from '../../../configs';
|
||||
import { i18n } from '../../../i18n';
|
||||
import { HomeTemplate } from './templates/home-template';
|
||||
|
||||
export function generateMetadata(): Metadata {
|
||||
return { title: i18n.t('home:meta.title'), robots: { index: false } };
|
||||
}
|
||||
|
||||
/**
|
||||
* خانه, `/`: the investor's feed of the creators they follow. The server sends only the frame and
|
||||
* the feed's skeleton, the same for every visitor; the feed loads in the browser with the session.
|
||||
* A guest goes to login, which returns here, and a creator to their own channel. A failed feed
|
||||
* shows in a card in the column, as the desktop boards draw a state there (S3, S2-Desktop).
|
||||
*/
|
||||
export default function HomePage() {
|
||||
const skeleton = (
|
||||
<HomeFeedSkeleton layout="desktop" label={i18n.t('home:feed.loading')} />
|
||||
);
|
||||
return (
|
||||
<HomeTemplate>
|
||||
<PartBoundary name="home-feed" framed>
|
||||
<HomeGuard fallback={skeleton}>
|
||||
<Suspense fallback={skeleton}>
|
||||
<HomeFeed
|
||||
layout="desktop"
|
||||
exampleChannelUrl={displayUrl(
|
||||
ROUTES.channel(EXAMPLE_CHANNEL_USERNAME),
|
||||
)}
|
||||
/>
|
||||
</Suspense>
|
||||
</HomeGuard>
|
||||
</PartBoundary>
|
||||
</HomeTemplate>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { Typography } from '@lumina/island/atoms/typography';
|
||||
|
||||
import { i18n } from '../../../../../i18n';
|
||||
import type { HomeTemplateProps } from './types';
|
||||
|
||||
/**
|
||||
* خانه's frame on desktop, shared by the page and its loading: one 640 column under the header,
|
||||
* with no side content (U7 ۶.۱, Main C), the h2 «خانه» at its top as on mobile, then the feed.
|
||||
* The header comes from the main layout, خانه on.
|
||||
*/
|
||||
export function HomeTemplate({ children }: HomeTemplateProps) {
|
||||
const t = i18n.getFixedT(null, 'home');
|
||||
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"
|
||||
>
|
||||
<Typography tag="h2" variant="heading-sm">
|
||||
{t('heading')}
|
||||
</Typography>
|
||||
{children}
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export { HomeTemplate } from './HomeTemplate';
|
||||
export type { HomeTemplateProps } from './types';
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import type { ReactNode } from 'react';
|
||||
|
||||
export type HomeTemplateProps = {
|
||||
/** The feed, or its skeleton. */
|
||||
children: ReactNode;
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Locked until a creator finishes registration step 5 (0016), as on the full page; the guard
|
||||
// renders the dialog as is.
|
||||
export { OnboardingGuard as default } from '@lumina/market/app/guards/onboarding-guard';
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||
import {
|
||||
PostComposerDialog,
|
||||
PostComposerDialogSkeleton,
|
||||
} from '@lumina/market/app/screens/(flow)/compose/post/organisms/post-composer';
|
||||
|
||||
/**
|
||||
* A new post opened from a main page (C4 ۷.۳): the 640px composer dialog over that page, the URL
|
||||
* /compose/post; a direct load of that URL gets the full page instead. In the browser only: the
|
||||
* dialog's skeleton until the viewer is known, then the composer for a creator, or the no-access
|
||||
* state in the dialog for anyone else.
|
||||
*/
|
||||
export default function ComposePostDialog() {
|
||||
return (
|
||||
<AuthGuard fallback={<PostComposerDialogSkeleton />}>
|
||||
<PostComposerDialog />
|
||||
</AuthGuard>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* Empties the `@modal` slot on the channel. A slot keeps its last page through a soft navigation
|
||||
* to a route it has none for, so without this the «پست جدید» dialog would stay open over the
|
||||
* channel it lands on after publishing. Only this route: a catch-all here would also match every
|
||||
* path without a page, and a soft navigation there would keep the old page under the new URL.
|
||||
*/
|
||||
export default function ChannelModal() {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/** No dialog: what the `@modal` slot shows on a direct load and on every page that opens none. */
|
||||
export default function ModalDefault() {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* Empties the `@modal` slot on خانه. A slot keeps its last page through a soft navigation to a
|
||||
* route it has none for, so without this the «پست جدید» dialog would stay open over خانه when it
|
||||
* closes there (the composer's fallback with no history behind it) or when a link leads home while
|
||||
* it is open. Only this route: a catch-all here would also match every path without a page, and a
|
||||
* soft navigation there would keep the old page under the new URL.
|
||||
*/
|
||||
export default function HomeModal() {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { Card } from '@lumina/island/molecules/card';
|
||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
|
||||
import { i18n } from '../../../../i18n';
|
||||
|
||||
/** The channel before it arrives: the header panel, then a post, in the 640 column. */
|
||||
export default function Loading() {
|
||||
const t = i18n.getFixedT(null, 'channel');
|
||||
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"
|
||||
>
|
||||
<Card padding="lg">
|
||||
<SkeletonPreset preset="header" framed delayed label={t('loading')} />
|
||||
</Card>
|
||||
<SkeletonPreset preset="post-media" delayed label={t('feed.loading')} />
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 { Metadata } from 'next';
|
||||
|
||||
import { displayUrl } from '../../../../configs';
|
||||
|
||||
export const metadata: Metadata = { robots: { index: false } };
|
||||
|
||||
/** No channel at this address, or not any more. */
|
||||
export default function ChannelNotFoundPage() {
|
||||
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={displayUrl('')} />
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
import { ROUTES } from '@lumina/market/app/navigation';
|
||||
import {
|
||||
channelMetadata,
|
||||
getChannel,
|
||||
getRequestTime,
|
||||
readOnServer,
|
||||
} from '@lumina/market/server';
|
||||
import { toChannelUsername } from '@lumina/market/shared/utils';
|
||||
import type { Metadata } from 'next';
|
||||
import { notFound, permanentRedirect } from 'next/navigation';
|
||||
|
||||
import { displayUrl } from '../../../../configs';
|
||||
import { i18n } from '../../../../i18n';
|
||||
import { ChannelTemplate } from './templates/channel-template';
|
||||
|
||||
type ChannelPageProps = { params: Promise<{ username: string }> };
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: ChannelPageProps): Promise<Metadata> {
|
||||
const username = toChannelUsername((await params).username);
|
||||
if (!username) return { robots: { index: false } };
|
||||
const channel = await readOnServer(() => getChannel(username));
|
||||
if (channel.status !== 'ok') return { robots: { index: false } };
|
||||
if (channel.data.suspended) {
|
||||
return {
|
||||
title: i18n.t('channel:meta.unavailable-title'),
|
||||
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, `/@username`. The same server render for every visitor: the header, the
|
||||
* track record and the first posts; subscribe, follow and the locked posts' gates load in the
|
||||
* browser. Any other spelling of the username redirects to the one the API stores.
|
||||
*/
|
||||
export default async function ChannelPage({ params }: ChannelPageProps) {
|
||||
const segment = (await params).username;
|
||||
const username = toChannelUsername(segment);
|
||||
if (!username) notFound();
|
||||
if (username !== segment) permanentRedirect(ROUTES.channel(username));
|
||||
const channel = await readOnServer(() => getChannel(username));
|
||||
if (channel.status !== 'ok') notFound();
|
||||
|
||||
return (
|
||||
<ChannelTemplate
|
||||
channel={channel.data}
|
||||
channelUrl={displayUrl(ROUTES.channel(username))}
|
||||
now={getRequestTime()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
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 { i18n } from '../../../../../../i18n';
|
||||
|
||||
/**
|
||||
* The post before it arrives, in the 640 column (C4b ۱.۵): the channel bar's panel with the author
|
||||
* row and the subscribe and follow row, then the post with its media. No lock is guessed meanwhile.
|
||||
*/
|
||||
export default function Loading() {
|
||||
const t = i18n.getFixedT(null, 'channel');
|
||||
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"
|
||||
>
|
||||
<Card padding="lg">
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
import { ROUTES } from '@lumina/market/app/navigation';
|
||||
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 type { Metadata } from 'next';
|
||||
import { notFound, permanentRedirect } from 'next/navigation';
|
||||
|
||||
import { displayUrl } from '../../../../../../configs';
|
||||
import { i18n } from '../../../../../../i18n';
|
||||
import { PostTemplate } from './templates/post-template';
|
||||
|
||||
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. */
|
||||
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 };
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: PostPageProps): Promise<Metadata> {
|
||||
const { username: segment, id } = await params;
|
||||
const username = toChannelUsername(segment);
|
||||
const page = username ? await readPostPage(username, id) : null;
|
||||
if (!page?.post || page.channel.suspended) {
|
||||
return {
|
||||
title: i18n.t('channel:meta.post-missing-title'),
|
||||
robots: { index: false },
|
||||
};
|
||||
}
|
||||
return postMetadata({
|
||||
channel: page.channel,
|
||||
post: page.post,
|
||||
fallbackTitle: i18n.t('channel:meta.post-title', {
|
||||
username: page.channel.username,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* One post, `/@username/posts/[id]`: where every shared link lands. The server renders it as every
|
||||
* visitor sees it; a subscriber's or the creator's premium post opens in the browser. A deleted
|
||||
* or unknown post keeps the channel's frame and leads back to the channel.
|
||||
*/
|
||||
export default async function PostPage({ params }: PostPageProps) {
|
||||
const { username: segment, id } = await params;
|
||||
const username = toChannelUsername(segment);
|
||||
if (!username) notFound();
|
||||
if (username !== segment) permanentRedirect(ROUTES.post(username, id));
|
||||
const page = await readPostPage(username, id);
|
||||
if (!page) notFound();
|
||||
|
||||
return (
|
||||
<PostTemplate
|
||||
channel={page.channel}
|
||||
post={page.post}
|
||||
channelUrl={displayUrl(ROUTES.channel(username))}
|
||||
now={getRequestTime()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { PartBoundary } from '@lumina/market/app/error-boundaries';
|
||||
import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions';
|
||||
import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable';
|
||||
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 { PostView } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-view';
|
||||
|
||||
import { i18n } from '../../../../../../../../i18n';
|
||||
import type { PostTemplateProps } from './types';
|
||||
|
||||
/**
|
||||
* The post on desktop, in the 640 column: the creator with subscribe and follow, then the post in
|
||||
* full. The action area loads in the browser.
|
||||
*/
|
||||
export function PostTemplate({
|
||||
channel,
|
||||
post,
|
||||
channelUrl,
|
||||
now,
|
||||
}: PostTemplateProps) {
|
||||
const t = i18n.getFixedT(null, 'channel');
|
||||
|
||||
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"
|
||||
>
|
||||
{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"
|
||||
/>
|
||||
</PartBoundary>
|
||||
}
|
||||
/>
|
||||
<PostView
|
||||
post={post}
|
||||
username={channel.username}
|
||||
avatarUrl={channel.avatarUrl}
|
||||
now={now}
|
||||
layout="desktop"
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<PostMissing username={channel.username} />
|
||||
)}
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export { PostTemplate } from './PostTemplate';
|
||||
export type { PostTemplateProps } from './types';
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import type { PublicCreatorPayload } from '@lumina/market/features/channel';
|
||||
import type { PostPayload } from '@lumina/market/features/post';
|
||||
|
||||
export type PostTemplateProps = {
|
||||
channel: PublicCreatorPayload;
|
||||
/** `null`: deleted, unknown, or another channel's. */
|
||||
post: PostPayload | null;
|
||||
/** «lumina.ir/@sara_gold», for the guest's login prompt. */
|
||||
channelUrl: string;
|
||||
/** The render's time: the post's time counts from it. */
|
||||
now: string;
|
||||
};
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { PartBoundary } from '@lumina/market/app/error-boundaries';
|
||||
import { 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 {
|
||||
ChannelHeader,
|
||||
channelHeaderLabels,
|
||||
} from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header';
|
||||
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 { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable';
|
||||
import { creatorStatsLabels } from '@lumina/market/shared/labels';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
import { i18n } from '../../../../../../i18n';
|
||||
import type { ChannelTemplateProps } from './types';
|
||||
|
||||
/**
|
||||
* The channel on desktop: one 640px column, no side rail. The header panel renders at once; the
|
||||
* track record and the feed stream in reading order, each in its own boundary, and the action
|
||||
* area loads in the browser.
|
||||
*/
|
||||
export function ChannelTemplate({
|
||||
channel,
|
||||
channelUrl,
|
||||
now,
|
||||
}: ChannelTemplateProps) {
|
||||
const t = i18n.getFixedT(null, 'channel');
|
||||
|
||||
// Suspension outranks everything: no header, posts or actions, for anyone (U6 ۵.۳).
|
||||
if (channel.suspended) {
|
||||
return (
|
||||
<FlexBox
|
||||
tag="main"
|
||||
justifyContent="justify-center"
|
||||
className="px-8 py-10"
|
||||
>
|
||||
<FlexBox direction="flex-col" className="w-full max-w-content">
|
||||
<ChannelUnavailable
|
||||
context="channel"
|
||||
channel={channel}
|
||||
channelUrl={channelUrl}
|
||||
layout="desktop"
|
||||
/>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
||||
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"
|
||||
>
|
||||
<ChannelHeader
|
||||
channel={channel}
|
||||
channelUrl={channelUrl}
|
||||
layout="desktop"
|
||||
share={
|
||||
<ChannelShare
|
||||
creatorId={channel.creatorId}
|
||||
username={channel.username}
|
||||
channelUrl={channelUrl}
|
||||
layout="desktop"
|
||||
/>
|
||||
}
|
||||
stats={
|
||||
<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"
|
||||
/>
|
||||
</PartBoundary>
|
||||
}
|
||||
labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))}
|
||||
/>
|
||||
<PartBoundary name="channel-feed">
|
||||
<Suspense
|
||||
fallback={
|
||||
<SkeletonPreset
|
||||
preset="post"
|
||||
count={2}
|
||||
label={t('feed.loading')}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<ChannelFeed channel={channel} now={now} layout="desktop" />
|
||||
</Suspense>
|
||||
</PartBoundary>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export { ChannelTemplate } from './ChannelTemplate';
|
||||
export type { ChannelTemplateProps } from './types';
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import type { PublicCreatorPayload } from '@lumina/market/features/channel';
|
||||
|
||||
export type ChannelTemplateProps = {
|
||||
channel: PublicCreatorPayload;
|
||||
/** «lumina.ir/@sara_gold». */
|
||||
channelUrl: string;
|
||||
/** The render's time: the posts' relative times count from it. */
|
||||
now: string;
|
||||
};
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
|
||||
import { i18n } from '../../../../../i18n';
|
||||
|
||||
/** The list before it arrives, row for row; the layout keeps the heading and the tabs. */
|
||||
export default function Loading() {
|
||||
return (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="lg"
|
||||
delayed
|
||||
label={i18n.t('dashboard:following.loading')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { PartBoundary } from '@lumina/market/app/error-boundaries';
|
||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||
import { FollowingList } from '@lumina/market/app/screens/(main)/dashboard/following/organisms/following-list';
|
||||
import type { Metadata } from 'next';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
import { i18n } from '../../../../../i18n';
|
||||
|
||||
export function generateMetadata(): Metadata {
|
||||
return {
|
||||
title: i18n.t('dashboard:following.meta-title'),
|
||||
robots: { index: false },
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* داشبورد › دنبالشدهها (U8 ۶.۱): the investor's own list, in the browser only, behind rows of the
|
||||
* same size. A failed read shows in place of the list; the heading and the tabs stay (U8 ۴.۵).
|
||||
*/
|
||||
export default function FollowingPage() {
|
||||
const skeleton = (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="lg"
|
||||
label={i18n.t('dashboard:following.loading')}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<PartBoundary
|
||||
name="following-list"
|
||||
description={i18n.t('dashboard:following.error')}
|
||||
framed
|
||||
>
|
||||
<AuthGuard role="investor" fallback={skeleton}>
|
||||
<Suspense fallback={skeleton}>
|
||||
<FollowingList layout="desktop" />
|
||||
</Suspense>
|
||||
</AuthGuard>
|
||||
</PartBoundary>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { Typography } from '@lumina/island/atoms/typography';
|
||||
import { DashboardTabs } from '@lumina/market/app/screens/(main)/dashboard/organisms/dashboard-tabs';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
import { i18n } from '../../../../i18n';
|
||||
|
||||
/**
|
||||
* The investor's داشبورد on desktop (U8 ۶.۱; U2): the 640 column under the header, with the
|
||||
* «داشبورد» heading, the section row «اشتراکها» · «تراکنشها» · «دنبالشدهها», then the section.
|
||||
* Each section is its own route with its own loading, so the heading and the row stay while one
|
||||
* loads.
|
||||
*/
|
||||
export default function InvestorDashboardLayout({
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
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"
|
||||
>
|
||||
<Typography tag="h1" variant="heading-lg">
|
||||
{i18n.t('common:nav.dashboard')}
|
||||
</Typography>
|
||||
<DashboardTabs layout="desktop" />
|
||||
{children}
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
'use client';
|
||||
|
||||
import { useEffect } from 'react';
|
||||
|
||||
/**
|
||||
* The main page under the «پست جدید» dialog when there is none. A soft navigation to /compose/post
|
||||
* from outside the main pages (the full composer's own header, a login that returns there) still
|
||||
* lands on the `@modal` intercept, with no main page for it to cover. Load the URL again, so the
|
||||
* full composer page takes over.
|
||||
*/
|
||||
export default function MainDefault() {
|
||||
useEffect(() => {
|
||||
window.location.replace(window.location.href);
|
||||
}, []);
|
||||
return null;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { DesktopHeader } from '@lumina/market/app/navigation';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
type MainLayoutProps = {
|
||||
children: ReactNode;
|
||||
/** The `@modal` slot: «پست جدید» over the page (C4 ۷.۳), or nothing. */
|
||||
modal: ReactNode;
|
||||
};
|
||||
|
||||
/**
|
||||
* The main pages on desktop: the header over each page's column. «انتشار» › «پست جدید» opens the
|
||||
* composer as a dialog over the page in the `@modal` slot, which intercepts /compose/post.
|
||||
*/
|
||||
export default function MainLayout({ children, modal }: MainLayoutProps) {
|
||||
return (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
<DesktopHeader />
|
||||
{children}
|
||||
{modal}
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
export { getQueryClient } from './react-query';
|
||||
export { rootMetadata } from './seo';
|
||||
export { displayUrl } from './site';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
import { clientEnv } from '../env';
|
||||
|
||||
/** A path on this site as people read and type it, without the scheme: «lumina.ir/@sara_gold». */
|
||||
export function displayUrl(path: string): string {
|
||||
return `${new URL(clientEnv.NEXT_PUBLIC_SITE_URL).host}${path}`;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
|
||||
import { i18n } from '../../../../../i18n';
|
||||
|
||||
/** The composer before it arrives. */
|
||||
export default function Loading() {
|
||||
return (
|
||||
<SkeletonPreset
|
||||
preset="form"
|
||||
count={2}
|
||||
delayed
|
||||
label={i18n.t('content:composer.loading')}
|
||||
className="p-4"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||
import { PostComposer } from '@lumina/market/app/screens/(flow)/compose/post/organisms/post-composer';
|
||||
import { POST_ID_PATTERN } from '@lumina/market/features/post';
|
||||
import type { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
import { i18n } from '../../../../../i18n';
|
||||
|
||||
type EditPostPageProps = { params: Promise<{ id: string }> };
|
||||
|
||||
export function generateMetadata(): Metadata {
|
||||
return {
|
||||
title: i18n.t('content:composer.edit-title'),
|
||||
robots: { index: false },
|
||||
};
|
||||
}
|
||||
|
||||
/** Editing a published post (C4 ۵.۲), in its first 15 minutes; in the browser only. */
|
||||
export default async function EditPostPage({ params }: EditPostPageProps) {
|
||||
const { id } = await params;
|
||||
// The API answers a malformed id with a 500, not a 404.
|
||||
if (!POST_ID_PATTERN.test(id)) notFound();
|
||||
return (
|
||||
<AuthGuard
|
||||
role="creator"
|
||||
fallback={
|
||||
<SkeletonPreset
|
||||
preset="form"
|
||||
count={2}
|
||||
label={i18n.t('content:composer.loading')}
|
||||
className="p-4"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<PostComposer layout="mobile" postId={id} />
|
||||
</AuthGuard>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
|
||||
import { i18n } from '../../../../i18n';
|
||||
|
||||
/** The composer before it arrives. */
|
||||
export default function Loading() {
|
||||
return (
|
||||
<SkeletonPreset
|
||||
preset="form"
|
||||
count={2}
|
||||
delayed
|
||||
label={i18n.t('content:composer.loading')}
|
||||
className="p-4"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||
import { PostComposer } from '@lumina/market/app/screens/(flow)/compose/post/organisms/post-composer';
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
import { i18n } from '../../../../i18n';
|
||||
|
||||
export function generateMetadata(): Metadata {
|
||||
return {
|
||||
title: i18n.t('content:composer.new-title'),
|
||||
robots: { index: false },
|
||||
};
|
||||
}
|
||||
|
||||
/** A new post (C4): the creator's own task flow, in the browser only, with no bottom nav. */
|
||||
export default function ComposePostPage() {
|
||||
return (
|
||||
<AuthGuard
|
||||
role="creator"
|
||||
fallback={
|
||||
<SkeletonPreset
|
||||
preset="form"
|
||||
count={2}
|
||||
label={i18n.t('content:composer.loading')}
|
||||
className="p-4"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<PostComposer layout="mobile" />
|
||||
</AuthGuard>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import { HomeFeedSkeleton } from '@lumina/market/app/screens/(main)/organisms/home-feed';
|
||||
|
||||
import { i18n } from '../../../i18n';
|
||||
import { HomeTemplate } from './templates/home-template';
|
||||
|
||||
/** خانه before it arrives (S1-03): the real top bar and heading, then three post skeletons. */
|
||||
export default function Loading() {
|
||||
return (
|
||||
<HomeTemplate>
|
||||
<HomeFeedSkeleton
|
||||
layout="mobile"
|
||||
delayed
|
||||
label={i18n.t('home:feed.loading')}
|
||||
/>
|
||||
</HomeTemplate>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
import { PartBoundary } from '@lumina/market/app/error-boundaries';
|
||||
import { ROUTES } from '@lumina/market/app/navigation';
|
||||
import {
|
||||
EXAMPLE_CHANNEL_USERNAME,
|
||||
HomeFeed,
|
||||
HomeFeedSkeleton,
|
||||
HomeGuard,
|
||||
} from '@lumina/market/app/screens/(main)/organisms/home-feed';
|
||||
import type { Metadata } from 'next';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
import { displayUrl } from '../../../configs';
|
||||
import { i18n } from '../../../i18n';
|
||||
import { HomeTemplate } from './templates/home-template';
|
||||
|
||||
export function generateMetadata(): Metadata {
|
||||
return { title: i18n.t('home:meta.title'), robots: { index: false } };
|
||||
}
|
||||
|
||||
/**
|
||||
* خانه, `/`: the investor's feed of the creators they follow. The server sends only the frame and
|
||||
* the feed's skeleton, the same for every visitor; the feed loads in the browser with the session.
|
||||
* A guest goes to login, which returns here, and a creator to their own channel.
|
||||
*/
|
||||
export default function HomePage() {
|
||||
const skeleton = (
|
||||
<HomeFeedSkeleton layout="mobile" label={i18n.t('home:feed.loading')} />
|
||||
);
|
||||
return (
|
||||
<HomeTemplate>
|
||||
<PartBoundary name="home-feed">
|
||||
<HomeGuard fallback={skeleton}>
|
||||
<Suspense fallback={skeleton}>
|
||||
<HomeFeed
|
||||
layout="mobile"
|
||||
exampleChannelUrl={displayUrl(
|
||||
ROUTES.channel(EXAMPLE_CHANNEL_USERNAME),
|
||||
)}
|
||||
/>
|
||||
</Suspense>
|
||||
</HomeGuard>
|
||||
</PartBoundary>
|
||||
</HomeTemplate>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { Typography } from '@lumina/island/atoms/typography';
|
||||
import { MobileTopBar } from '@lumina/market/app/navigation';
|
||||
|
||||
import { i18n } from '../../../../../i18n';
|
||||
import type { HomeTemplateProps } from './types';
|
||||
|
||||
/**
|
||||
* خانه's frame on mobile, shared by the page and its loading: the tab's top bar (the brand,
|
||||
* support and the account, no title), then «خانه» over the feed, the h2 the boards draw
|
||||
* (Home--relocked, Home--confirmed-banner). The bottom nav comes from the main layout, خانه on.
|
||||
*/
|
||||
export function HomeTemplate({ children }: HomeTemplateProps) {
|
||||
const t = i18n.getFixedT(null, 'home');
|
||||
return (
|
||||
<>
|
||||
<MobileTopBar isTab />
|
||||
<FlexBox
|
||||
tag="main"
|
||||
direction="flex-col"
|
||||
gap="gap-3"
|
||||
className="flex-1 p-4"
|
||||
>
|
||||
<Typography tag="h2" variant="heading-sm">
|
||||
{t('heading')}
|
||||
</Typography>
|
||||
{children}
|
||||
</FlexBox>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export { HomeTemplate } from './HomeTemplate';
|
||||
export type { HomeTemplateProps } from './types';
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import type { ReactNode } from 'react';
|
||||
|
||||
export type HomeTemplateProps = {
|
||||
/** The feed, or its skeleton; it fills the height, so an empty feed centres in it. */
|
||||
children: ReactNode;
|
||||
};
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { MobileTopBar } from '@lumina/market/app/navigation';
|
||||
|
||||
import { i18n } from '../../../../i18n';
|
||||
|
||||
/** The channel before it arrives: the real top bar, then the header, track record and a post. */
|
||||
export default function Loading() {
|
||||
const t = i18n.getFixedT(null, 'channel');
|
||||
return (
|
||||
<>
|
||||
<MobileTopBar title={t('top-bar.channel')} />
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1">
|
||||
{/* The skeleton draws the header's flush band itself. */}
|
||||
<SkeletonPreset preset="header" delayed label={t('loading')} />
|
||||
<FlexBox direction="flex-col" gap="gap-3" className="p-4">
|
||||
<SkeletonPreset
|
||||
preset="post-media"
|
||||
delayed
|
||||
label={t('feed.loading')}
|
||||
/>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
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 { displayUrl } from '../../../../configs';
|
||||
import { i18n } from '../../../../i18n';
|
||||
|
||||
export const metadata: Metadata = { robots: { index: false } };
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
return (
|
||||
<>
|
||||
<ChannelNotFoundTopBar title={i18n.t('channel:top-bar.channel')} />
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1">
|
||||
<ChannelNotFound layout="mobile" siteHost={displayUrl('')} />
|
||||
</FlexBox>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
import { ROUTES } from '@lumina/market/app/navigation';
|
||||
import {
|
||||
channelMetadata,
|
||||
getChannel,
|
||||
getRequestTime,
|
||||
readOnServer,
|
||||
} from '@lumina/market/server';
|
||||
import { toChannelUsername } from '@lumina/market/shared/utils';
|
||||
import type { Metadata } from 'next';
|
||||
import { notFound, permanentRedirect } from 'next/navigation';
|
||||
|
||||
import { displayUrl } from '../../../../configs';
|
||||
import { i18n } from '../../../../i18n';
|
||||
import { ChannelTemplate } from './templates/channel-template';
|
||||
|
||||
type ChannelPageProps = { params: Promise<{ username: string }> };
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: ChannelPageProps): Promise<Metadata> {
|
||||
const username = toChannelUsername((await params).username);
|
||||
if (!username) return { robots: { index: false } };
|
||||
const channel = await readOnServer(() => getChannel(username));
|
||||
if (channel.status !== 'ok') return { robots: { index: false } };
|
||||
if (channel.data.suspended) {
|
||||
return {
|
||||
title: i18n.t('channel:meta.unavailable-title'),
|
||||
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, `/@username`. The same server render for every visitor: the header, the
|
||||
* track record and the first posts; subscribe, follow and the locked posts' gates load in the
|
||||
* browser. Any other spelling of the username redirects to the one the API stores.
|
||||
*/
|
||||
export default async function ChannelPage({ params }: ChannelPageProps) {
|
||||
const segment = (await params).username;
|
||||
const username = toChannelUsername(segment);
|
||||
if (!username) notFound();
|
||||
if (username !== segment) permanentRedirect(ROUTES.channel(username));
|
||||
const channel = await readOnServer(() => getChannel(username));
|
||||
if (channel.status !== 'ok') notFound();
|
||||
|
||||
return (
|
||||
<ChannelTemplate
|
||||
channel={channel.data}
|
||||
channelUrl={displayUrl(ROUTES.channel(username))}
|
||||
now={getRequestTime()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
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 { i18n } from '../../../../../../i18n';
|
||||
|
||||
/**
|
||||
* 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
|
||||
* is guessed meanwhile.
|
||||
*/
|
||||
export default function Loading() {
|
||||
const t = i18n.getFixedT(null, 'channel');
|
||||
return (
|
||||
<>
|
||||
<MobileTopBar title={t('top-bar.post')} />
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1">
|
||||
<SkeletonRegion
|
||||
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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
import { ROUTES } from '@lumina/market/app/navigation';
|
||||
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 type { Metadata } from 'next';
|
||||
import { notFound, permanentRedirect } from 'next/navigation';
|
||||
|
||||
import { displayUrl } from '../../../../../../configs';
|
||||
import { i18n } from '../../../../../../i18n';
|
||||
import { PostTemplate } from './templates/post-template';
|
||||
|
||||
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. */
|
||||
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 };
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: PostPageProps): Promise<Metadata> {
|
||||
const { username: segment, id } = await params;
|
||||
const username = toChannelUsername(segment);
|
||||
const page = username ? await readPostPage(username, id) : null;
|
||||
if (!page?.post || page.channel.suspended) {
|
||||
return {
|
||||
title: i18n.t('channel:meta.post-missing-title'),
|
||||
robots: { index: false },
|
||||
};
|
||||
}
|
||||
return postMetadata({
|
||||
channel: page.channel,
|
||||
post: page.post,
|
||||
fallbackTitle: i18n.t('channel:meta.post-title', {
|
||||
username: page.channel.username,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* One post, `/@username/posts/[id]`: where every shared link lands. The server renders it as every
|
||||
* visitor sees it; a subscriber's or the creator's premium post opens in the browser. A deleted
|
||||
* or unknown post keeps the channel's frame and leads back to the channel.
|
||||
*/
|
||||
export default async function PostPage({ params }: PostPageProps) {
|
||||
const { username: segment, id } = await params;
|
||||
const username = toChannelUsername(segment);
|
||||
if (!username) notFound();
|
||||
if (username !== segment) permanentRedirect(ROUTES.post(username, id));
|
||||
const page = await readPostPage(username, id);
|
||||
if (!page) notFound();
|
||||
|
||||
return (
|
||||
<PostTemplate
|
||||
channel={page.channel}
|
||||
post={page.post}
|
||||
channelUrl={displayUrl(ROUTES.channel(username))}
|
||||
now={getRequestTime()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { PartBoundary } from '@lumina/market/app/error-boundaries';
|
||||
import { MobileTopBar } from '@lumina/market/app/navigation';
|
||||
import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions';
|
||||
import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable';
|
||||
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 { PostView } from '@lumina/market/app/screens/(main)/channels/[username]/posts/[id]/organisms/post-view';
|
||||
|
||||
import { i18n } from '../../../../../../../../i18n';
|
||||
import type { PostTemplateProps } from './types';
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
export function PostTemplate({
|
||||
channel,
|
||||
post,
|
||||
channelUrl,
|
||||
now,
|
||||
}: PostTemplateProps) {
|
||||
const t = i18n.getFixedT(null, 'channel');
|
||||
|
||||
return (
|
||||
<>
|
||||
<MobileTopBar
|
||||
title={t('top-bar.post')}
|
||||
previewTitle={i18n.t('content:preview.title')}
|
||||
/>
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1">
|
||||
{channel.suspended ? (
|
||||
<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"
|
||||
/>
|
||||
</PartBoundary>
|
||||
}
|
||||
/>
|
||||
<FlexBox direction="flex-col" className="p-4">
|
||||
<PostView
|
||||
post={post}
|
||||
username={channel.username}
|
||||
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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export { PostTemplate } from './PostTemplate';
|
||||
export type { PostTemplateProps } from './types';
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import type { PublicCreatorPayload } from '@lumina/market/features/channel';
|
||||
import type { PostPayload } from '@lumina/market/features/post';
|
||||
|
||||
export type PostTemplateProps = {
|
||||
channel: PublicCreatorPayload;
|
||||
/** `null`: deleted, unknown, or another channel's. */
|
||||
post: PostPayload | null;
|
||||
/** «lumina.ir/@sara_gold», for the guest's login prompt. */
|
||||
channelUrl: string;
|
||||
/** The render's time: the post's time counts from it. */
|
||||
now: string;
|
||||
};
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { PartBoundary } from '@lumina/market/app/error-boundaries';
|
||||
import { MobileTopBar } from '@lumina/market/app/navigation';
|
||||
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 {
|
||||
ChannelHeader,
|
||||
channelHeaderLabels,
|
||||
} from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header';
|
||||
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 { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable';
|
||||
import { creatorStatsLabels } from '@lumina/market/shared/labels';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
import { i18n } from '../../../../../../i18n';
|
||||
import type { ChannelTemplateProps } from './types';
|
||||
|
||||
/**
|
||||
* The channel on mobile: a page pushed from خانه (the creator's own کانال tab). The header renders
|
||||
* at once; the track record and the feed stream in reading order, each in its own boundary, and
|
||||
* the action area loads in the browser.
|
||||
*/
|
||||
export function ChannelTemplate({
|
||||
channel,
|
||||
channelUrl,
|
||||
now,
|
||||
}: ChannelTemplateProps) {
|
||||
const t = i18n.getFixedT(null, 'channel');
|
||||
|
||||
// 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
|
||||
// for that tab's banner strip and header; the message keeps its own inset.
|
||||
if (channel.suspended) {
|
||||
return (
|
||||
<>
|
||||
<MobileTopBar
|
||||
title={t('top-bar.channel')}
|
||||
tabOwnerId={channel.creatorId}
|
||||
/>
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1">
|
||||
<ChannelUnavailable
|
||||
context="channel"
|
||||
channel={channel}
|
||||
channelUrl={channelUrl}
|
||||
layout="mobile"
|
||||
/>
|
||||
</FlexBox>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<MobileTopBar
|
||||
title={t('top-bar.channel')}
|
||||
tabOwnerId={channel.creatorId}
|
||||
/>
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1">
|
||||
<ChannelHeader
|
||||
channel={channel}
|
||||
channelUrl={channelUrl}
|
||||
layout="mobile"
|
||||
share={
|
||||
<ChannelShare
|
||||
creatorId={channel.creatorId}
|
||||
username={channel.username}
|
||||
channelUrl={channelUrl}
|
||||
layout="mobile"
|
||||
/>
|
||||
}
|
||||
stats={
|
||||
<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="mobile"
|
||||
/>
|
||||
</PartBoundary>
|
||||
}
|
||||
labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))}
|
||||
/>
|
||||
<FlexBox direction="flex-col" className="p-4">
|
||||
<PartBoundary name="channel-feed">
|
||||
<Suspense
|
||||
fallback={
|
||||
<SkeletonPreset
|
||||
preset="post"
|
||||
count={2}
|
||||
label={t('feed.loading')}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<ChannelFeed channel={channel} now={now} layout="mobile" />
|
||||
</Suspense>
|
||||
</PartBoundary>
|
||||
</FlexBox>
|
||||
</FlexBox>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export { ChannelTemplate } from './ChannelTemplate';
|
||||
export type { ChannelTemplateProps } from './types';
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import type { PublicCreatorPayload } from '@lumina/market/features/channel';
|
||||
|
||||
export type ChannelTemplateProps = {
|
||||
channel: PublicCreatorPayload;
|
||||
/** «lumina.ir/@sara_gold». */
|
||||
channelUrl: string;
|
||||
/** The render's time: the posts' relative times count from it. */
|
||||
now: string;
|
||||
};
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
|
||||
import { i18n } from '../../../../../i18n';
|
||||
|
||||
/** The list before it arrives, row for row; the layout keeps the bar and the tabs. */
|
||||
export default function Loading() {
|
||||
return (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="md"
|
||||
delayed
|
||||
label={i18n.t('dashboard:following.loading')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||
import { PartBoundary } from '@lumina/market/app/error-boundaries';
|
||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||
import { FollowingList } from '@lumina/market/app/screens/(main)/dashboard/following/organisms/following-list';
|
||||
import type { Metadata } from 'next';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
import { i18n } from '../../../../../i18n';
|
||||
|
||||
export function generateMetadata(): Metadata {
|
||||
return {
|
||||
title: i18n.t('dashboard:following.meta-title'),
|
||||
robots: { index: false },
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* داشبورد › دنبالشدهها (U8 §۴): the investor's own list, in the browser only, behind rows of the
|
||||
* same size. A failed read shows in place of the list; the bar and the tabs stay (U8 ۴.۵).
|
||||
*/
|
||||
export default function FollowingPage() {
|
||||
const skeleton = (
|
||||
<SkeletonPreset
|
||||
preset="list"
|
||||
cards="md"
|
||||
label={i18n.t('dashboard:following.loading')}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<PartBoundary
|
||||
name="following-list"
|
||||
description={i18n.t('dashboard:following.error')}
|
||||
framed
|
||||
>
|
||||
<AuthGuard role="investor" fallback={skeleton}>
|
||||
<Suspense fallback={skeleton}>
|
||||
<FollowingList layout="mobile" />
|
||||
</Suspense>
|
||||
</AuthGuard>
|
||||
</PartBoundary>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { MobileTopBar } from '@lumina/market/app/navigation';
|
||||
import { DashboardTabs } from '@lumina/market/app/screens/(main)/dashboard/organisms/dashboard-tabs';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
import { i18n } from '../../../../i18n';
|
||||
|
||||
/**
|
||||
* The investor's داشبورد on mobile (U8 ۴.۱; U2): the tab bar «داشبورد», the section row
|
||||
* «اشتراکها» · «تراکنشها» · «دنبالشدهها», then the section. Each section is its own route with
|
||||
* its own loading, so the bar and the row stay while one loads.
|
||||
*/
|
||||
export default function InvestorDashboardLayout({
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<MobileTopBar isTab title={i18n.t('common:nav.dashboard')} />
|
||||
<DashboardTabs layout="mobile" />
|
||||
<FlexBox tag="main" direction="flex-col" className="flex-1 p-4">
|
||||
{children}
|
||||
</FlexBox>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||
import { BottomNav } from '@lumina/market/app/navigation';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
/** The main pages on mobile: each page brings its top bar; the bottom nav is shared. */
|
||||
export default function MainLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||
{children}
|
||||
<BottomNav />
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
export { getQueryClient } from './react-query';
|
||||
export { rootMetadata } from './seo';
|
||||
export { displayUrl } from './site';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
import { clientEnv } from '../env';
|
||||
|
||||
/** A path on this site as people read and type it, without the scheme: «lumina.ir/@sara_gold». */
|
||||
export function displayUrl(path: string): string {
|
||||
return `${new URL(clientEnv.NEXT_PUBLIC_SITE_URL).host}${path}`;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# 0020 Server organisms take their text as labels from the app
|
||||
|
||||
Status: Proposed · Area: architecture · Date: 2026-10-07 · Decided by: agent
|
||||
|
||||
## Context
|
||||
The channel header and the track record are the same for every visitor and should render on the server with no client JavaScript. The platform has no i18n instance of its own; each app owns one, and React context (`useTranslation`) doesn't reach server components.
|
||||
|
||||
## Decision
|
||||
- A platform organism that renders on the server takes its text as a `labels` prop. The app's template builds it with the platform's label builder and its server i18n: `channelHeaderLabels(i18n.getFixedT(null, 'channel'), i18n.getFixedT(null, 'common'))`, `creatorStatsLabels(i18n.getFixedT(null, 'content'))`.
|
||||
- Label builders live beside the organism (`labels.ts`) or, for island organisms several screens use, in `platforms/market/src/shared/labels/`, and take `t` fixed to one namespace, so the same builder works with `useTranslation(ns).t` in client components.
|
||||
- Client organisms keep calling `useTranslation` themselves.
|
||||
|
||||
## Alternatives
|
||||
- Make the organisms client components with `useTranslation`: rejected; CreatorStats and the header would ship and hydrate for nothing.
|
||||
- A platform-owned i18n instance: not chosen; it would duplicate each app's instance.
|
||||
|
||||
## Consequences
|
||||
Templates in both apps pass one labels prop per server organism. Builders return functions, so labels never cross into a client component as props.
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# 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
|
||||
|
||||
## 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.
|
||||
|
||||
## Decision
|
||||
- The server reads the first page (or the post) through its cache and passes it as a prop; the client part's model uses it as the query's `initialData` (`postKeys.channelFeed`, `postKeys.detail`).
|
||||
- The server read carries no session, so premium posts arrive locked. When the viewer is the creator or an active subscriber, the model reads the loaded pages again in the browser and the posts open in place; until then their gates show the pending skeleton.
|
||||
- Mutations update these queries in place (`replaceCachedPost`, `removeCachedPost`); a new post drops the channel's query so its next visit starts from a fresh server page.
|
||||
|
||||
## Alternatives
|
||||
- Query hydration with `HydrationBoundary` (the skill's default for live data): not chosen; it needs the app's query client inside a platform server organism.
|
||||
|
||||
## Consequences
|
||||
A cached feed outlives a later server render of the same channel until it is invalidated, so every action that changes a channel's posts must update or drop `postKeys.channelFeed`.
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# 0022 Post rules live in the API; the composer mirrors them
|
||||
|
||||
Status: Proposed · Area: architecture · Date: 2026-10-07 · Decided by: agent
|
||||
|
||||
## Context
|
||||
C4 and C5 set the composer's rules, and the API had none of them: any caption length, any number and type of images, edits at any time, and publishing by any creator with a complete profile.
|
||||
|
||||
## Decision
|
||||
- The API enforces them (back `POST_LIMITS`): text up to 2000 characters, up to four JPG, PNG or WebP images of 5 MB each, a published post's text, images and access level editable for 15 minutes, and publishing only by an approved creator who isn't suspended. A text post becomes an image post when an image is added, and back when the last is removed; a prediction stays a prediction.
|
||||
- The front mirrors the same numbers in `features/post` `POST_LIMITS` to check before sending, and treats the API's answer as final (a 403 on save means the window closed).
|
||||
|
||||
## Alternatives
|
||||
- Front-only checks: rejected; another client could break the paywall's promise that a post stays as subscribers read it.
|
||||
|
||||
## Consequences
|
||||
Changing a limit is a change in both repos. Existing posts longer than 2000 characters stay as they are; only new writes are checked.
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# 0023 The desktop composer is an intercepted dialog
|
||||
|
||||
Status: Proposed · Area: architecture · Date: 2026-10-07 · Decided by: agent
|
||||
|
||||
## Context
|
||||
C4 ۷.۳ opens «پست جدید» on desktop as a 640px dialog over the page the creator is on, while /compose/post is also a page of its own (a reload, a shared link, a login that returns there). Mobile keeps the pushed page.
|
||||
|
||||
## Decision
|
||||
- bear's `(main)` layout has a `@modal` slot. `@modal/(.)compose/post` intercepts a soft navigation to /compose/post and renders the composer in island `Modal size="wide"`; a hard load gets the `(flow)` full page. The edit route is not intercepted.
|
||||
- The slot is emptied by explicit null pages for the routes the dialog lands on (`@modal/channels/[username]`), never by a catch-all: a catch-all would match every unbuilt path, and a soft navigation there keeps the old page under the new URL.
|
||||
- `(main)/default.tsx` reloads the URL when the intercept fires from outside `(main)` (the full composer's header, a login that returns there), so the full page takes over instead of a dialog over an empty frame.
|
||||
- Closing the dialog goes back in history. Publishing over the creator's own channel also goes back, then refreshes, so the channel isn't in history twice; anywhere else it replaces the dialog's entry with the channel and refreshes. The refresh is needed because the channel under the dialog is reused, not fetched again.
|
||||
|
||||
## Alternatives
|
||||
- Dialog state without a route: rejected; the URL would not say what is open, and the composer's deep link would need a second code path.
|
||||
- A `[...catchAll]` slot page: rejected for the reason above.
|
||||
|
||||
## Consequences
|
||||
Every new route the dialog can land on needs its own null `@modal` page. While the dialog is open `usePathname()` reads /compose/post, so the page under it sees that path.
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# 0024 خانه is the investor's feed, read in the browser
|
||||
|
||||
Status: Proposed · Area: architecture · Date: 2026-10-07 · Decided by: agent
|
||||
|
||||
## Context
|
||||
`/` (خانه) is drawn for investors only: their followed creators' posts, premium ones open when subscribed. A creator's home tab is their own channel, no board draws a guest's home, and the API answers 401 to a guest and 403 to a creator. Every link home (the brand, back with no history, «بازگشت به خانه», login with no return path) lands there.
|
||||
|
||||
## Decision
|
||||
- The server sends only the frame (top bar or header, «خانه») and the feed's skeleton, the same for every visitor; the feed is read in the browser with the session (`feedKeys.home()`, no server read and no `initialData`, unlike 0021), so nothing is read again for a subscriber.
|
||||
- In the browser, `HomeGuard` sends a guest to login with a return to `/`, a creator to their channel with `router.replace` (to step 5 first while `needsProfile`), and any other role to the no-access state; the skeleton stays until then.
|
||||
- Page and loading sit in `(main)/(home)`, so its loading covers no other main route (0017); bear's `@modal/page.tsx` is the null page for `/` (0023).
|
||||
|
||||
## Alternatives
|
||||
- A server read like the channel's (0021): rejected; the feed exists only for a signed-in investor.
|
||||
- AuthGuard's no-access state for a creator: rejected; its «بازگشت به خانه» leads back to `/`.
|
||||
|
||||
## Consequences
|
||||
- `/` is not indexed. A guest's «بازگشت به خانه» (error pages, a missing channel) lands on login.
|
||||
- Follows change the feed: every follow or unfollow calls `syncFollowCaches`, which invalidates `feedKeys.all`.
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# 0025 The investor's dashboard is a tabbed section, one route per tab
|
||||
|
||||
Status: Proposed · Area: architecture · Date: 2026-10-07 · Decided by: agent
|
||||
|
||||
## Context
|
||||
U8 ۴.۱, ۶.۱ and U2 draw the investor's داشبورد as three sections («اشتراکها» · «تراکنشها» · «دنبالشدهها») under one 48px tab row, which stays live while a section loads; S1 makes each section its own Suspense. The creator's داشبورد (pricing, finance) has other tabs and lives under the same `/dashboard` path.
|
||||
|
||||
## Decision
|
||||
- Each section is its own route (`ROUTES.dashboard.subscriptions`, `.transactions`, `.following`), so a section can be linked, reloaded and loaded on its own.
|
||||
- The sections sit in the route group `dashboard/(investor)`. Its layout holds the frame: on mobile the tab top bar «داشبورد», on desktop the «داشبورد» heading in the 640 column, then `DashboardTabs` (island `TabLinks`, active from the URL). Each section page brings its own `loading.tsx` with the list skeleton only.
|
||||
- A section renders in the browser behind `AuthGuard role="investor"` and its part boundary; the frame and the tabs render on the server for every visitor.
|
||||
|
||||
## Alternatives
|
||||
- One page with tab state: rejected; the URL would not say which section is open, and every section's code would load with the first.
|
||||
- Tabs inside each page: rejected; the row would unmount on every switch, and each loading would repeat it.
|
||||
|
||||
## Consequences
|
||||
- A creator who opens an investor section sees the tabs over the no-access state.
|
||||
- The subscriptions and transactions tabs link to routes that are still placeholders (`(investor)/subscriptions`, `(investor)/transactions`); they 404 until built.
|
||||
|
|
@ -22,3 +22,9 @@
|
|||
- 0015 architecture: Serve a login or onboarding view whose frame differs from its step on its own route (`/auth/login/suspended`, `/onboarding/creator-profile/done`); browser-only data stays in memory.
|
||||
- 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.
|
||||
- 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`.
|
||||
- 0023 architecture: On desktop «پست جدید» is a dialog over the page through bear's `@modal` intercept of /compose/post; slots are emptied by explicit null pages, never a catch-all, and a hard load gets the full page.
|
||||
- 0024 architecture: `/` (خانه) is the investor's feed, read only in the browser with the session behind a same-size skeleton; a guest goes to login with a return to `/`, a creator to their own channel.
|
||||
- 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.
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export function Avatar({
|
|||
src,
|
||||
size = 'md',
|
||||
verified = false,
|
||||
muted = false,
|
||||
verifiedLabel,
|
||||
label,
|
||||
className,
|
||||
|
|
@ -36,7 +37,7 @@ export function Avatar({
|
|||
aria-hidden={label ? undefined : true}
|
||||
justifyItems="justify-items-center"
|
||||
alignItems="items-center"
|
||||
className={avatarVariants({ size })}
|
||||
className={avatarVariants({ size, muted })}
|
||||
>
|
||||
<Typography
|
||||
tag="span"
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ export type AvatarProps = Omit<ComponentPropsWithRef<'span'>, 'children'> & {
|
|||
size?: AvatarSize;
|
||||
/** The creator's verification mark at the bottom inline end. */
|
||||
verified?: boolean;
|
||||
/** Greyed: an account that can't be used now (a suspended creator's own channel). */
|
||||
muted?: boolean;
|
||||
/** The mark's accessible name, such as «تأییدشده». */
|
||||
verifiedLabel?: string;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,7 +17,12 @@ export const avatarVariants = cva(
|
|||
/** The profile photo field. */
|
||||
'2xl': 'size-24',
|
||||
},
|
||||
/** An account that can't be used, such as a suspended creator's own avatar: no brand colour. */
|
||||
muted: {
|
||||
true: 'bg-surface-sunken text-text-secondary grayscale',
|
||||
false: '',
|
||||
},
|
||||
},
|
||||
defaultVariants: { size: 'md' },
|
||||
defaultVariants: { size: 'md', muted: false },
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ export function Button({
|
|||
label,
|
||||
frozen = false,
|
||||
frozenReason,
|
||||
frozenAlign,
|
||||
pressableWhenFrozen = false,
|
||||
isLoading = false,
|
||||
className,
|
||||
children,
|
||||
|
|
@ -68,6 +70,7 @@ export function Button({
|
|||
{...buttonProps}
|
||||
reason={frozenReason}
|
||||
block={block}
|
||||
align={frozenAlign}
|
||||
className={classes}
|
||||
aria-label={ariaLabel}
|
||||
>
|
||||
|
|
@ -80,10 +83,11 @@ export function Button({
|
|||
// blocked, swallows the click: preventDefault also stops a submit button's form, including Enter
|
||||
// in a field. A server render can't carry a handler, so a blocked button without onClick renders
|
||||
// `type="button"` instead, which can't submit its form at all.
|
||||
const swallowsClick = isLoading || (frozen && !pressableWhenFrozen);
|
||||
const handleClick =
|
||||
onClick &&
|
||||
((event: MouseEvent<HTMLButtonElement>) => {
|
||||
if (isBlocked) {
|
||||
if (swallowsClick) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import { frozenTipVariants } from '../variants';
|
|||
export function FrozenButton({
|
||||
reason,
|
||||
block,
|
||||
align,
|
||||
children,
|
||||
...props
|
||||
}: FrozenButtonProps) {
|
||||
|
|
@ -45,7 +46,7 @@ export function FrozenButton({
|
|||
role="tooltip"
|
||||
variant="caption"
|
||||
color="inverse"
|
||||
className={frozenTipVariants({ open: isOpen })}
|
||||
className={frozenTipVariants({ open: isOpen, align })}
|
||||
>
|
||||
{reason}
|
||||
</Typography>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ import type NextLink from 'next/link';
|
|||
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
||||
|
||||
import type { IconName } from '../icon';
|
||||
import type { buttonVariants } from './variants';
|
||||
import type { buttonVariants, frozenTipVariants } from './variants';
|
||||
|
||||
type FrozenTipAlign = VariantProps<typeof frozenTipVariants>['align'];
|
||||
|
||||
type ButtonOwnProps = Pick<
|
||||
VariantProps<typeof buttonVariants>,
|
||||
|
|
@ -18,6 +20,16 @@ type ButtonOwnProps = Pick<
|
|||
frozen?: boolean;
|
||||
/** Why the button is frozen, shown on tap, hover and focus. */
|
||||
frozenReason?: ReactNode;
|
||||
/**
|
||||
* Frozen without a reason, yet a press still calls `onClick`, which explains or checks instead:
|
||||
* a publish menu that opens why it can't publish, an empty post's check.
|
||||
*/
|
||||
pressableWhenFrozen?: boolean;
|
||||
/**
|
||||
* Where the reason sits above the button: centred (default), or `end`, its end on the button's,
|
||||
* for a button at the screen's end edge, so a long reason stays on screen.
|
||||
*/
|
||||
frozenAlign?: FrozenTipAlign;
|
||||
/** An action is in flight: keeps the label, shows a spinner, and blocks repeat taps. */
|
||||
isLoading?: boolean;
|
||||
children?: ReactNode;
|
||||
|
|
@ -57,5 +69,6 @@ export type FrozenButtonProps = Omit<
|
|||
> & {
|
||||
reason: ReactNode;
|
||||
block?: boolean | null;
|
||||
align?: FrozenTipAlign;
|
||||
children: ReactNode;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -48,14 +48,19 @@ export const buttonVariants = cva(
|
|||
},
|
||||
);
|
||||
|
||||
/** The tooltip that explains a frozen button, above it and centred on it. */
|
||||
/** The tooltip that explains a frozen button, above it. */
|
||||
export const frozenTipVariants = cva(
|
||||
// Physical left: centring is the same in RTL and LTR.
|
||||
'pointer-events-none absolute bottom-[calc(100%+0.5rem)] left-1/2 z-menu hidden w-max max-w-[16.25rem] -translate-x-1/2 rounded-sm bg-surface-inverse px-3 py-1.5 text-center whitespace-normal shadow-2 group-focus-within:block group-hover:block',
|
||||
'pointer-events-none absolute bottom-[calc(100%+0.5rem)] z-menu hidden w-max max-w-[16.25rem] rounded-sm bg-surface-inverse px-3 py-1.5 text-center whitespace-normal shadow-2 group-focus-within:block group-hover:block',
|
||||
{
|
||||
variants: {
|
||||
open: { true: 'block', false: '' },
|
||||
align: {
|
||||
// Physical left: centring is the same in RTL and LTR.
|
||||
center: 'left-1/2 -translate-x-1/2',
|
||||
// Its end on the button's end, so it grows toward the screen from a button at the edge.
|
||||
end: 'end-0',
|
||||
},
|
||||
},
|
||||
defaultVariants: { open: false },
|
||||
defaultVariants: { open: false, align: 'center' },
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ export { Banner, bannerVariants } from './molecules/banner';
|
|||
export type { BannerProps, BannerTone } from './molecules/banner';
|
||||
export { Card, cardVariants } from './molecules/card';
|
||||
export type { CardOwnProps, CardProps } from './molecules/card';
|
||||
export { ActionMenu } from './molecules/action-menu';
|
||||
export type { ActionMenuItem, ActionMenuProps } from './molecules/action-menu';
|
||||
export { ChipGroup } from './molecules/chip-group';
|
||||
export type { ChipGroupOption, ChipGroupProps } from './molecules/chip-group';
|
||||
export { ChoiceCard, choiceCardVariants } from './molecules/choice-card';
|
||||
|
|
@ -122,7 +124,7 @@ export type { LockedTeaserProps } from './molecules/locked-teaser';
|
|||
export { MediaCarousel } from './molecules/media-carousel';
|
||||
export type { MediaCarouselProps, MediaItem } from './molecules/media-carousel';
|
||||
export { Modal } from './molecules/modal';
|
||||
export type { ModalProps } from './molecules/modal';
|
||||
export type { ModalProps, ModalSize } from './molecules/modal';
|
||||
export {
|
||||
NetworkStatus,
|
||||
networkStatusVariants,
|
||||
|
|
@ -139,6 +141,17 @@ export type {
|
|||
ResendCodeProps,
|
||||
ResendStatus,
|
||||
} from './molecules/resend-code';
|
||||
export {
|
||||
SegmentedChoice,
|
||||
segmentedChoiceOptionVariants,
|
||||
segmentedChoiceVariants,
|
||||
} from './molecules/segmented-choice';
|
||||
export type {
|
||||
SegmentedChoiceOption,
|
||||
SegmentedChoiceProps,
|
||||
SegmentedChoiceSize,
|
||||
SegmentedChoiceTrack,
|
||||
} from './molecules/segmented-choice';
|
||||
export { Sheet } from './molecules/sheet';
|
||||
export type { SheetPlacement, SheetProps } from './molecules/sheet';
|
||||
export { StateMessage, stateMessageVariants } from './molecules/state-message';
|
||||
|
|
@ -148,6 +161,8 @@ export type {
|
|||
} from './molecules/state-message';
|
||||
export { StepProgress } from './molecules/step-progress';
|
||||
export type { StepProgressProps } from './molecules/step-progress';
|
||||
export { TabLinks } from './molecules/tab-links';
|
||||
export type { TabLinkItem, TabLinksProps } from './molecules/tab-links';
|
||||
export {
|
||||
TextInput,
|
||||
textInputBoxVariants,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
'use client';
|
||||
|
||||
import { useEffect, useEffectEvent, useRef } from 'react';
|
||||
import type { KeyboardEvent } from 'react';
|
||||
|
||||
import { Element } from '../../primitives/element';
|
||||
import { cn } from '../../tools/cn';
|
||||
import { ActionMenuItem } from './components/ActionMenuItem';
|
||||
import type { ActionMenuProps } from './types';
|
||||
import { actionMenuVariants } from './variants';
|
||||
|
||||
/**
|
||||
* A short list of destinations or actions anchored to its trigger, such as «انتشار» → «پست جدید»
|
||||
* / «پیشبینی جدید», or a post's share → «کپی لینک». Put it in a positioned container that holds
|
||||
* only the trigger and the menu, and give the trigger `aria-haspopup="menu"`. It takes focus when
|
||||
* it opens; ↑ ↓ move, and the trigger keeps its own press. Escape or a choice closes it and puts
|
||||
* focus back on that container's `[aria-haspopup]` trigger; a press outside, or Tab out of the
|
||||
* menu and its trigger, closes it and leaves focus where the press or Tab put it.
|
||||
*/
|
||||
export function ActionMenu({
|
||||
open,
|
||||
onClose,
|
||||
items,
|
||||
label,
|
||||
placement = 'below',
|
||||
className,
|
||||
}: ActionMenuProps) {
|
||||
const ref = useRef<HTMLUListElement>(null);
|
||||
const close = useEffectEvent(onClose);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return undefined;
|
||||
// The trigger's container: the menu and its trigger, nothing else.
|
||||
const area = ref.current?.parentElement ?? ref.current;
|
||||
if (!area) return undefined;
|
||||
ref.current?.querySelector<HTMLElement>('[role="menuitem"]')?.focus();
|
||||
const handlePointerDown = (event: PointerEvent) => {
|
||||
if (!area.contains(event.target as Node)) close();
|
||||
};
|
||||
// Tab out of it closes it; focus has already moved on, so it stays there. A null target
|
||||
// (another window, a press on nothing focusable) keeps it open.
|
||||
const handleFocusOut = (event: FocusEvent) => {
|
||||
const next = event.relatedTarget;
|
||||
if (next instanceof Node && !area.contains(next)) close();
|
||||
};
|
||||
document.addEventListener('pointerdown', handlePointerDown);
|
||||
area.addEventListener('focusout', handleFocusOut);
|
||||
return () => {
|
||||
document.removeEventListener('pointerdown', handlePointerDown);
|
||||
area.removeEventListener('focusout', handleFocusOut);
|
||||
};
|
||||
}, [open]);
|
||||
|
||||
if (!open) return null;
|
||||
|
||||
// Read on the event, before the menu unmounts; focusing the trigger keeps the keyboard in place.
|
||||
const closeToTrigger = () => {
|
||||
const trigger =
|
||||
ref.current?.parentElement?.querySelector<HTMLElement>('[aria-haspopup]');
|
||||
onClose();
|
||||
trigger?.focus();
|
||||
};
|
||||
|
||||
const onKeyDown = (event: KeyboardEvent<HTMLUListElement>) => {
|
||||
const options = Array.from(
|
||||
ref.current?.querySelectorAll<HTMLElement>('[role="menuitem"]') ?? [],
|
||||
);
|
||||
const at = options.indexOf(document.activeElement as HTMLElement);
|
||||
if (event.key === 'Escape') {
|
||||
event.preventDefault();
|
||||
closeToTrigger();
|
||||
} else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
||||
event.preventDefault();
|
||||
const step = event.key === 'ArrowDown' ? 1 : -1;
|
||||
options[(at + step + options.length) % options.length]?.focus();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Element
|
||||
ref={ref}
|
||||
tag="ul"
|
||||
role="menu"
|
||||
aria-label={label}
|
||||
onKeyDown={onKeyDown}
|
||||
className={cn(actionMenuVariants({ placement }), className)}
|
||||
>
|
||||
{items.map((item) => (
|
||||
<ActionMenuItem
|
||||
key={item.href ?? item.label}
|
||||
{...item}
|
||||
onClose={closeToTrigger}
|
||||
/>
|
||||
))}
|
||||
</Element>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
import NextLink from 'next/link';
|
||||
|
||||
import { FlexBox } from '../../../atoms/flex-box';
|
||||
import { Icon } from '../../../atoms/icon';
|
||||
import { Typography } from '../../../atoms/typography';
|
||||
import { Element } from '../../../primitives/element';
|
||||
import { cn } from '../../../tools/cn';
|
||||
import type { ActionMenuItemProps } from '../types';
|
||||
|
||||
/** A link row and a button row look the same. */
|
||||
const ROW_CLASS =
|
||||
'min-h-touch-target rounded-md px-3 text-text-primary no-underline outline-none hover:bg-surface-sunken focus-visible:bg-surface-sunken focus-visible:focus-ring';
|
||||
|
||||
/**
|
||||
* One destination or action: its icon in the brand colour and its name, a 44px row. A link
|
||||
* navigates; a button closes the menu, then runs its `onSelect`.
|
||||
*/
|
||||
export function ActionMenuItem({
|
||||
href,
|
||||
label,
|
||||
icon,
|
||||
onSelect,
|
||||
onClose,
|
||||
}: ActionMenuItemProps) {
|
||||
const content = (
|
||||
<>
|
||||
<Icon
|
||||
name={icon}
|
||||
size={20}
|
||||
className="flex-none text-action-primary-text"
|
||||
/>
|
||||
<Typography tag="span" color="inherit" className="font-semibold">
|
||||
{label}
|
||||
</Typography>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<Element tag="li" role="none">
|
||||
{href != null ? (
|
||||
<FlexBox
|
||||
tag={NextLink}
|
||||
href={href}
|
||||
role="menuitem"
|
||||
onClick={onClose}
|
||||
alignItems="items-center"
|
||||
gap="gap-3"
|
||||
className={ROW_CLASS}
|
||||
>
|
||||
{content}
|
||||
</FlexBox>
|
||||
) : (
|
||||
<FlexBox
|
||||
tag="button"
|
||||
type="button"
|
||||
role="menuitem"
|
||||
onClick={() => {
|
||||
onClose();
|
||||
onSelect?.();
|
||||
}}
|
||||
alignItems="items-center"
|
||||
gap="gap-3"
|
||||
className={cn(ROW_CLASS, 'w-full cursor-pointer text-start')}
|
||||
>
|
||||
{content}
|
||||
</FlexBox>
|
||||
)}
|
||||
</Element>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export { ActionMenu } from './ActionMenu';
|
||||
export type { ActionMenuItem, ActionMenuProps } from './types';
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
import type { IconName } from '../../atoms/icon';
|
||||
|
||||
/** A destination (`href`, a link) or an action (`onSelect`, a button), never both. */
|
||||
export type ActionMenuItem = {
|
||||
label: string;
|
||||
icon: IconName;
|
||||
} & (
|
||||
| { href: string; onSelect?: never }
|
||||
| {
|
||||
/** Runs after the menu has closed, such as «کپی لینک». */
|
||||
onSelect: () => void;
|
||||
href?: never;
|
||||
}
|
||||
);
|
||||
|
||||
export type ActionMenuProps = {
|
||||
open: boolean;
|
||||
/** Escape, a press or Tab outside the menu and its trigger, or a choice close it. */
|
||||
onClose: () => void;
|
||||
items: readonly ActionMenuItem[];
|
||||
/** The menu's accessible name, such as «انتشار». */
|
||||
label: string;
|
||||
/** above: over a bottom-nav button. below: under a header button. */
|
||||
placement?: 'above' | 'below';
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export type ActionMenuItemProps = ActionMenuItem & {
|
||||
/** The menu's close, which also returns focus to the trigger. */
|
||||
onClose: () => void;
|
||||
};
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import { cva } from 'class-variance-authority';
|
||||
|
||||
/** A card that hangs off its trigger: centred over it, or under it at the inline end. */
|
||||
export const actionMenuVariants = cva(
|
||||
'absolute z-menu m-0 min-w-55 rounded-lg border border-border-subtle bg-surface-raised p-1 shadow-2',
|
||||
{
|
||||
variants: {
|
||||
placement: {
|
||||
above: 'bottom-full left-1/2 mb-3 -translate-x-1/2',
|
||||
below: 'end-0 top-full mt-2',
|
||||
},
|
||||
},
|
||||
defaultVariants: { placement: 'below' },
|
||||
},
|
||||
);
|
||||
|
|
@ -4,17 +4,19 @@ import { Button } from '../../atoms/button';
|
|||
import { FlexBox } from '../../atoms/flex-box';
|
||||
import { GridBox } from '../../atoms/grid-box';
|
||||
import { Icon } from '../../atoms/icon';
|
||||
import { Skeleton } from '../../atoms/skeleton';
|
||||
import { Tag } from '../../atoms/tag';
|
||||
import { Typography } from '../../atoms/typography';
|
||||
import { Element } from '../../primitives/element';
|
||||
import { ACTION_CLASS } from './constants';
|
||||
import { ACTION_CLASS, PENDING_ACTION_CLASS } from './constants';
|
||||
import type { LockedTeaserProps } from './types';
|
||||
|
||||
/**
|
||||
* The one locked premium body, on the channel, the post page and the feed alike: two lines of
|
||||
* preview fading into a saffron lock, a lock placeholder for the images, a prediction's frame,
|
||||
* then one message and one CTA on `premium-subtle`. Images are never shown or blurred, not even
|
||||
* from a blurHash: a blurred chart still leaks the direction.
|
||||
* from a blurHash: a blurred chart still leaks the direction. While the viewer is unknown
|
||||
* (`pending`), the gate keeps the message's place and draws the CTA as a skeleton.
|
||||
*/
|
||||
export function LockedTeaser({
|
||||
preview,
|
||||
|
|
@ -26,6 +28,9 @@ export function LockedTeaser({
|
|||
actionLabel,
|
||||
actionHref,
|
||||
onAction,
|
||||
actionFrozenReason,
|
||||
actionIndicator,
|
||||
pending = false,
|
||||
className,
|
||||
}: LockedTeaserProps) {
|
||||
return (
|
||||
|
|
@ -76,8 +81,41 @@ export function LockedTeaser({
|
|||
gap="gap-3"
|
||||
className="rounded-md bg-premium-subtle p-4 text-center"
|
||||
>
|
||||
<Typography>{message}</Typography>
|
||||
{actionHref ? (
|
||||
{pending ? (
|
||||
<>
|
||||
{/* The message's own height, so the gate doesn't move when the viewer is known. */}
|
||||
<Element className="relative self-stretch" aria-hidden>
|
||||
<Typography className="invisible">{message}</Typography>
|
||||
<FlexBox
|
||||
alignItems="items-center"
|
||||
justifyContent="justify-center"
|
||||
className="absolute inset-0"
|
||||
>
|
||||
<Skeleton width="70%" />
|
||||
</FlexBox>
|
||||
</Element>
|
||||
<Skeleton shape="pill" className={PENDING_ACTION_CLASS} />
|
||||
</>
|
||||
) : actionIndicator ? (
|
||||
<Button
|
||||
variant="secondary"
|
||||
icon={actionIndicator.icon}
|
||||
frozen
|
||||
frozenReason={actionIndicator.reason}
|
||||
className={ACTION_CLASS}
|
||||
>
|
||||
{actionIndicator.label}
|
||||
</Button>
|
||||
) : actionFrozenReason ? (
|
||||
<Button
|
||||
variant="primary"
|
||||
frozen
|
||||
frozenReason={actionFrozenReason}
|
||||
className={ACTION_CLASS}
|
||||
>
|
||||
{actionLabel}
|
||||
</Button>
|
||||
) : actionHref ? (
|
||||
<Button variant="primary" href={actionHref} className={ACTION_CLASS}>
|
||||
{actionLabel}
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,5 @@
|
|||
/** Puts the CTA above a card's stretched link (PostCard's), so it keeps its own tap. */
|
||||
export const ACTION_CLASS = 'relative z-1';
|
||||
|
||||
/** The CTA's skeleton: a Button md's height and about its width. */
|
||||
export const PENDING_ACTION_CLASS = 'h-control-md w-34';
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
export { LockedTeaser } from './LockedTeaser';
|
||||
export type { LockedTeaserProps } from './types';
|
||||
export type { LockedTeaserIndicator, LockedTeaserProps } from './types';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
import type { ReactNode } from 'react';
|
||||
|
||||
import type { IconName } from '../../atoms/icon';
|
||||
|
||||
/** A frozen status in the CTA's place, such as «پرداخت در حال بررسی», and why it can't be pressed. */
|
||||
export type LockedTeaserIndicator = {
|
||||
label: ReactNode;
|
||||
reason: ReactNode;
|
||||
icon?: IconName;
|
||||
};
|
||||
|
||||
export type LockedTeaserProps = {
|
||||
/** `captionPreview` from the API. Clamped to 2 lines, a hard limit so no analysis leaks. */
|
||||
preview?: ReactNode;
|
||||
|
|
@ -22,5 +31,14 @@ export type LockedTeaserProps = {
|
|||
actionHref?: string;
|
||||
/** Instead of `actionHref`, such as opening the auth sheet. Client callers only. */
|
||||
onAction?: () => void;
|
||||
/** The CTA shows but does nothing, and says why: the creator previewing their own post. */
|
||||
actionFrozenReason?: ReactNode;
|
||||
/** Replaces the CTA with a frozen status, such as a payment waiting for the bank. */
|
||||
actionIndicator?: LockedTeaserIndicator;
|
||||
/**
|
||||
* The viewer isn't known yet (the server render and the first browser render): the message keeps
|
||||
* its place unseen and the CTA is a skeleton, so a guest never sees a member's CTA or the reverse.
|
||||
*/
|
||||
pending?: boolean;
|
||||
className?: string;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,11 +7,15 @@ import { Dialog } from '../../atoms/dialog';
|
|||
import { Element } from '../../primitives/element';
|
||||
import { cn } from '../../tools/cn';
|
||||
import type { ModalProps } from './types';
|
||||
import { modalPanelVariants } from './variants';
|
||||
|
||||
/**
|
||||
* A centred dialog for short, blocking decisions on desktop, at most 420px wide. On mobile the
|
||||
* same content is always a bottom Sheet, never a Modal. The panel takes focus when it opens, and
|
||||
* focus returns to the trigger when it closes.
|
||||
*
|
||||
* `size="wide"` is the desktop form dialog (C4 ۷.۳, «پست جدید»): 640px, a header row with the
|
||||
* title and `headerAction`, then the caller's body and footer bar, edge to edge.
|
||||
*/
|
||||
export function Modal({
|
||||
open,
|
||||
|
|
@ -19,6 +23,8 @@ export function Modal({
|
|||
children,
|
||||
actions,
|
||||
icon,
|
||||
size = 'default',
|
||||
headerAction,
|
||||
onClose,
|
||||
onExited,
|
||||
closeLabel,
|
||||
|
|
@ -38,44 +44,68 @@ export function Modal({
|
|||
labelledBy={titleId}
|
||||
className="items-center justify-center p-4"
|
||||
>
|
||||
<Element
|
||||
data-dialog-panel=""
|
||||
tabIndex={-1}
|
||||
className={cn(
|
||||
'relative max-h-full w-full max-w-105 overflow-auto rounded-xl bg-surface px-5 pt-6 pb-5 shadow-3 outline-none transition-[opacity,scale] duration-200 ease-standard starting:scale-95 starting:opacity-0 group-data-closing/dialog:scale-95 group-data-closing/dialog:opacity-0',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{closeLabel && dismissible && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
icon="close"
|
||||
label={closeLabel}
|
||||
onClick={onClose}
|
||||
className="absolute end-2 top-2"
|
||||
/>
|
||||
)}
|
||||
{icon && <Element className="mb-3">{icon}</Element>}
|
||||
<Typography
|
||||
tag="h2"
|
||||
id={titleId}
|
||||
variant="heading-sm"
|
||||
className="mb-2 pe-10"
|
||||
{size === 'wide' ? (
|
||||
<FlexBox
|
||||
data-dialog-panel=""
|
||||
tabIndex={-1}
|
||||
direction="flex-col"
|
||||
className={cn(modalPanelVariants({ size }), className)}
|
||||
>
|
||||
{title}
|
||||
</Typography>
|
||||
{children != null && (
|
||||
// Plain text reads as body-md; paragraphs keep space-3 between them.
|
||||
<Typography tag="div" variant="body-md" className="[&>p]:mb-3">
|
||||
{children}
|
||||
</Typography>
|
||||
)}
|
||||
{actions && (
|
||||
<FlexBox direction="flex-col" gap="gap-2" className="mt-6">
|
||||
{actions}
|
||||
<FlexBox
|
||||
tag="header"
|
||||
alignItems="items-center"
|
||||
gap="gap-3"
|
||||
className="flex-none border-b border-border-subtle py-2.5 ps-6 pe-4"
|
||||
>
|
||||
<Typography
|
||||
tag="h2"
|
||||
id={titleId}
|
||||
variant="heading-sm"
|
||||
className="min-w-0 flex-1"
|
||||
>
|
||||
{title}
|
||||
</Typography>
|
||||
{headerAction}
|
||||
</FlexBox>
|
||||
)}
|
||||
</Element>
|
||||
{children}
|
||||
</FlexBox>
|
||||
) : (
|
||||
<Element
|
||||
data-dialog-panel=""
|
||||
tabIndex={-1}
|
||||
className={cn(modalPanelVariants({ size }), className)}
|
||||
>
|
||||
{closeLabel && dismissible && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
icon="close"
|
||||
label={closeLabel}
|
||||
onClick={onClose}
|
||||
className="absolute end-2 top-2"
|
||||
/>
|
||||
)}
|
||||
{icon && <Element className="mb-3">{icon}</Element>}
|
||||
<Typography
|
||||
tag="h2"
|
||||
id={titleId}
|
||||
variant="heading-sm"
|
||||
className="mb-2 pe-10"
|
||||
>
|
||||
{title}
|
||||
</Typography>
|
||||
{children != null && (
|
||||
// Plain text reads as body-md; paragraphs keep space-3 between them.
|
||||
<Typography tag="div" variant="body-md" className="[&>p]:mb-3">
|
||||
{children}
|
||||
</Typography>
|
||||
)}
|
||||
{actions && (
|
||||
<FlexBox direction="flex-col" gap="gap-2" className="mt-6">
|
||||
{actions}
|
||||
</FlexBox>
|
||||
)}
|
||||
</Element>
|
||||
)}
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
export { Modal } from './Modal';
|
||||
export type { ModalProps } from './types';
|
||||
export type { ModalProps, ModalSize } from './types';
|
||||
|
|
|
|||
|
|
@ -1,19 +1,38 @@
|
|||
import type { ReactNode } from 'react';
|
||||
|
||||
/** default: a short decision at 420px. wide: a desktop form at the 640px column (C4 ۷.۳). */
|
||||
export type ModalSize = 'default' | 'wide';
|
||||
|
||||
export type ModalProps = {
|
||||
open: boolean;
|
||||
title: ReactNode;
|
||||
/** The body. */
|
||||
/**
|
||||
* The body. default: in body-md under the title. wide: edge to edge with no padding; lay out
|
||||
* the scrolling body and the footer bar yourself (a `min-h-0` flex column, so the body scrolls).
|
||||
*/
|
||||
children?: ReactNode;
|
||||
/** Buttons, stacked full-width: primary (or danger-solid) first, the cancel under it. */
|
||||
/**
|
||||
* Buttons, stacked full-width: primary (or danger-solid) first, the cancel under it. Not in
|
||||
* wide, whose form draws its own footer bar.
|
||||
*/
|
||||
actions?: ReactNode;
|
||||
/** Art above the title, such as a StateArt. */
|
||||
/** Art above the title, such as a StateArt. Not in wide. */
|
||||
icon?: ReactNode;
|
||||
/**
|
||||
* wide: a header row with the title at its start and `headerAction` at its end, over a hairline,
|
||||
* and only `children` under it; `icon`, `actions` and the ✕ are not used.
|
||||
*/
|
||||
size?: ModalSize;
|
||||
/** wide only: the header row's end, such as a ghost «انصراف». */
|
||||
headerAction?: ReactNode;
|
||||
/** Escape and the scrim call it, unless `dismissible` is false. */
|
||||
onClose?: () => void;
|
||||
/** The modal has closed and focus is back on the page. */
|
||||
onExited?: () => void;
|
||||
/** The ✕'s accessible name, such as «بستن». Shows the ✕; omit it when there is a cancel button. */
|
||||
/**
|
||||
* The ✕'s accessible name, such as «بستن». Shows the ✕; omit it when there is a cancel button.
|
||||
* Not in wide: its cancel is `headerAction`.
|
||||
*/
|
||||
closeLabel?: string;
|
||||
/** false: no ✕, and Escape and the scrim do nothing, such as «در حال تأیید پرداخت...». */
|
||||
dismissible?: boolean;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import { cva } from 'class-variance-authority';
|
||||
|
||||
/** The panel in the centred layer: it scales in, and scrolls inside when it outgrows the screen. */
|
||||
export const modalPanelVariants = cva(
|
||||
'relative max-h-full w-full rounded-xl bg-surface shadow-3 outline-none transition-[opacity,scale] duration-200 ease-standard starting:scale-95 starting:opacity-0 group-data-closing/dialog:scale-95 group-data-closing/dialog:opacity-0',
|
||||
{
|
||||
variants: {
|
||||
size: {
|
||||
default: 'max-w-105 overflow-auto px-5 pt-6 pb-5',
|
||||
/** C4 ۷.۳: no padding, so the header row and the caller's footer bar reach the edges. */
|
||||
wide: 'max-w-content overflow-hidden',
|
||||
},
|
||||
},
|
||||
defaultVariants: { size: 'default' },
|
||||
},
|
||||
);
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
import { useId } from 'react';
|
||||
|
||||
import { FlexBox } from '../../atoms/flex-box';
|
||||
import { Icon } from '../../atoms/icon';
|
||||
import { Typography } from '../../atoms/typography';
|
||||
import { Element } from '../../primitives/element';
|
||||
import { cn } from '../../tools/cn';
|
||||
import type { SegmentedChoiceProps } from './types';
|
||||
import {
|
||||
segmentedChoiceOptionVariants,
|
||||
segmentedChoiceVariants,
|
||||
} from './variants';
|
||||
|
||||
/**
|
||||
* A one-of choice as chips on a pill track, such as a post's «رایگان» / «پریمیوم» (C4 ۷.۳, C5 ۱.۱,
|
||||
* ۱.۵, ۱.۶, ۱.۷, ۷.۱). A named radiogroup fieldset of real radios, so Tab reaches the chosen one,
|
||||
* the arrow keys pick, and disabling the fieldset disables them all. A chosen option fills brand
|
||||
* with no check.
|
||||
*/
|
||||
export function SegmentedChoice<T extends string>({
|
||||
options,
|
||||
value,
|
||||
onChange,
|
||||
label,
|
||||
size = 'md',
|
||||
track = 'sunken',
|
||||
disabled = false,
|
||||
frozen = false,
|
||||
className,
|
||||
}: SegmentedChoiceProps<T>) {
|
||||
const name = useId();
|
||||
|
||||
return (
|
||||
<FlexBox
|
||||
tag="fieldset"
|
||||
role="radiogroup"
|
||||
aria-label={label}
|
||||
disabled={disabled || frozen}
|
||||
gap="gap-1"
|
||||
className={cn(segmentedChoiceVariants({ track, frozen }), className)}
|
||||
>
|
||||
{options.map((option) => (
|
||||
<FlexBox
|
||||
key={option.value}
|
||||
tag="label"
|
||||
alignItems="items-center"
|
||||
className={cn(
|
||||
segmentedChoiceOptionVariants({
|
||||
selected: option.value === value,
|
||||
size,
|
||||
disabled: disabled && !frozen,
|
||||
}),
|
||||
'gap-1.5',
|
||||
)}
|
||||
>
|
||||
<Element
|
||||
tag="input"
|
||||
type="radio"
|
||||
name={name}
|
||||
value={option.value}
|
||||
checked={option.value === value}
|
||||
onChange={onChange ? () => onChange(option.value) : undefined}
|
||||
readOnly={!onChange}
|
||||
className="pointer-events-none absolute m-0 size-px opacity-0"
|
||||
/>
|
||||
{option.icon && <Icon name={option.icon} size={16} />}
|
||||
<Typography tag="span" variant="label" color="inherit">
|
||||
{option.label}
|
||||
</Typography>
|
||||
</FlexBox>
|
||||
))}
|
||||
</FlexBox>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
export { SegmentedChoice } from './SegmentedChoice';
|
||||
export type {
|
||||
SegmentedChoiceOption,
|
||||
SegmentedChoiceProps,
|
||||
SegmentedChoiceSize,
|
||||
SegmentedChoiceTrack,
|
||||
} from './types';
|
||||
export {
|
||||
segmentedChoiceOptionVariants,
|
||||
segmentedChoiceVariants,
|
||||
} from './variants';
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
import type { VariantProps } from 'class-variance-authority';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
import type { IconName } from '../../atoms/icon';
|
||||
import type {
|
||||
segmentedChoiceOptionVariants,
|
||||
segmentedChoiceVariants,
|
||||
} from './variants';
|
||||
|
||||
export type SegmentedChoiceSize = NonNullable<
|
||||
VariantProps<typeof segmentedChoiceOptionVariants>['size']
|
||||
>;
|
||||
|
||||
export type SegmentedChoiceTrack = NonNullable<
|
||||
VariantProps<typeof segmentedChoiceVariants>['track']
|
||||
>;
|
||||
|
||||
export type SegmentedChoiceOption<T extends string> = {
|
||||
value: T;
|
||||
label: ReactNode;
|
||||
/** Leads the label, chosen or not, such as the lock on «پریمیوم». No check mark otherwise. */
|
||||
icon?: IconName;
|
||||
};
|
||||
|
||||
export type SegmentedChoiceProps<T extends string> = {
|
||||
/** Two or three short options, such as «رایگان» / «پریمیوم». */
|
||||
options: readonly SegmentedChoiceOption<T>[];
|
||||
/** The chosen option's value. */
|
||||
value: T;
|
||||
/** Called with the option picked by a press, or by the arrow keys; never for the chosen one. */
|
||||
onChange?: (value: T) => void;
|
||||
/** The group's accessible name, such as «سطح دسترسی پست». */
|
||||
label: string;
|
||||
/** `md` (44px) in forms such as the composer, `sm` (36px) inside a card. */
|
||||
size?: SegmentedChoiceSize;
|
||||
/** `sunken` on a card or a form; `surface` on a tinted ground, such as the preview banner (C5 ۶.۲). */
|
||||
track?: SegmentedChoiceTrack;
|
||||
/** Out of reach for now, such as while the post publishes (C4 ۱.۶): each option dims. */
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* Locked for good, such as a post's access past its edit window (C5 ۱.۶): the whole pill dims as
|
||||
* one and takes no focus, so put the reason in text beside it.
|
||||
*/
|
||||
frozen?: boolean;
|
||||
className?: string;
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
import { cva } from 'class-variance-authority';
|
||||
|
||||
/** The track the options sit in (C5 ۱.۱); frozen, it dims as one (C5 ۱.۶). */
|
||||
export const segmentedChoiceVariants = cva(
|
||||
'w-fit min-w-0 rounded-full border border-border-subtle p-1',
|
||||
{
|
||||
variants: {
|
||||
/** sunken on a card or a form; surface on a tinted ground, such as a banner (C5 ۶.۲). */
|
||||
track: { sunken: 'bg-surface-sunken', surface: 'bg-surface' },
|
||||
frozen: { true: 'frozen', false: '' },
|
||||
},
|
||||
defaultVariants: { track: 'sunken', frozen: false },
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* One option, a chip with the real radio hidden inside: filled brand when chosen, bare on the
|
||||
* track when not. The label is the hit area and shows the radio's keyboard focus.
|
||||
*/
|
||||
export const segmentedChoiceOptionVariants = cva(
|
||||
'relative rounded-full border whitespace-nowrap transition-colors duration-120 ease-standard has-[input:enabled]:cursor-pointer has-[input:focus-visible]:focus-ring',
|
||||
{
|
||||
variants: {
|
||||
selected: {
|
||||
true: 'border-action-primary bg-action-primary text-text-on-action',
|
||||
false:
|
||||
'border-transparent bg-transparent text-text-primary has-[input:enabled]:hover:border-action-primary',
|
||||
},
|
||||
size: {
|
||||
sm: 'min-h-control-sm px-3.5',
|
||||
md: 'min-h-control-md px-4',
|
||||
},
|
||||
/** Disabled but not frozen: each option dims, as a disabled chip does (C4 ۱.۶). */
|
||||
disabled: { true: 'frozen', false: '' },
|
||||
},
|
||||
defaultVariants: { selected: false, size: 'md', disabled: false },
|
||||
},
|
||||
);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue