feat(dashboard): summarise signal performance on the overview tab
The four numbers and the way to a public record, from the snapshot the signals tab reads, so the two can't disagree. Before the first evaluation it shows the same message in their place, never zeros. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0ed3578565
commit
7f4f393ba0
|
|
@ -6,6 +6,7 @@ import { useDashboardOverviewPart } from '../../../../../../../features/overview
|
||||||
import { AudienceSection } from './components/AudienceSection';
|
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 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. */
|
||||||
|
|
@ -18,6 +19,7 @@ export function DashboardOverview({ layout }: DashboardOverviewProps) {
|
||||||
<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} />
|
||||||
|
<SignalSummary layout={layout} />
|
||||||
</FlexBox>
|
</FlexBox>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||||
|
import { SectionTitle } from '@lumina/island/molecules/section-title';
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { Suspense, useId } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
import { useSignalStatsPart } from '../../../../../../../../features/prediction';
|
||||||
|
import { PartBoundary } from '../../../../../../../error-boundaries';
|
||||||
|
import { ROUTES } from '../../../../../../../navigation/navigation';
|
||||||
|
import { SignalProgress } from '../../../../organisms/signal-progress';
|
||||||
|
import { SignalStatTiles } from '../../../../organisms/signal-stat-tiles';
|
||||||
|
import { SignalStatsPending } from '../../../../organisms/signal-stats-pending';
|
||||||
|
import type { SignalSummaryProps } from '../types';
|
||||||
|
|
||||||
|
/** The same four numbers as the سیگنالها tab, from the same snapshot, or the message before it. */
|
||||||
|
function SignalSummaryBody({ layout }: SignalSummaryProps) {
|
||||||
|
const performance = useSignalStatsPart();
|
||||||
|
|
||||||
|
if (performance.status === 'pending') return <SignalStatsPending />;
|
||||||
|
return (
|
||||||
|
<FlexBox direction="flex-col" gap="gap-3">
|
||||||
|
<SignalStatTiles stats={performance.stats} layout={layout} />
|
||||||
|
<SignalProgress progress={performance.progress} />
|
||||||
|
</FlexBox>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* «عملکرد سیگنالها» in short, with the way to the tab that explains it. It loads and fails on its
|
||||||
|
* own, so the rest of the page stands without it.
|
||||||
|
*/
|
||||||
|
export function SignalSummary({ layout }: SignalSummaryProps) {
|
||||||
|
const { t } = useTranslation('dashboard');
|
||||||
|
const titleId = useId();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FlexBox
|
||||||
|
tag="section"
|
||||||
|
aria-labelledby={titleId}
|
||||||
|
direction="flex-col"
|
||||||
|
gap="gap-3"
|
||||||
|
>
|
||||||
|
<SectionTitle
|
||||||
|
title={t('overview.signals.title')}
|
||||||
|
titleId={titleId}
|
||||||
|
actionLabel={t('overview.signals.details')}
|
||||||
|
actionHref={ROUTES.dashboard.predictions}
|
||||||
|
/>
|
||||||
|
<PartBoundary
|
||||||
|
name="overview-signals"
|
||||||
|
description={t('overview.signals.error')}
|
||||||
|
framed
|
||||||
|
>
|
||||||
|
<Suspense
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset
|
||||||
|
preset="stats"
|
||||||
|
label={t('overview.signals.loading')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<SignalSummaryBody layout={layout} />
|
||||||
|
</Suspense>
|
||||||
|
</PartBoundary>
|
||||||
|
</FlexBox>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -21,3 +21,5 @@ export type DashboardOverviewSkeletonProps = {
|
||||||
export type PlanBreakdownProps = {
|
export type PlanBreakdownProps = {
|
||||||
plans: DashboardOverviewPartModel['plans'];
|
plans: DashboardOverviewPartModel['plans'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type SignalSummaryProps = DashboardOverviewProps;
|
||||||
|
|
|
||||||
|
|
@ -257,6 +257,12 @@
|
||||||
"income": "{{n}} {{currency}} · {{share}}"
|
"income": "{{n}} {{currency}} · {{share}}"
|
||||||
},
|
},
|
||||||
"note": "«کل خریدها» همه خریدها از ابتدا است، با تمدید و فعالسازی مجدد و منهای بازگشت وجهها."
|
"note": "«کل خریدها» همه خریدها از ابتدا است، با تمدید و فعالسازی مجدد و منهای بازگشت وجهها."
|
||||||
|
},
|
||||||
|
"signals": {
|
||||||
|
"title": "عملکرد سیگنالها",
|
||||||
|
"details": "جزئیات در تب سیگنالها",
|
||||||
|
"error": "عملکرد سیگنالها بارگذاری نشد.",
|
||||||
|
"loading": "در حال بارگذاری عملکرد سیگنالها…"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue