feat(dashboard): welcome a new analyst on the overview tab

With no audience and no income yet, the figures stay at zero and a banner
offers to share the channel, through the caption sheet the channel's own share
uses. A channel that isn't public yet says why it can't be shared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Amiram_se 2026-11-05 19:08:35 +04:00
parent 7f4f393ba0
commit 935d59dab8
5 changed files with 72 additions and 0 deletions

View File

@ -1,2 +1,3 @@
export { ChannelShare } from './ChannelShare';
export { OwnerShareSheet } from './components/OwnerShareSheet';
export type { ChannelShareProps } from './types';

View File

@ -7,6 +7,7 @@ import { AudienceSection } from './components/AudienceSection';
import { IncomeSection } from './components/IncomeSection';
import { PlanBreakdown } from './components/PlanBreakdown';
import { SignalSummary } from './components/SignalSummary';
import { WelcomeBanner } from './components/WelcomeBanner';
import type { DashboardOverviewProps } from './types';
/** داشبورد › نمای کلی (J10-0), the creator's default tab. Loads and fails as one. */
@ -16,6 +17,7 @@ export function DashboardOverview({ layout }: DashboardOverviewProps) {
return (
<FlexBox direction="flex-col" gap="gap-6">
{overview.isNewcomer && <WelcomeBanner layout={layout} />}
<AudienceSection overview={overview} cols={cols} />
<IncomeSection overview={overview} cols={cols} />
<PlanBreakdown plans={overview.plans} />

View File

@ -0,0 +1,62 @@
'use client';
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Banner } from '@lumina/island/molecules/banner';
import { useTranslation } from 'react-i18next';
import {
useChannelShareSheet,
useDisplayLink,
useOwnChannel,
} from '../../../../../../../../features/channel';
import { useCurrentAccount } from '../../../../../../../../stores/auth';
import { ROUTES } from '../../../../../../../navigation/navigation';
import { OwnerShareSheet } from '../../../../../channels/[username]/organisms/channel-share';
import type { WelcomeBannerProps } from '../types';
/**
* A new analyst's next step (J10-0b): share the channel, with the caption sheet the channel's own
* share uses. A channel that isn't public yet has nothing to share, so the button says why.
*/
export function WelcomeBanner({ layout }: WelcomeBannerProps) {
const { t } = useTranslation(['dashboard', 'channel']);
const account = useCurrentAccount();
const own = useOwnChannel();
const path = ROUTES.channel(account?.username ?? '');
const channelUrl = useDisplayLink(path) ?? path;
const sheet = useChannelShareSheet({ path, native: layout === 'mobile' });
const isSuspended = own.status === 'ready' && own.channel.suspended;
const isVerified = own.status === 'ready' && own.standing === 'verified';
const frozenReason = isSuspended
? t('channel:share.owner.suspended')
: isVerified
? undefined
: t('channel:share.owner.pending');
return (
<FlexBox direction="flex-col" className="relative">
<Banner
tone="info"
icon="share"
title={t('overview.welcome.title')}
action={
<Button
variant="secondary"
size="sm"
aria-haspopup="dialog"
aria-expanded={sheet.isOpen}
frozen={frozenReason !== undefined}
frozenReason={frozenReason}
onClick={sheet.open}
>
{t('overview.welcome.action')}
</Button>
}
>
{t('overview.welcome.text')}
</Banner>
<OwnerShareSheet model={sheet} channelUrl={channelUrl} layout={layout} />
</FlexBox>
);
}

View File

@ -23,3 +23,5 @@ export type PlanBreakdownProps = {
};
export type SignalSummaryProps = DashboardOverviewProps;
export type WelcomeBannerProps = DashboardOverviewProps;

View File

@ -263,6 +263,11 @@
"details": "جزئیات در تب سیگنال‌ها",
"error": "عملکرد سیگنال‌ها بارگذاری نشد.",
"loading": "در حال بارگذاری عملکرد سیگنال‌ها…"
},
"welcome": {
"title": "کانال خود را معرفی کنید",
"text": "لینک کانال را در تلگرام، اینستاگرام یا هر جای دیگری که مخاطب دارید بگذارید. هر دنبال‌کننده و مشترک تازه اینجا شمرده می‌شود.",
"action": "اشتراک‌گذاری لینک کانال"
}
}
}