diff --git a/apps/bear/src/app/(main)/dashboard/(creator)/layout.tsx b/apps/bear/src/app/(main)/dashboard/(creator)/layout.tsx index 5688e95..ee515ca 100644 --- a/apps/bear/src/app/(main)/dashboard/(creator)/layout.tsx +++ b/apps/bear/src/app/(main)/dashboard/(creator)/layout.tsx @@ -8,7 +8,7 @@ import { i18n } from '../../../../i18n'; /** * The creator's داشبورد on desktop (Creator Dashboard ۵.۱): the 640 column under the header, with - * the «داشبورد» heading, the three tabs «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی», then the tab. Each tab is its own + * the «داشبورد» heading, the four tabs «نمای کلی» · «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی», then the tab. Each tab is its own * route with its own loading, so the heading and the tabs stay while one loads. Locked until * registration step 5 is done (0016). */ diff --git a/apps/bear/src/app/(main)/dashboard/(creator)/overview/loading.tsx b/apps/bear/src/app/(main)/dashboard/(creator)/overview/loading.tsx new file mode 100644 index 0000000..e18927c --- /dev/null +++ b/apps/bear/src/app/(main)/dashboard/(creator)/overview/loading.tsx @@ -0,0 +1,14 @@ +import { DashboardOverviewSkeleton } from '@lumina/market/app/screens/(main)/dashboard/overview/organisms/dashboard-overview'; + +import { i18n } from '../../../../../i18n'; + +/** نمای کلی before it arrives; the layout keeps the bar and the tabs. */ +export default function Loading() { + return ( + + ); +} diff --git a/apps/bear/src/app/(main)/dashboard/(creator)/overview/page.tsx b/apps/bear/src/app/(main)/dashboard/(creator)/overview/page.tsx new file mode 100644 index 0000000..26d9e7e --- /dev/null +++ b/apps/bear/src/app/(main)/dashboard/(creator)/overview/page.tsx @@ -0,0 +1,42 @@ +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { + DashboardOverview, + DashboardOverviewSkeleton, +} from '@lumina/market/app/screens/(main)/dashboard/overview/organisms/dashboard-overview'; +import type { Metadata } from 'next'; +import { Suspense } from 'react'; + +import { i18n } from '../../../../../i18n'; + +export const metadata: Metadata = { + title: i18n.t('dashboard:overview.meta-title'), + robots: { index: false }, +}; + +/** + * داشبورد › نمای کلی (J10-0), the creator's default tab: audience, income, the split by plan and + * the signals' summary, the creator's own, in the browser only. The tabs stay while it loads. + */ +export default function OverviewPage() { + const skeleton = ( + + ); + + return ( + + + + + + + + ); +} diff --git a/apps/bear/src/app/(main)/dashboard/(creator)/plans/loading.tsx b/apps/bear/src/app/(main)/dashboard/(creator)/plans/loading.tsx index 18ae431..78e8e6e 100644 --- a/apps/bear/src/app/(main)/dashboard/(creator)/plans/loading.tsx +++ b/apps/bear/src/app/(main)/dashboard/(creator)/plans/loading.tsx @@ -1,7 +1,7 @@ import { FlexBox } from '@lumina/island/atoms/flex-box'; -import { AudienceStatsSkeleton } from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/audience-stats'; import { InviteCodeCardSkeleton } from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/invite-code-card'; import { PricingCardSkeleton } from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/pricing-card'; +import { SubscribersPreviewSkeleton } from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/subscribers-preview'; import { i18n } from '../../../../../i18n'; @@ -19,8 +19,8 @@ export default function Loading() { label={i18n.t('dashboard:invite.loading')} delayed /> - diff --git a/apps/bear/src/app/(main)/dashboard/(creator)/plans/page.tsx b/apps/bear/src/app/(main)/dashboard/(creator)/plans/page.tsx index a8711db..dcf80f6 100644 --- a/apps/bear/src/app/(main)/dashboard/(creator)/plans/page.tsx +++ b/apps/bear/src/app/(main)/dashboard/(creator)/plans/page.tsx @@ -1,10 +1,6 @@ import { FlexBox } from '@lumina/island/atoms/flex-box'; import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; -import { - AudienceStats, - AudienceStatsSkeleton, -} from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/audience-stats'; import { InviteCodeCard, InviteCodeCardSkeleton, @@ -13,6 +9,10 @@ import { PricingCard, PricingCardSkeleton, } from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/pricing-card'; +import { + SubscribersPreview, + SubscribersPreviewSkeleton, +} from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/subscribers-preview'; import type { Metadata } from 'next'; import { Suspense } from 'react'; @@ -25,7 +25,7 @@ export const metadata: Metadata = { }; /** - * داشبورد › طرح‌های اشتراک (J10-1): «قیمت طرح‌ها», «کد دعوت» (only once approved) and «مخاطبان», + * داشبورد › طرح‌های اشتراک (J10-1): «قیمت طرح‌ها», «کد دعوت» (only once approved) and «مشترکان», * the creator's own, in the browser only. Each block loads and fails on its own; the tabs stay. */ export default function PlansPage() { @@ -41,8 +41,10 @@ export default function PlansPage() { label={i18n.t('dashboard:invite.loading')} /> ); - const audienceSkeleton = ( - + const subscribersSkeleton = ( + ); return ( @@ -52,7 +54,7 @@ export default function PlansPage() { {pricingSkeleton} {inviteSkeleton} - {audienceSkeleton} + {subscribersSkeleton} } > @@ -79,12 +81,12 @@ export default function PlansPage() { - - + + diff --git a/apps/bear/src/app/(main)/dashboard/subscribers/layout.tsx b/apps/bear/src/app/(main)/dashboard/subscribers/layout.tsx new file mode 100644 index 0000000..f671748 --- /dev/null +++ b/apps/bear/src/app/(main)/dashboard/subscribers/layout.tsx @@ -0,0 +1,3 @@ +// Locked until a creator finishes registration step 5 (0016), as the tab is; the guard renders +// the page as is. +export { OnboardingGuard as default } from '@lumina/market/app/guards/onboarding-guard'; diff --git a/apps/bear/src/app/(main)/dashboard/subscribers/loading.tsx b/apps/bear/src/app/(main)/dashboard/subscribers/loading.tsx new file mode 100644 index 0000000..eb8b325 --- /dev/null +++ b/apps/bear/src/app/(main)/dashboard/subscribers/loading.tsx @@ -0,0 +1,27 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { DesktopPageTitle, ROUTES } from '@lumina/market/app/navigation'; +import { SubscriberListSkeleton } from '@lumina/market/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list'; + +import { i18n } from '../../../../i18n'; + +/** «مشترکان» before it arrives, under its real title. */ +export default function Loading() { + return ( + + + + + + + ); +} diff --git a/apps/bear/src/app/(main)/dashboard/subscribers/page.tsx b/apps/bear/src/app/(main)/dashboard/subscribers/page.tsx new file mode 100644 index 0000000..49235e2 --- /dev/null +++ b/apps/bear/src/app/(main)/dashboard/subscribers/page.tsx @@ -0,0 +1,53 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { DesktopPageTitle, ROUTES } from '@lumina/market/app/navigation'; +import { + SubscriberList, + SubscriberListSkeleton, +} from '@lumina/market/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list'; +import type { Metadata } from 'next'; +import { Suspense } from 'react'; + +import { i18n } from '../../../../i18n'; + +export const metadata: Metadata = { + title: i18n.t('dashboard:subscribers.meta-title'), + robots: { index: false }, +}; + +/** + * «مشترکان» on desktop (J10-1f, J10-1g): the same list in the 640 column, «بازگشت» over its title + * back to نمای کلی. The creator's own, in the browser only. + */ +export default function SubscribersPage() { + const skeleton = ( + + ); + + return ( + + + + + + + + + + + + + ); +} diff --git a/apps/bull/src/app/(main)/dashboard/(creator)/layout.tsx b/apps/bull/src/app/(main)/dashboard/(creator)/layout.tsx index 5cc8db8..b46bfef 100644 --- a/apps/bull/src/app/(main)/dashboard/(creator)/layout.tsx +++ b/apps/bull/src/app/(main)/dashboard/(creator)/layout.tsx @@ -7,8 +7,8 @@ import type { ReactNode } from 'react'; import { i18n } from '../../../../i18n'; /** - * The creator's داشبورد on mobile (Creator Dashboard ۱.۱, 0034): the tab bar «داشبورد», the three - * tabs «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی», then the tab. Each tab is its own route with its own loading, so the + * The creator's داشبورد on mobile (Creator Dashboard ۱.۱, 0034): the tab bar «داشبورد», the four + * tabs «نمای کلی» · «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی», then the tab. Each tab is its own route with its own loading, so the * bar and the tabs stay while one loads. Locked until registration step 5 is done (0016). */ export default function CreatorDashboardLayout({ diff --git a/apps/bull/src/app/(main)/dashboard/(creator)/overview/loading.tsx b/apps/bull/src/app/(main)/dashboard/(creator)/overview/loading.tsx new file mode 100644 index 0000000..78c542f --- /dev/null +++ b/apps/bull/src/app/(main)/dashboard/(creator)/overview/loading.tsx @@ -0,0 +1,14 @@ +import { DashboardOverviewSkeleton } from '@lumina/market/app/screens/(main)/dashboard/overview/organisms/dashboard-overview'; + +import { i18n } from '../../../../../i18n'; + +/** نمای کلی before it arrives; the layout keeps the bar and the tabs. */ +export default function Loading() { + return ( + + ); +} diff --git a/apps/bull/src/app/(main)/dashboard/(creator)/overview/page.tsx b/apps/bull/src/app/(main)/dashboard/(creator)/overview/page.tsx new file mode 100644 index 0000000..a3a6734 --- /dev/null +++ b/apps/bull/src/app/(main)/dashboard/(creator)/overview/page.tsx @@ -0,0 +1,42 @@ +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { + DashboardOverview, + DashboardOverviewSkeleton, +} from '@lumina/market/app/screens/(main)/dashboard/overview/organisms/dashboard-overview'; +import type { Metadata } from 'next'; +import { Suspense } from 'react'; + +import { i18n } from '../../../../../i18n'; + +export const metadata: Metadata = { + title: i18n.t('dashboard:overview.meta-title'), + robots: { index: false }, +}; + +/** + * داشبورد › نمای کلی (J10-0), the creator's default tab: audience, income, the split by plan and + * the signals' summary, the creator's own, in the browser only. The tabs stay while it loads. + */ +export default function OverviewPage() { + const skeleton = ( + + ); + + return ( + + + + + + + + ); +} diff --git a/apps/bull/src/app/(main)/dashboard/(creator)/plans/loading.tsx b/apps/bull/src/app/(main)/dashboard/(creator)/plans/loading.tsx index 6c73174..bb8ed76 100644 --- a/apps/bull/src/app/(main)/dashboard/(creator)/plans/loading.tsx +++ b/apps/bull/src/app/(main)/dashboard/(creator)/plans/loading.tsx @@ -1,7 +1,7 @@ import { FlexBox } from '@lumina/island/atoms/flex-box'; -import { AudienceStatsSkeleton } from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/audience-stats'; import { InviteCodeCardSkeleton } from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/invite-code-card'; import { PricingCardSkeleton } from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/pricing-card'; +import { SubscribersPreviewSkeleton } from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/subscribers-preview'; import { i18n } from '../../../../../i18n'; @@ -19,8 +19,8 @@ export default function Loading() { label={i18n.t('dashboard:invite.loading')} delayed /> - diff --git a/apps/bull/src/app/(main)/dashboard/(creator)/plans/page.tsx b/apps/bull/src/app/(main)/dashboard/(creator)/plans/page.tsx index 1357868..a868449 100644 --- a/apps/bull/src/app/(main)/dashboard/(creator)/plans/page.tsx +++ b/apps/bull/src/app/(main)/dashboard/(creator)/plans/page.tsx @@ -1,10 +1,6 @@ import { FlexBox } from '@lumina/island/atoms/flex-box'; import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; -import { - AudienceStats, - AudienceStatsSkeleton, -} from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/audience-stats'; import { InviteCodeCard, InviteCodeCardSkeleton, @@ -13,6 +9,10 @@ import { PricingCard, PricingCardSkeleton, } from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/pricing-card'; +import { + SubscribersPreview, + SubscribersPreviewSkeleton, +} from '@lumina/market/app/screens/(main)/dashboard/plans/organisms/subscribers-preview'; import type { Metadata } from 'next'; import { Suspense } from 'react'; @@ -25,7 +25,7 @@ export const metadata: Metadata = { }; /** - * داشبورد › طرح‌های اشتراک (J10-1): «قیمت طرح‌ها», «کد دعوت» (only once approved) and «مخاطبان», + * داشبورد › طرح‌های اشتراک (J10-1): «قیمت طرح‌ها», «کد دعوت» (only once approved) and «مشترکان», * the creator's own, in the browser only. Each block loads and fails on its own; the tabs stay. */ export default function PlansPage() { @@ -41,8 +41,10 @@ export default function PlansPage() { label={i18n.t('dashboard:invite.loading')} /> ); - const audienceSkeleton = ( - + const subscribersSkeleton = ( + ); return ( @@ -52,7 +54,7 @@ export default function PlansPage() { {pricingSkeleton} {inviteSkeleton} - {audienceSkeleton} + {subscribersSkeleton} } > @@ -79,12 +81,12 @@ export default function PlansPage() { - - + + diff --git a/apps/bull/src/app/(main)/dashboard/subscribers/layout.tsx b/apps/bull/src/app/(main)/dashboard/subscribers/layout.tsx new file mode 100644 index 0000000..f671748 --- /dev/null +++ b/apps/bull/src/app/(main)/dashboard/subscribers/layout.tsx @@ -0,0 +1,3 @@ +// Locked until a creator finishes registration step 5 (0016), as the tab is; the guard renders +// the page as is. +export { OnboardingGuard as default } from '@lumina/market/app/guards/onboarding-guard'; diff --git a/apps/bull/src/app/(main)/dashboard/subscribers/loading.tsx b/apps/bull/src/app/(main)/dashboard/subscribers/loading.tsx new file mode 100644 index 0000000..9adc0a7 --- /dev/null +++ b/apps/bull/src/app/(main)/dashboard/subscribers/loading.tsx @@ -0,0 +1,24 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation'; +import { SubscriberListSkeleton } from '@lumina/market/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list'; + +import { i18n } from '../../../../i18n'; + +/** «مشترکان» before it arrives, under its real bar. */ +export default function Loading() { + return ( + <> + + + + + + ); +} diff --git a/apps/bull/src/app/(main)/dashboard/subscribers/page.tsx b/apps/bull/src/app/(main)/dashboard/subscribers/page.tsx new file mode 100644 index 0000000..b5387af --- /dev/null +++ b/apps/bull/src/app/(main)/dashboard/subscribers/page.tsx @@ -0,0 +1,50 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; +import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation'; +import { + SubscriberList, + SubscriberListSkeleton, +} from '@lumina/market/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list'; +import type { Metadata } from 'next'; +import { Suspense } from 'react'; + +import { i18n } from '../../../../i18n'; + +export const metadata: Metadata = { + title: i18n.t('dashboard:subscribers.meta-title'), + robots: { index: false }, +}; + +/** + * «مشترکان» on mobile (J10-1f, J10-1g): a page pushed from نمای کلی or طرح‌های اشتراک, back · + * «مشترکان» · support, with the nav kept on داشبورد. The creator's own, in the browser only; + * opened on its own, back goes to نمای کلی. + */ +export default function SubscribersPage() { + const skeleton = ( + + ); + + return ( + <> + + + + + + + + + + + + ); +} diff --git a/docs/decisions/0034-creator-dashboard-routes.md b/docs/decisions/0034-creator-dashboard-routes.md index 72e7219..e85e96e 100644 --- a/docs/decisions/0034-creator-dashboard-routes.md +++ b/docs/decisions/0034-creator-dashboard-routes.md @@ -1,6 +1,6 @@ # 0034 The creator's داشبورد is three tab routes, C7 a pushed page -Status: Proposed · Area: architecture · Date: 2026-10-08, amended 2026-10-09 · Decided by: agent +Status: Proposed · Area: architecture · Date: 2026-10-08, amended 2026-10-09, 0072 makes «نمای کلی» the default tab · Decided by: agent ## Context diff --git a/docs/decisions/0072-analyst-overview-is-the-default-tab.md b/docs/decisions/0072-analyst-overview-is-the-default-tab.md new file mode 100644 index 0000000..95b33ba --- /dev/null +++ b/docs/decisions/0072-analyst-overview-is-the-default-tab.md @@ -0,0 +1,24 @@ +# 0072 The analyst's overview is the default dashboard tab + +Status: Accepted · Area: architecture · Date: 2026-11-05 · Decided by: user · Amends: 0034 + +## Context + +The analyst's figures were spread over the plans tab, and the user asked for one place with audience, income, the split by plan and signal performance. The back end already answers `GET /me/dashboard/overview` and `GET /me/subscribers`. + +## Decision + +- `/dashboard/overview` in `dashboard/(creator)` is the first tab and the default: the nav's داشبورد opens it for a creator. The tabs are «نمای کلی» · «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی», as in the design (J10-0); the request named three, and the signals tab stays because the same request adds to it. +- The plans tab keeps prices and the invite code, loses «مخاطبان», and shows the soonest-ending subscribers. Its followers count moved to the overview, where only the analyst sees it, with no list of who follows. +- `/dashboard/subscribers?filter=expiring` is a pushed page outside `(creator)`, with «همه» and «در حال انقضا» from the API's totals. +- The signal summary reads the snapshot the signals tab reads (`useSignalStatsPart`), so the two can't disagree, and shows the same message before the first evaluation. + +## Alternatives + +- Three tabs, with signals under the overview: the request also adds a block to the signals tab, so that tab has to exist. +- Keeping the figures on the plans tab with a strip above the tabs: the request removes it. + +## Consequences + +- The bar has four tabs on a phone; they fit at 375px with no scrolling. +- Everything but the signal summary is one read, so it loads and fails as one part. The summary loads and fails on its own. diff --git a/docs/decisions/README.md b/docs/decisions/README.md index fea1f0b..65755c2 100644 --- a/docs/decisions/README.md +++ b/docs/decisions/README.md @@ -29,6 +29,7 @@ - 0068 Keep the previous release as a stopped `-` container with its env folder; `tools/rollback.sh ` starts it in place of the serving one. - 0070 Render every page except the landing in the browser: the server reads no data and sends the frame, a skeleton and metadata; channel and post are `noindex`, their metadata from params only. - 0071 Index only the landing in bull and bear; every other page is `noindex` with no canonical or JSON-LD, new pages included. +- 0072 Make `/dashboard/overview` the analyst's default tab, «نمای کلی» · «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی»; the plans tab lists subscribers instead of audience counts, and `/dashboard/subscribers` lists them all. ## Proposed @@ -48,7 +49,7 @@ - 0030 architecture: Keep the last checkout's period, invite code and bank payment in the persisted `session.checkout-draft` store from payment start until success, and restore them on the same creator's checkout. - 0031 design: List renew and reactivate periods as island `TierOption` cards, as checkout does, instead of R3's chip grid. - 0033 architecture: Keep the payment sent to the bank in the checkout draft and settle it through `POST /subscriptions/payments/:id/abandon` only on the page that came back from the bank (bfcache or a history load), triggered by the app shell and awaited by checkout's screen read. -- 0034 architecture: Serve the creator's داشبورد from `dashboard/(creator)` as `/dashboard/plans` (default), `/dashboard/predictions` and `/dashboard/finance`, and C7 at `/dashboard/pricing` in `(flow)`; the شبا form and ledger details open in place. +- 0034 architecture: Serve the creator's داشبورد from `dashboard/(creator)` as `/dashboard/plans`, `/dashboard/predictions` and `/dashboard/finance` (0072 adds the default, `/dashboard/overview`), and C7 at `/dashboard/pricing` in `(flow)`; the شبا form and ledger details open in place. - 0035 design: Pick a promotion's Shamsi date and time with island `Select`s in a sheet or modal, not a drawn wheel. - 0036 architecture: During the 7-day lock the save button reads «ذخیره تخفیف» and saves promotion changes; standing prices and period switches stay read-only. - 0037 architecture: Open payout receipts from the API's session-authorized `/payouts/me/payouts/:id/receipt` through `/api`, not signed expiring URLs. diff --git a/docs/pages/README.md b/docs/pages/README.md index 77289b6..2e1654c 100644 --- a/docs/pages/README.md +++ b/docs/pages/README.md @@ -32,7 +32,9 @@ Rendered on the server: - `/account` · [account.md](market/account.md) · noindex · none · browser: top-bar title/login, AccountOverview (identity, lists, sign-out), SupportDialog, SignOutConfirm - `/account/install` · [account-install.md](market/account-install.md) · noindex · none · browser: top-bar title/login, InstallApp - `/account/notifications` · [account-notifications.md](market/account-notifications.md) · noindex · none · browser: top-bar title/login, NotificationSettings, offline banner -- `/dashboard/plans` · [dashboard-plans.md](market/dashboard-plans.md) · noindex · none · browser: PricingCard, InviteCodeCard, InviteShareSheet, CapacityRequestDialog, AudienceStats +- `/dashboard/overview` · [dashboard-overview.md](market/dashboard-overview.md) · noindex · none · browser: DashboardOverview (WelcomeBanner, audience, income, PlanBreakdown), SignalSummary +- `/dashboard/plans` · [dashboard-plans.md](market/dashboard-plans.md) · noindex · none · browser: PricingCard, InviteCodeCard, InviteShareSheet, CapacityRequestDialog, SubscribersPreview +- `/dashboard/subscribers` · [dashboard-subscribers.md](market/dashboard-subscribers.md) · noindex · none · browser: SubscriberList - `/dashboard/predictions` · [dashboard-predictions.md](market/dashboard-predictions.md) · noindex · none · browser: PredictionsTab, TrackRecord, open and recently closed PredictionSections, ClosePredictionSheet - `/dashboard/finance` · [dashboard-finance.md](market/dashboard-finance.md) · noindex · none · browser: BalanceSummary, PayoutAccount, ReadBackDialog, Ledger, LedgerDetail, receipt Lightbox - `/dashboard/predictions/all` · [dashboard-predictions-all.md](market/dashboard-predictions-all.md) · noindex · none · browser: page name (bull), PredictionList, ClosePredictionSheet diff --git a/docs/pages/market/dashboard-overview.md b/docs/pages/market/dashboard-overview.md new file mode 100644 index 0000000..415d9dc --- /dev/null +++ b/docs/pages/market/dashboard-overview.md @@ -0,0 +1,31 @@ +# Dashboard: overview + +`/dashboard/overview` · `apps/{bull,bear}/src/app/(main)/dashboard/(creator)/overview/page.tsx` · Type: account · Layout: [layout-dashboard-creator.md](layout-dashboard-creator.md), [layout-main.md](layout-main.md), [layout.md](layout.md) + +| Field | Value | +| ----------- | ------------------------------------------------------------------------------------------------------------------------- | +| Robots | `noindex` (page `metadata`) | +| Status | `200` for every viewer: a guest is sent to login in the browser, an investor sees `AuthGuard`'s page-size no-access state | +| loading.tsx | `(creator)/overview/loading.tsx`: the page's skeleton, `delayed` | +| First flush | none | +| Canonical | none: `noindex` | +| H1 | bull: none (see the layout doc); bear: «داشبورد» in the layout | +| JSON-LD | none | +| Scripts | none beyond the layout's | + +## Sections + +The creator's default tab (0072). Everything sits in `AuthGuard role="creator"`, whose fallback is the skeleton, so the server HTML is only the skeleton. + +| Section | Data | HTML | JS | Index | Notes | +| --------------- | ------ | -------- | ------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| WelcomeBanner | viewer | skeleton | hydrate | no | only with no audience and no income (J10-0b): shares the channel through `OwnerShareSheet`, frozen with the reason until the channel is public | +| AudienceSection | viewer | skeleton | hydrate | no | «مخاطبان»: followers (ⓘ subscribers included), active subscribers, ending within 7 days with a link to `/dashboard/subscribers?filter=expiring` | +| IncomeSection | viewer | skeleton | hydrate | no | «درآمد»: total (ⓘ net), this Shamsi month, payable with a link to مالی | +| PlanBreakdown | viewer | skeleton | hydrate | no | «تفکیک طرح‌ها»: chips «مشترکان فعال» · «کل خریدها» · «درآمد», one bar per plan with count and share; a creator with no plan sees the four periods at zero | +| SignalSummary | viewer | skeleton | hydrate | no | the four numbers and the way to a public record, or the message before the first evaluation; its own `PartBoundary` and `` | + +## Notes + +- The first four share one read, `GET /me/dashboard/overview`, under one `PartBoundary`. `SignalSummary` reads `GET /me/signal-stats` with the signals tab's query, so the two tabs can't disagree. +- bull: tiles two to a row; bear: three to a row, signal tiles four to a row. Same sections in both apps. diff --git a/docs/pages/market/dashboard-plans.md b/docs/pages/market/dashboard-plans.md index 63798c0..1f152fc 100644 --- a/docs/pages/market/dashboard-plans.md +++ b/docs/pages/market/dashboard-plans.md @@ -22,7 +22,7 @@ In bull's document order. Everything sits in `AuthGuard role="creator"`, whose f | PricingCard | viewer | skeleton | hydrate | no | «قیمت طرح‌ها»: its own `PartBoundary` and `` (`useSuspenseQuery` in the browser); links to `/dashboard/pricing` | | InviteCodeCard | viewer | skeleton | hydrate | no | «کد دعوت»: renders nothing until the creator is approved (J10-1e); the invite link is built from `NEXT_PUBLIC_SITE_URL`; own `PartBoundary` and `` | | ↳ InviteShareSheet, CapacityRequestDialog | viewer | none | hydrate | no | mount when opened; bull: share opens a bottom sheet; bear: a popover beside the link field | -| AudienceStats | viewer | skeleton | hydrate | no | «مخاطبان»: follower count and active subscriptions, two browser reads; either failing fails the part | +| SubscribersPreview | viewer | skeleton | hydrate | no | «مشترکان»: the total and the three who end soonest, with «مشاهده همه» to `/dashboard/subscribers`; own `PartBoundary` and `` | ## Notes diff --git a/docs/pages/market/dashboard-subscribers.md b/docs/pages/market/dashboard-subscribers.md new file mode 100644 index 0000000..a6645f1 --- /dev/null +++ b/docs/pages/market/dashboard-subscribers.md @@ -0,0 +1,24 @@ +# Dashboard: subscribers + +`/dashboard/subscribers` · `apps/{bull,bear}/src/app/(main)/dashboard/subscribers/page.tsx` · Type: account · Layout: [layout-main.md](layout-main.md), [layout.md](layout.md) + +| Field | Value | +| ----------- | --------------------------------------------------------------------------------------------------------------- | +| Robots | `noindex` (page `metadata`) | +| Status | `200` for every viewer: a guest is sent to login in the browser, an investor sees `AuthGuard`'s no-access state | +| loading.tsx | `subscribers/loading.tsx`: the bar or title over the chips and rows, `delayed` | +| First flush | none | +| Canonical | none: `noindex` | +| H1 | bull: the bar's title; bear: `DesktopPageTitle` | +| JSON-LD | none | +| Scripts | none beyond the layout's | + +## Sections + +| Section | Data | HTML | JS | Index | Notes | +| -------------- | ------ | -------- | ------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| SubscriberList | viewer | skeleton | hydrate | no | «همه» · «در حال انقضا» from the API's totals, the chip in `?filter=`; soonest-ending first, «نمایش مشترکان بیشتر» by cursor; only the @username shows | + +## Notes + +- Pushed from نمای کلی and طرح‌های اشتراک; opened on its own, back goes to نمای کلی. Locked until registration step 5 is done (0016). diff --git a/docs/pages/market/layout-dashboard-creator.md b/docs/pages/market/layout-dashboard-creator.md index 0042270..6177921 100644 --- a/docs/pages/market/layout-dashboard-creator.md +++ b/docs/pages/market/layout-dashboard-creator.md @@ -1,19 +1,19 @@ # Layout: dashboard (creator) -`apps/{bull,bear}/src/app/(main)/dashboard/(creator)/layout.tsx` · wraps `/dashboard/plans`, `/dashboard/predictions` and `/dashboard/finance` · it awaits no read, so it adds nothing to any page's first flush; it sits outside each tab's `loading.tsx`, so the bar and the tabs stay while a tab loads +`apps/{bull,bear}/src/app/(main)/dashboard/(creator)/layout.tsx` · wraps `/dashboard/overview`, `/dashboard/plans`, `/dashboard/predictions` and `/dashboard/finance` · it awaits no read, so it adds nothing to any page's first flush; it sits outside each tab's `loading.tsx`, so the bar and the tabs stay while a tab loads -| Section | Data | HTML | JS | Index | Notes | -| -------------------------------------------- | ------ | ----------- | ------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| OnboardingGuard | viewer | none | hydrate | no | renders its children unchanged; once the browser knows the viewer, a creator who hasn't finished step 5 is sent to `/onboarding/creator-profile` with a return path (0016) | -| MobileTopBar (bull) | config | first flush | hydrate | no | `isTab`: the brand and «داشبورد» centred, in a ``; support entry; the connection bar under it (0040) | -| ↳ NotificationBell and account avatar (bull) | viewer | none | hydrate | no | member only; while the viewer is unknown, the guest's «ورود/ثبت‌نام» holds the end of the bar, invisible | -| «داشبورد» `

` (bear) | config | first flush | none | no | at the top of the 640 column | -| DashboardTabs | config | first flush | hydrate | no | `role="creator"`: island `TabLinks`, an `` per tab «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی» (0034); the active tab comes from `usePathname`, so the server HTML already marks it | +| Section | Data | HTML | JS | Index | Notes | +| -------------------------------------------- | ------ | ----------- | ------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| OnboardingGuard | viewer | none | hydrate | no | renders its children unchanged; once the browser knows the viewer, a creator who hasn't finished step 5 is sent to `/onboarding/creator-profile` with a return path (0016) | +| MobileTopBar (bull) | config | first flush | hydrate | no | `isTab`: the brand and «داشبورد» centred, in a ``; support entry; the connection bar under it (0040) | +| ↳ NotificationBell and account avatar (bull) | viewer | none | hydrate | no | member only; while the viewer is unknown, the guest's «ورود/ثبت‌نام» holds the end of the bar, invisible | +| «داشبورد» `

` (bear) | config | first flush | none | no | at the top of the 640 column | +| DashboardTabs | config | first flush | hydrate | no | `role="creator"`: island `TabLinks`, an `` per tab «نمای کلی» · «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی» (0034, 0072); the active tab comes from `usePathname`, so the server HTML already marks it | Scripts: none beyond the root layout's. ## Notes -- The tabs' URLs don't overlap the investor group's: `(creator)` owns `plans`, `predictions` and `finance`, `(investor)` owns `subscriptions`, `transactions` and `following`. There is no `/dashboard` page, so `/dashboard` answers the root not-found. The bottom nav (bull) and the header (bear) link a creator to `/dashboard/plans` and an investor to `/dashboard/subscriptions`. +- The tabs' URLs don't overlap the investor group's: `(creator)` owns `overview`, `plans`, `predictions` and `finance`, `(investor)` owns `subscriptions`, `transactions` and `following`. There is no `/dashboard` page, so `/dashboard` answers the root not-found. The bottom nav (bull) and the header (bear) link a creator to `/dashboard/overview` and an investor to `/dashboard/subscriptions`. - The layout doesn't check the role: each page's `AuthGuard role="creator"` shows an investor the page-size no-access state, under these tabs. - Debt: bull has no `

` (the bar's «داشبورد» is a ``), bear has one, `apps/bull/src/app/(main)/dashboard/(creator)/layout.tsx:22`. Make the bar's tab title an `

` on tab screens, or add a visually hidden `

` in the bull layout. diff --git a/packages/tools/src/format/format.ts b/packages/tools/src/format/format.ts index 8e1e2b1..ab0b30b 100644 --- a/packages/tools/src/format/format.ts +++ b/packages/tools/src/format/format.ts @@ -31,6 +31,11 @@ const dateFormatter = new Intl.DateTimeFormat(LOCALE, { month: 'long', year: 'numeric', }); +const monthFormatter = new Intl.DateTimeFormat(LOCALE, { + timeZone: TIME_ZONE, + month: 'long', + year: 'numeric', +}); const timeFormatter = new Intl.DateTimeFormat(LOCALE, { timeZone: TIME_ZONE, hour: '2-digit', @@ -171,6 +176,15 @@ export function date( return time ? `${day}${DATE_TIME_JOINER}${timeFormatter.format(at)}` : day; } +/** The Shamsi month and year in Tehran: `مهر 1405`. */ +export function month(value: DateInput): string { + // Intl writes the year first in Persian. + const parts = monthFormatter.formatToParts(toDate(value)); + const part = (type: Intl.DateTimeFormatPartTypes) => + parts.find((item) => item.type === type)?.value ?? ''; + return `${part('month')} ${part('year')}`; +} + /** Time of day in Tehran: `14:05`, such as when a draft was last saved. */ export function time(value: DateInput): string { return timeFormatter.format(toDate(value)); diff --git a/packages/tools/src/format/index.ts b/packages/tools/src/format/index.ts index 70fab13..9dd3e34 100644 --- a/packages/tools/src/format/index.ts +++ b/packages/tools/src/format/index.ts @@ -7,6 +7,7 @@ export { iso, latinDigits, list, + month, number, percent, price, diff --git a/platforms/market/src/app/navigation/components/bottom-nav/BottomNav.tsx b/platforms/market/src/app/navigation/components/bottom-nav/BottomNav.tsx index f45be82..ae07515 100644 --- a/platforms/market/src/app/navigation/components/bottom-nav/BottomNav.tsx +++ b/platforms/market/src/app/navigation/components/bottom-nav/BottomNav.tsx @@ -74,7 +74,9 @@ export function BottomNav() { )} { diff --git a/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-share/index.ts b/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-share/index.ts index bd4a4f4..ad7ba8e 100644 --- a/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-share/index.ts +++ b/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-share/index.ts @@ -1,2 +1,3 @@ export { ChannelShare } from './ChannelShare'; +export { OwnerShareSheet } from './components/OwnerShareSheet'; export type { ChannelShareProps } from './types'; diff --git a/platforms/market/src/app/screens/(main)/dashboard/organisms/dashboard-tabs/DashboardTabs.tsx b/platforms/market/src/app/screens/(main)/dashboard/organisms/dashboard-tabs/DashboardTabs.tsx index 7426b6d..e75c1d6 100644 --- a/platforms/market/src/app/screens/(main)/dashboard/organisms/dashboard-tabs/DashboardTabs.tsx +++ b/platforms/market/src/app/screens/(main)/dashboard/organisms/dashboard-tabs/DashboardTabs.tsx @@ -9,8 +9,8 @@ import type { DashboardTabsProps } from './types'; /** * The داشبورد's section row, full width, the current one underlined: the investor's «اشتراک‌ها» · - * «تراکنش‌ها» · «دنبال‌شده‌ها» (U8 ۴.۱, ۶.۱; U8 ۵.۲), or the creator's «طرح‌های اشتراک» · - * «سیگنال‌ها» · «مالی» (Creator Dashboard ۱.۱, J10-0, 0034). The dashboard layout renders it once, so it stays put while a section + * «تراکنش‌ها» · «دنبال‌شده‌ها» (U8 ۴.۱, ۶.۱; U8 ۵.۲), or the creator's «نمای کلی» · + * «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی» (J10-0, 0034, 0072). The dashboard layout renders it once, so it stays put while a section * loads; the current one comes from the URL, which the server render already knows. */ export function DashboardTabs({ diff --git a/platforms/market/src/app/screens/(main)/dashboard/organisms/dashboard-tabs/constants.ts b/platforms/market/src/app/screens/(main)/dashboard/organisms/dashboard-tabs/constants.ts index 796f8d8..91b6ace 100644 --- a/platforms/market/src/app/screens/(main)/dashboard/organisms/dashboard-tabs/constants.ts +++ b/platforms/market/src/app/screens/(main)/dashboard/organisms/dashboard-tabs/constants.ts @@ -7,8 +7,9 @@ export const INVESTOR_TABS = [ { href: ROUTES.dashboard.following, label: 'tabs.following' }, ] as const; -/** The creator's three tabs, «طرح‌های اشتراک» first (Creator Dashboard ۱.۱, J10-0). */ +/** The creator's four tabs, «نمای کلی» first (J10-0). */ export const CREATOR_TABS = [ + { href: ROUTES.dashboard.overview, label: 'creator-tabs.overview' }, { href: ROUTES.dashboard.plans, label: 'creator-tabs.plans' }, { href: ROUTES.dashboard.predictions, label: 'creator-tabs.predictions' }, { href: ROUTES.dashboard.finance, label: 'creator-tabs.finance' }, diff --git a/platforms/market/src/app/screens/(main)/dashboard/organisms/subscriber-row/SubscriberRow.tsx b/platforms/market/src/app/screens/(main)/dashboard/organisms/subscriber-row/SubscriberRow.tsx new file mode 100644 index 0000000..8c1ed37 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/organisms/subscriber-row/SubscriberRow.tsx @@ -0,0 +1,50 @@ +'use client'; + +import { Avatar } from '@lumina/island/atoms/avatar'; +import { StatusBadge } from '@lumina/island/atoms/status-badge'; +import { ListRow } from '@lumina/island/molecules/list-row'; +import { Element } from '@lumina/island/primitives/element'; +import { date, number } from '@lumina/tools/format'; +import { useTranslation } from 'react-i18next'; + +import { subscriberDaysLeft } from '../../../../../../features/overview'; +import type { SubscriberRowProps } from './types'; + +/** + * One subscriber: the @username, plan and end date, with how long is left in its last week. Only + * the @username ever shows, never a phone or a name. + */ +export function SubscriberRow({ subscriber }: SubscriberRowProps) { + const { t } = useTranslation(['dashboard', 'common']); + const daysLeft = subscriberDaysLeft(subscriber.endsAt); + const until = date(subscriber.endsAt, { time: false }); + + return ( + + } + title={ + + @{subscriber.username ?? '—'} + + } + subtitle={ + subscriber.tier + ? t('subscribers.until-plan', { + plan: t(`common:billing-periods.${subscriber.tier}`), + date: until, + }) + : t('subscribers.until', { date: until }) + } + end={ + daysLeft !== null && ( + + {t('subscribers.days-left', { n: number(daysLeft) })} + + ) + } + chevron={false} + /> + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/organisms/subscriber-row/index.ts b/platforms/market/src/app/screens/(main)/dashboard/organisms/subscriber-row/index.ts new file mode 100644 index 0000000..219f6a8 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/organisms/subscriber-row/index.ts @@ -0,0 +1 @@ +export { SubscriberRow } from './SubscriberRow'; diff --git a/platforms/market/src/app/screens/(main)/dashboard/organisms/subscriber-row/types.ts b/platforms/market/src/app/screens/(main)/dashboard/organisms/subscriber-row/types.ts new file mode 100644 index 0000000..1e85fca --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/organisms/subscriber-row/types.ts @@ -0,0 +1,3 @@ +import type { OwnSubscriberPayload } from '../../../../../../features/overview'; + +export type SubscriberRowProps = { subscriber: OwnSubscriberPayload }; diff --git a/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/DashboardOverview.tsx b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/DashboardOverview.tsx new file mode 100644 index 0000000..1612de7 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/DashboardOverview.tsx @@ -0,0 +1,27 @@ +'use client'; + +import { FlexBox } from '@lumina/island/atoms/flex-box'; + +import { useDashboardOverviewPart } from '../../../../../../../features/overview'; +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. */ +export function DashboardOverview({ layout }: DashboardOverviewProps) { + const overview = useDashboardOverviewPart(); + const cols = layout === 'desktop' ? 'grid-cols-3' : 'grid-cols-2'; + + return ( + + {overview.isNewcomer && } + + + + + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/DashboardOverviewSkeleton.tsx b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/DashboardOverviewSkeleton.tsx new file mode 100644 index 0000000..8b8da1d --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/DashboardOverviewSkeleton.tsx @@ -0,0 +1,43 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { GridBox } from '@lumina/island/atoms/grid-box'; +import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton'; + +import type { DashboardOverviewSkeletonProps } from './types'; + +/** «نمای کلی» before it arrives: each section's title over its tiles, the plans' card under them. */ +export function DashboardOverviewSkeleton({ + layout, + label, + delayed, +}: DashboardOverviewSkeletonProps) { + const cols = layout === 'desktop' ? 'grid-cols-3' : 'grid-cols-2'; + + return ( + + + {[0, 1].map((section) => ( + + + + {[0, 1, 2].map((tile) => ( + + + + + ))} + + + ))} + + + + + + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/AudienceSection.tsx b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/AudienceSection.tsx new file mode 100644 index 0000000..3d63bc6 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/AudienceSection.tsx @@ -0,0 +1,81 @@ +import { GridBox } from '@lumina/island/atoms/grid-box'; +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { Link } from '@lumina/island/atoms/link'; +import { InfoTip } from '@lumina/island/molecules/info-tip'; +import { SectionTitle } from '@lumina/island/molecules/section-title'; +import { StatTile } from '@lumina/island/molecules/stat-tile'; +import { number } from '@lumina/tools/format'; +import { Element } from '@lumina/island/primitives/element'; +import { useId } from 'react'; +import { useTranslation } from 'react-i18next'; + +import { SUBSCRIBERS_EXPIRING_HREF } from '../constants'; +import type { OverviewSectionProps } from '../types'; + +/** + * «مخاطبان»: followers (the creator's own figure, subscribers included), who subscribes now and + * who ends within a week, with the way to see them. Counts only, never a list of people here. + */ +export function AudienceSection({ overview, cols }: OverviewSectionProps) { + const { t } = useTranslation('dashboard'); + const titleId = useId(); + + return ( + + + + + {t('overview.audience.followers')} + + {t('overview.audience.followers-tip')} + + + } + value={number(overview.followers)} + /> + + 0 && ( + + + {t('overview.audience.expiring-link')} + + + ) + } + /> + + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/IncomeSection.tsx b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/IncomeSection.tsx new file mode 100644 index 0000000..dd59543 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/IncomeSection.tsx @@ -0,0 +1,92 @@ +import { Amount } from '@lumina/island/atoms/amount'; +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { GridBox } from '@lumina/island/atoms/grid-box'; +import { Link } from '@lumina/island/atoms/link'; +import { InfoTip } from '@lumina/island/molecules/info-tip'; +import { SectionTitle } from '@lumina/island/molecules/section-title'; +import { StatTile } from '@lumina/island/molecules/stat-tile'; +import { month } from '@lumina/tools/format'; +import { Element } from '@lumina/island/primitives/element'; +import { useId } from 'react'; +import { useTranslation } from 'react-i18next'; + +import { ROUTES } from '../../../../../../../navigation/navigation'; +import type { OverviewSectionProps } from '../types'; + +/** + * «درآمد»: everything earned, net of commission and refunds, this Shamsi month's part of it, and + * what can be paid out, with the way to مالی. + */ +export function IncomeSection({ overview, cols }: OverviewSectionProps) { + const { t } = useTranslation(['dashboard', 'common']); + const titleId = useId(); + const currency = t('common:currency'); + + return ( + + + + + {t('overview.income.total')} + + {t('overview.income.total-tip')} + + + } + value={ + + } + /> + + } + hint={month(new Date())} + /> + + } + footer={ + + + {t('overview.income.payable-link')} + + + } + /> + + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/PlanBreakdown.tsx b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/PlanBreakdown.tsx new file mode 100644 index 0000000..1277326 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/PlanBreakdown.tsx @@ -0,0 +1,68 @@ +'use client'; + +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { Typography } from '@lumina/island/atoms/typography'; +import { Card } from '@lumina/island/molecules/card'; +import { FilterChips } from '@lumina/island/molecules/filter-chips'; +import { Meter } from '@lumina/island/molecules/meter'; +import { SectionTitle } from '@lumina/island/molecules/section-title'; +import { number, percent } from '@lumina/tools/format'; +import { useId, useState } from 'react'; +import { useTranslation } from 'react-i18next'; + +import { planBreakdownRows } from '../../../../../../../../features/overview'; +import type { PlanBreakdownMetric } from '../../../../../../../../features/overview'; +import { PLAN_BREAKDOWN_METRICS } from '../constants'; +import type { PlanBreakdownProps } from '../types'; + +/** + * «تفکیک طرح‌ها»: one bar per plan, by active subscribers, every purchase or income, the chips + * choosing which. The note says what «کل خریدها» counts. + */ +export function PlanBreakdown({ plans }: PlanBreakdownProps) { + const { t } = useTranslation(['dashboard', 'common']); + const [metric, setMetric] = useState('active'); + const titleId = useId(); + + return ( + + + ({ + value, + label: t(`overview.plans.metrics.${value}`), + }))} + value={metric} + onChange={setMetric} + /> + + + {planBreakdownRows(plans, metric).map((row) => ( + + ))} + + + + {t('overview.plans.note')} + + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/SignalSummary.tsx b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/SignalSummary.tsx new file mode 100644 index 0000000..d1ba3e6 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/SignalSummary.tsx @@ -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 ; + return ( + + + + + ); +} + +/** + * «عملکرد سیگنال‌ها» 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 ( + + + + + } + > + + + + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/WelcomeBanner.tsx b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/WelcomeBanner.tsx new file mode 100644 index 0000000..7520217 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/WelcomeBanner.tsx @@ -0,0 +1,72 @@ +'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'); + + const share = ( + + ); + + return ( + + + {layout === 'desktop' ? ( + t('overview.welcome.text') + ) : ( + // A phone has no room beside the text, so the button goes under it. + + {t('overview.welcome.text')} + {share} + + )} + + + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/constants.ts b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/constants.ts new file mode 100644 index 0000000..35eccf7 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/constants.ts @@ -0,0 +1,11 @@ +import type { PlanBreakdownMetric } from '../../../../../../../features/overview'; +import { ROUTES } from '../../../../../../navigation/navigation'; + +/** «مشترکان» opened on who ends within a week (J10-1g). */ +export const SUBSCRIBERS_EXPIRING_HREF = `${ROUTES.dashboard.subscribers}?filter=expiring`; + +export const PLAN_BREAKDOWN_METRICS: readonly PlanBreakdownMetric[] = [ + 'active', + 'purchases', + 'income', +]; diff --git a/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/index.ts b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/index.ts new file mode 100644 index 0000000..b33089a --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/index.ts @@ -0,0 +1,3 @@ +export { DashboardOverview } from './DashboardOverview'; +export { DashboardOverviewSkeleton } from './DashboardOverviewSkeleton'; +export type { DashboardOverviewSkeletonProps } from './types'; diff --git a/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/types.ts b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/types.ts new file mode 100644 index 0000000..cda2f1c --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/types.ts @@ -0,0 +1,27 @@ +import type { DashboardOverviewPartModel } from '../../../../../../../features/overview'; + +export type DashboardOverviewLayout = 'mobile' | 'desktop'; + +export type DashboardOverviewProps = { layout: DashboardOverviewLayout }; + +export type OverviewSectionProps = { + overview: DashboardOverviewPartModel; + /** Three tiles in a row on desktop, two on mobile. */ + cols: 'grid-cols-2' | 'grid-cols-3'; +}; + +export type DashboardOverviewSkeletonProps = { + layout: DashboardOverviewLayout; + /** Hidden status text: «در حال بارگذاری نمای کلی…». */ + label: string; + /** Fades in after 300 ms, so a fast route never flashes it (`loading.tsx` only, G-3d). */ + delayed?: boolean; +}; + +export type PlanBreakdownProps = { + plans: DashboardOverviewPartModel['plans']; +}; + +export type SignalSummaryProps = DashboardOverviewProps; + +export type WelcomeBannerProps = DashboardOverviewProps; diff --git a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/AudienceStats.tsx b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/AudienceStats.tsx deleted file mode 100644 index 2a791de..0000000 --- a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/AudienceStats.tsx +++ /dev/null @@ -1,49 +0,0 @@ -'use client'; - -import { FlexBox } from '@lumina/island/atoms/flex-box'; -import { GridBox } from '@lumina/island/atoms/grid-box'; -import { Typography } from '@lumina/island/atoms/typography'; -import { StatTile } from '@lumina/island/molecules/stat-tile'; -import { number } from '@lumina/tools/format'; -import { useId } from 'react'; -import { useTranslation } from 'react-i18next'; - -import { useAudiencePart } from '../../../../../../../features/overview'; - -/** - * طرح‌های اشتراک › «مخاطبان» (J10-1): two tiles, «دنبال‌کنندگان» and «مشترکان فعال», then who can - * see which. Counts only, never a list of people. A section on the page, not a card. - */ -export function AudienceStats() { - const { t } = useTranslation('dashboard'); - const model = useAudiencePart(); - const headingId = useId(); - - return ( - - - {t('audience.title')} - - - - - - - {t('audience.note')} - - - ); -} diff --git a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/AudienceStatsSkeleton.tsx b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/AudienceStatsSkeleton.tsx deleted file mode 100644 index 567dfc5..0000000 --- a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/AudienceStatsSkeleton.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { FlexBox } from '@lumina/island/atoms/flex-box'; -import { GridBox } from '@lumina/island/atoms/grid-box'; -import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton'; - -import type { AudienceStatsSkeletonProps } from './types'; - -/** «مخاطبان» before it arrives: its title, the two tiles and the line under them. */ -export function AudienceStatsSkeleton({ - label, - delayed, -}: AudienceStatsSkeletonProps) { - return ( - - - - - {[0, 1].map((tile) => ( - - - - - ))} - - - - - ); -} diff --git a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/index.ts b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/index.ts deleted file mode 100644 index 59055f9..0000000 --- a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { AudienceStats } from './AudienceStats'; -export { AudienceStatsSkeleton } from './AudienceStatsSkeleton'; -export type { AudienceStatsSkeletonProps } from './types'; diff --git a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/types.ts b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/types.ts deleted file mode 100644 index db9ab5d..0000000 --- a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/audience-stats/types.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type AudienceStatsSkeletonProps = { - /** Hidden status text: «در حال بارگذاری مخاطبان…». */ - label: string; - /** Fades in after 300ms, so a fast route never flashes grey. loading.tsx only. */ - delayed?: boolean; -}; diff --git a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/SubscribersPreview.tsx b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/SubscribersPreview.tsx new file mode 100644 index 0000000..fe061f2 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/SubscribersPreview.tsx @@ -0,0 +1,55 @@ +'use client'; + +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { Typography } from '@lumina/island/atoms/typography'; +import { List } from '@lumina/island/molecules/list-row'; +import { SectionTitle } from '@lumina/island/molecules/section-title'; +import { useId } from 'react'; +import { useTranslation } from 'react-i18next'; + +import { useSubscribersPreviewPart } from '../../../../../../../features/overview'; +import { ROUTES } from '../../../../../../navigation/navigation'; +import { SubscriberRow } from '../../../organisms/subscriber-row'; + +/** طرح‌های اشتراک › «مشترکان» (J10-1): the soonest-ending few, then the whole list a tap away. */ +export function SubscribersPreview() { + const { t } = useTranslation('dashboard'); + const { total, items } = useSubscribersPreviewPart(); + const titleId = useId(); + + return ( + + 0 ? t('subscribers.view-all') : undefined} + actionHref={total > 0 ? ROUTES.dashboard.subscribers : undefined} + /> + {total > 0 ? ( + <> + + {items.map((subscriber) => ( + + ))} + + + {t('subscribers.privacy-short')} + + + ) : ( + + {t('subscribers.empty.all')} + + )} + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/SubscribersPreviewSkeleton.tsx b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/SubscribersPreviewSkeleton.tsx new file mode 100644 index 0000000..0da790d --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/SubscribersPreviewSkeleton.tsx @@ -0,0 +1,18 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { Skeleton } from '@lumina/island/atoms/skeleton'; +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; + +import type { SubscribersPreviewSkeletonProps } from './types'; + +/** «مشترکان» before it arrives: its title over the rows. */ +export function SubscribersPreviewSkeleton({ + label, + delayed, +}: SubscribersPreviewSkeletonProps) { + return ( + + + + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/index.ts b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/index.ts new file mode 100644 index 0000000..cd6b7fc --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/index.ts @@ -0,0 +1,2 @@ +export { SubscribersPreview } from './SubscribersPreview'; +export { SubscribersPreviewSkeleton } from './SubscribersPreviewSkeleton'; diff --git a/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/types.ts b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/types.ts new file mode 100644 index 0000000..4b7c3af --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/plans/organisms/subscribers-preview/types.ts @@ -0,0 +1,6 @@ +export type SubscribersPreviewSkeletonProps = { + /** Hidden status text: «در حال بارگذاری مشترکان…». */ + label: string; + /** Fades in after 300 ms, so a fast route never flashes it (`loading.tsx` only, G-3d). */ + delayed?: boolean; +}; diff --git a/platforms/market/src/app/screens/(main)/dashboard/predictions/all/organisms/prediction-list/PredictionList.tsx b/platforms/market/src/app/screens/(main)/dashboard/predictions/all/organisms/prediction-list/PredictionList.tsx index b75fdef..3708555 100644 --- a/platforms/market/src/app/screens/(main)/dashboard/predictions/all/organisms/prediction-list/PredictionList.tsx +++ b/platforms/market/src/app/screens/(main)/dashboard/predictions/all/organisms/prediction-list/PredictionList.tsx @@ -28,18 +28,20 @@ export function PredictionList({ layout }: PredictionListProps) { return ( - ({ - value: status, - label: t(`list.filters.${status}`, { - n: number(model.counts[status]), - }), - }))} - value={model.status} - onChange={model.setStatus} - /> + {model.counts.open !== null && ( + ({ + value: status, + label: t(`list.filters.${status}`, { + n: number(model.counts[status] ?? 0), + }), + }))} + value={model.status} + onChange={model.setStatus} + /> + )} {model.items.length === 0 ? ( model.counts.all === 0 ? ( + + {model.items.length === 0 ? ( + + ) : ( + + {model.items.map((subscriber) => ( + + ))} + + )} + {model.loadMoreError ? ( + + ) : ( + model.hasMore && ( + + ) + )} + {model.filter === 'expiring' && ( + + {t('subscribers.expiring-note')} + + )} + + {t('subscribers.privacy')} + + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/SubscriberListSkeleton.tsx b/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/SubscriberListSkeleton.tsx new file mode 100644 index 0000000..1f12039 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/SubscriberListSkeleton.tsx @@ -0,0 +1,21 @@ +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { Skeleton } from '@lumina/island/atoms/skeleton'; +import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; + +import type { SubscriberListSkeletonProps } from './types'; + +/** «مشترکان» before it arrives: the chips' row, then the rows. */ +export function SubscriberListSkeleton({ + label, + delayed, +}: SubscriberListSkeletonProps) { + return ( + + + + + + + + ); +} diff --git a/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/index.ts b/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/index.ts new file mode 100644 index 0000000..d838720 --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/index.ts @@ -0,0 +1,2 @@ +export { SubscriberList } from './SubscriberList'; +export { SubscriberListSkeleton } from './SubscriberListSkeleton'; diff --git a/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/types.ts b/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/types.ts new file mode 100644 index 0000000..abc9b4f --- /dev/null +++ b/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/types.ts @@ -0,0 +1,6 @@ +export type SubscriberListSkeletonProps = { + /** Hidden status text: «در حال بارگذاری مشترکان…». */ + label: string; + /** Fades in after 300 ms, so a fast route never flashes it (`loading.tsx` only, G-3d). */ + delayed?: boolean; +}; diff --git a/platforms/market/src/app/screens/(onboarding)/onboarding/creator-profile/organisms/creator-profile-step/components/ProfileForm.tsx b/platforms/market/src/app/screens/(onboarding)/onboarding/creator-profile/organisms/creator-profile-step/components/ProfileForm.tsx index 38ed207..17918ce 100644 --- a/platforms/market/src/app/screens/(onboarding)/onboarding/creator-profile/organisms/creator-profile-step/components/ProfileForm.tsx +++ b/platforms/market/src/app/screens/(onboarding)/onboarding/creator-profile/organisms/creator-profile-step/components/ProfileForm.tsx @@ -37,9 +37,8 @@ import { SaveStatus } from './SaveStatus'; import { StepLayout } from './StepLayout'; /** - * Step 5's form for a creator, top to bottom: photo, bio, markets, links and, once there is a - * link, the consent; «تکمیل ثبت‌نام» under it with the autosave line. Leaving a field saves at - * once. The preview opens in a sheet on mobile and stays beside the form on desktop. + * Step 5's form for a creator, top to bottom: photo, bio, markets, links and the consent; + * «تکمیل ثبت‌نام» under it with the autosave line. Leaving a field saves at once. The preview opens in a sheet on mobile and stays beside the form on desktop. */ export function ProfileForm({ page, @@ -210,34 +209,32 @@ export function ProfileForm({ layout={layout} optional /> - {links.rows.length > 0 && ( - ( - - field.onChange(event.target.checked)} - onBlur={field.onBlur} - invalid={fieldState.error != null} - aria-describedby={ - fieldState.error ? consentErrorId : undefined - } - > - {t('register.profile.links.consent')} - - {fieldState.error && ( - - {translateMessage(t, fieldState.error.message)} - - )} - - )} - /> - )} + ( + + field.onChange(event.target.checked)} + onBlur={field.onBlur} + invalid={fieldState.error != null} + aria-describedby={ + fieldState.error ? consentErrorId : undefined + } + > + {t('register.profile.links.consent')} + + {fieldState.error && ( + + {translateMessage(t, fieldState.error.message)} + + )} + + )} + />