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:
parent
7f4f393ba0
commit
935d59dab8
|
|
@ -1,2 +1,3 @@
|
||||||
export { ChannelShare } from './ChannelShare';
|
export { ChannelShare } from './ChannelShare';
|
||||||
|
export { OwnerShareSheet } from './components/OwnerShareSheet';
|
||||||
export type { ChannelShareProps } from './types';
|
export type { ChannelShareProps } from './types';
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { AudienceSection } from './components/AudienceSection';
|
||||||
import { IncomeSection } from './components/IncomeSection';
|
import { IncomeSection } from './components/IncomeSection';
|
||||||
import { PlanBreakdown } from './components/PlanBreakdown';
|
import { PlanBreakdown } from './components/PlanBreakdown';
|
||||||
import { SignalSummary } from './components/SignalSummary';
|
import { SignalSummary } from './components/SignalSummary';
|
||||||
|
import { WelcomeBanner } from './components/WelcomeBanner';
|
||||||
import type { DashboardOverviewProps } from './types';
|
import type { DashboardOverviewProps } from './types';
|
||||||
|
|
||||||
/** داشبورد › نمای کلی (J10-0), the creator's default tab. Loads and fails as one. */
|
/** داشبورد › نمای کلی (J10-0), the creator's default tab. Loads and fails as one. */
|
||||||
|
|
@ -16,6 +17,7 @@ export function DashboardOverview({ layout }: DashboardOverviewProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FlexBox direction="flex-col" gap="gap-6">
|
<FlexBox direction="flex-col" gap="gap-6">
|
||||||
|
{overview.isNewcomer && <WelcomeBanner layout={layout} />}
|
||||||
<AudienceSection overview={overview} cols={cols} />
|
<AudienceSection overview={overview} cols={cols} />
|
||||||
<IncomeSection overview={overview} cols={cols} />
|
<IncomeSection overview={overview} cols={cols} />
|
||||||
<PlanBreakdown plans={overview.plans} />
|
<PlanBreakdown plans={overview.plans} />
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -23,3 +23,5 @@ export type PlanBreakdownProps = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SignalSummaryProps = DashboardOverviewProps;
|
export type SignalSummaryProps = DashboardOverviewProps;
|
||||||
|
|
||||||
|
export type WelcomeBannerProps = DashboardOverviewProps;
|
||||||
|
|
|
||||||
|
|
@ -263,6 +263,11 @@
|
||||||
"details": "جزئیات در تب سیگنالها",
|
"details": "جزئیات در تب سیگنالها",
|
||||||
"error": "عملکرد سیگنالها بارگذاری نشد.",
|
"error": "عملکرد سیگنالها بارگذاری نشد.",
|
||||||
"loading": "در حال بارگذاری عملکرد سیگنالها…"
|
"loading": "در حال بارگذاری عملکرد سیگنالها…"
|
||||||
|
},
|
||||||
|
"welcome": {
|
||||||
|
"title": "کانال خود را معرفی کنید",
|
||||||
|
"text": "لینک کانال را در تلگرام، اینستاگرام یا هر جای دیگری که مخاطب دارید بگذارید. هر دنبالکننده و مشترک تازه اینجا شمرده میشود.",
|
||||||
|
"action": "اشتراکگذاری لینک کانال"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue