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/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/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)/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/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..30af7fe
--- /dev/null
+++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/types.ts
@@ -0,0 +1,11 @@
+export type DashboardOverviewLayout = 'mobile' | 'desktop';
+
+export type DashboardOverviewProps = { layout: DashboardOverviewLayout };
+
+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;
+};
diff --git a/platforms/market/src/app/screens/organisms/page-error/constants.ts b/platforms/market/src/app/screens/organisms/page-error/constants.ts
index 51f46d2..44812e5 100644
--- a/platforms/market/src/app/screens/organisms/page-error/constants.ts
+++ b/platforms/market/src/app/screens/organisms/page-error/constants.ts
@@ -8,6 +8,7 @@ export const TAB_BARS: Record = {
[ROUTES.dashboard.subscriptions]: { kind: 'tab', title: 'nav.dashboard' },
[ROUTES.dashboard.transactions]: { kind: 'tab', title: 'nav.dashboard' },
[ROUTES.dashboard.following]: { kind: 'tab', title: 'nav.dashboard' },
+ [ROUTES.dashboard.overview]: { kind: 'tab', title: 'nav.dashboard' },
[ROUTES.dashboard.plans]: { kind: 'tab', title: 'nav.dashboard' },
[ROUTES.dashboard.finance]: { kind: 'tab', title: 'nav.dashboard' },
};
diff --git a/platforms/market/src/features/notification/models/notification-centre/use-notification-centre.ts b/platforms/market/src/features/notification/models/notification-centre/use-notification-centre.ts
index 2a41047..b125181 100644
--- a/platforms/market/src/features/notification/models/notification-centre/use-notification-centre.ts
+++ b/platforms/market/src/features/notification/models/notification-centre/use-notification-centre.ts
@@ -29,12 +29,13 @@ const CREATOR_LINK = /^\/traders\/([^/?#]+)/;
// The app pages a notification may open; a channel and its posts (a closed prediction) and a
// channel's checkout (a payment the bank never confirmed, capacity opened with the code) open too.
-// Any other link, such as a page not built yet (the creator's /dashboard/subscribers) or another
-// site, leaves the item plain rather than leading to not-found.
+// Any other link, such as another site, leaves the item plain rather than leading to not-found.
const IN_APP_PATHS: ReadonlySet = new Set([
ROUTES.dashboard.subscriptions,
ROUTES.dashboard.transactions,
+ ROUTES.dashboard.overview,
ROUTES.dashboard.plans,
+ ROUTES.dashboard.subscribers,
ROUTES.dashboard.finance,
ROUTES.account.profile,
ROUTES.notifications,
diff --git a/platforms/market/src/features/overview/index.ts b/platforms/market/src/features/overview/index.ts
index c3c130d..32a6433 100644
--- a/platforms/market/src/features/overview/index.ts
+++ b/platforms/market/src/features/overview/index.ts
@@ -1,5 +1,7 @@
export { useAudiencePart } from './models/audience';
export type { AudiencePartModel } from './models/audience';
+export { useDashboardOverviewPart } from './models/dashboard-overview';
+export type { DashboardOverviewPartModel } from './models/dashboard-overview';
export { useOwnSubscriberCount } from './models/own-subscriber-count';
export type { UseOwnSubscriberCountOptions } from './models/own-subscriber-count';
export {
@@ -9,5 +11,10 @@ export {
export type {
CreatorDashboardPayload,
CreatorTierPayload,
+ DashboardOverviewPayload,
+ DashboardOverviewPlan,
+ OwnSubscriberPayload,
+ OwnSubscribersFilter,
+ OwnSubscribersPagePayload,
RecentPaymentPayload,
} from './repositories/creator-dashboard';
diff --git a/platforms/market/src/features/overview/models/dashboard-overview/index.ts b/platforms/market/src/features/overview/models/dashboard-overview/index.ts
new file mode 100644
index 0000000..feb20a6
--- /dev/null
+++ b/platforms/market/src/features/overview/models/dashboard-overview/index.ts
@@ -0,0 +1,2 @@
+export { useDashboardOverviewPart } from './use-dashboard-overview-part';
+export type { DashboardOverviewPartModel } from './types';
diff --git a/platforms/market/src/features/overview/models/dashboard-overview/types.ts b/platforms/market/src/features/overview/models/dashboard-overview/types.ts
new file mode 100644
index 0000000..6fcd32d
--- /dev/null
+++ b/platforms/market/src/features/overview/models/dashboard-overview/types.ts
@@ -0,0 +1,9 @@
+import type { DashboardOverviewPayload } from '../../repositories/creator-dashboard';
+
+/** «نمای کلی» (J10-0): the API's figures, read once for the whole tab. */
+export type DashboardOverviewPartModel = DashboardOverviewPayload & {
+ /** Plans with someone on them now, for «در {n} طرح». */
+ plansWithSubscribers: number;
+ /** No audience and no income yet: the page says how to start (J10-0b). */
+ isNewcomer: boolean;
+};
diff --git a/platforms/market/src/features/overview/models/dashboard-overview/use-dashboard-overview-part.ts b/platforms/market/src/features/overview/models/dashboard-overview/use-dashboard-overview-part.ts
new file mode 100644
index 0000000..4ec7aac
--- /dev/null
+++ b/platforms/market/src/features/overview/models/dashboard-overview/use-dashboard-overview-part.ts
@@ -0,0 +1,38 @@
+import { useSuspenseQuery } from '@tanstack/react-query';
+
+import { BILLING_PERIODS } from '../../../../shared/constants';
+import {
+ creatorDashboardRepository,
+ overviewKeys,
+} from '../../repositories/creator-dashboard';
+import type { DashboardOverviewPartModel } from './types';
+
+/**
+ * داشبورد › نمای کلی (J10-0): audience, income and the split by plan, in the browser only. A creator
+ * with no plan yet still sees the four periods at zero (J10-0b).
+ */
+export function useDashboardOverviewPart(): DashboardOverviewPartModel {
+ const { data } = useSuspenseQuery({
+ queryKey: overviewKeys.overview(),
+ queryFn: ({ signal }) => creatorDashboardRepository.getOverview({ signal }),
+ });
+ return {
+ ...data,
+ plans:
+ data.plans.length > 0
+ ? data.plans
+ : BILLING_PERIODS.map((tier) => ({
+ tier,
+ activeSubscribers: 0,
+ totalPurchases: 0,
+ income: 0,
+ })),
+ plansWithSubscribers: data.plans.filter(
+ (plan) => plan.activeSubscribers > 0,
+ ).length,
+ isNewcomer:
+ data.followers === 0 &&
+ data.activeSubscribers === 0 &&
+ data.income.total === 0,
+ };
+}
diff --git a/platforms/market/src/features/overview/repositories/creator-dashboard/constants.ts b/platforms/market/src/features/overview/repositories/creator-dashboard/constants.ts
index 38bd249..7eb6443 100644
--- a/platforms/market/src/features/overview/repositories/creator-dashboard/constants.ts
+++ b/platforms/market/src/features/overview/repositories/creator-dashboard/constants.ts
@@ -1,6 +1,13 @@
+import type { OwnSubscribersFilter } from './types';
+
export const CREATOR_DASHBOARD_ENDPOINT = '/subscriptions/me/dashboard';
+export const DASHBOARD_OVERVIEW_ENDPOINT = '/me/dashboard/overview';
+export const OWN_SUBSCRIBERS_ENDPOINT = '/me/subscribers';
export const overviewKeys = {
all: ['overview'] as const,
dashboard: () => [...overviewKeys.all, 'dashboard'] as const,
+ overview: () => [...overviewKeys.all, 'overview'] as const,
+ subscribers: (filter: OwnSubscribersFilter) =>
+ [...overviewKeys.all, 'subscribers', filter] as const,
};
diff --git a/platforms/market/src/features/overview/repositories/creator-dashboard/creator-dashboard.ts b/platforms/market/src/features/overview/repositories/creator-dashboard/creator-dashboard.ts
index 2fccf6f..b688528 100644
--- a/platforms/market/src/features/overview/repositories/creator-dashboard/creator-dashboard.ts
+++ b/platforms/market/src/features/overview/repositories/creator-dashboard/creator-dashboard.ts
@@ -1,9 +1,20 @@
import { overviewHttp } from '../../http';
-import { CREATOR_DASHBOARD_ENDPOINT } from './constants';
-import { toCreatorDashboardPayload } from './mappers';
+import {
+ CREATOR_DASHBOARD_ENDPOINT,
+ DASHBOARD_OVERVIEW_ENDPOINT,
+ OWN_SUBSCRIBERS_ENDPOINT,
+} from './constants';
+import {
+ toCreatorDashboardPayload,
+ toOwnSubscribersPagePayload,
+} from './mappers';
import type {
CreatorDashboardPayload,
CreatorDashboardResponseDto,
+ DashboardOverviewPayload,
+ OwnSubscribersFilter,
+ OwnSubscribersPagePayload,
+ OwnSubscribersPageResponseDto,
} from './types';
/** The signed-in creator's subscription figures. Creator session only: an investor gets 403. */
@@ -17,4 +28,26 @@ export const creatorDashboardRepository = {
);
return toCreatorDashboardPayload(response);
},
+
+ /** «نمای کلی»: audience, income and the split by plan. */
+ getOverview({
+ signal,
+ }: { signal?: AbortSignal } = {}): Promise {
+ return overviewHttp.get(
+ DASHBOARD_OVERVIEW_ENDPOINT,
+ { signal },
+ );
+ },
+
+ /** A page of who subscribes now, soonest-ending first. */
+ async listSubscribers(
+ { filter, cursor }: { filter: OwnSubscribersFilter; cursor?: string },
+ { signal }: { signal?: AbortSignal } = {},
+ ): Promise {
+ const response = await overviewHttp.get(
+ OWN_SUBSCRIBERS_ENDPOINT,
+ { params: { filter, cursor }, signal },
+ );
+ return toOwnSubscribersPagePayload(response);
+ },
};
diff --git a/platforms/market/src/features/overview/repositories/creator-dashboard/index.ts b/platforms/market/src/features/overview/repositories/creator-dashboard/index.ts
index 5d90111..04ad9e5 100644
--- a/platforms/market/src/features/overview/repositories/creator-dashboard/index.ts
+++ b/platforms/market/src/features/overview/repositories/creator-dashboard/index.ts
@@ -3,5 +3,10 @@ export { creatorDashboardRepository } from './creator-dashboard';
export type {
CreatorDashboardPayload,
CreatorTierPayload,
+ DashboardOverviewPayload,
+ DashboardOverviewPlan,
+ OwnSubscriberPayload,
+ OwnSubscribersFilter,
+ OwnSubscribersPagePayload,
RecentPaymentPayload,
} from './types';
diff --git a/platforms/market/src/features/overview/repositories/creator-dashboard/mappers.ts b/platforms/market/src/features/overview/repositories/creator-dashboard/mappers.ts
index 26f37e1..6c20883 100644
--- a/platforms/market/src/features/overview/repositories/creator-dashboard/mappers.ts
+++ b/platforms/market/src/features/overview/repositories/creator-dashboard/mappers.ts
@@ -1,6 +1,9 @@
+import { toApiUrl } from '../../../../shared/utils';
import type {
CreatorDashboardPayload,
CreatorDashboardResponseDto,
+ OwnSubscribersPagePayload,
+ OwnSubscribersPageResponseDto,
} from './types';
export function toCreatorDashboardPayload(
@@ -26,3 +29,15 @@ export function toCreatorDashboardPayload(
})),
};
}
+
+export function toOwnSubscribersPagePayload(
+ dto: OwnSubscribersPageResponseDto,
+): OwnSubscribersPagePayload {
+ return {
+ ...dto,
+ items: dto.items.map((item) => ({
+ ...item,
+ avatarUrl: toApiUrl(item.avatarUrl),
+ })),
+ };
+}
diff --git a/platforms/market/src/features/overview/repositories/creator-dashboard/types.ts b/platforms/market/src/features/overview/repositories/creator-dashboard/types.ts
index 202d7b7..caf22dc 100644
--- a/platforms/market/src/features/overview/repositories/creator-dashboard/types.ts
+++ b/platforms/market/src/features/overview/repositories/creator-dashboard/types.ts
@@ -46,3 +46,49 @@ export type CreatorDashboardResponseDto = {
tiers: CreatorTierEntity[];
recentTransactions: PaymentEntity[];
};
+
+/** One plan in «تفکیک طرحها». */
+export type DashboardOverviewPlan = {
+ tier: BillingPeriod;
+ /** Running now on this plan. */
+ activeSubscribers: number;
+ /** Every purchase since the start, renewals included, minus refunded ones. */
+ totalPurchases: number;
+ /** Whole Toman, net of commission and refunds. */
+ income: number;
+};
+
+/** `GET /me/dashboard/overview`, «نمای کلی» (J10-0). Income is whole Toman, net. */
+export type DashboardOverviewPayload = {
+ /** Subscribers included; only the creator sees it. */
+ followers: number;
+ activeSubscribers: number;
+ /** Ending within the next 7 days. */
+ expiringIn7d: number;
+ income: {
+ total: number;
+ /** The current Shamsi month, in Tehran. */
+ thisMonth: number;
+ payable: number;
+ };
+ plans: DashboardOverviewPlan[];
+};
+
+export type OwnSubscribersFilter = 'all' | 'expiring';
+
+/** One running subscription. Only the @username and avatar ever leave the API, never a phone. */
+export type OwnSubscriberPayload = {
+ username: string | null;
+ avatarUrl: string | null;
+ tier: BillingPeriod | null;
+ endsAt: string;
+};
+
+/** `GET /me/subscribers`: soonest-ending first, 20 a page. */
+export type OwnSubscribersPagePayload = {
+ items: OwnSubscriberPayload[];
+ counts: Record;
+ nextCursor: string | null;
+};
+
+export type OwnSubscribersPageResponseDto = OwnSubscribersPagePayload;
diff --git a/platforms/market/src/shared/locales/fa/dashboard.json b/platforms/market/src/shared/locales/fa/dashboard.json
index eddd3d7..c5c2951 100644
--- a/platforms/market/src/shared/locales/fa/dashboard.json
+++ b/platforms/market/src/shared/locales/fa/dashboard.json
@@ -135,6 +135,7 @@
"subscription-value": "{{period}} — {{name}}"
},
"creator-tabs": {
+ "overview": "نمای کلی",
"plans": "طرحهای اشتراک",
"predictions": "سیگنالها",
"finance": "مالی"
@@ -216,5 +217,10 @@
"sent": "درخواست شما ثبت شد.",
"failed": "درخواست افزایش ظرفیت ثبت نشد"
}
+ },
+ "overview": {
+ "meta-title": "نمای کلی",
+ "loading": "در حال بارگذاری نمای کلی…",
+ "error": "نمای کلی بارگذاری نشد. دوباره تلاش کنید."
}
}