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)/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/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/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/subscribers/organisms/subscriber-list/SubscriberList.tsx b/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/SubscriberList.tsx
new file mode 100644
index 0000000..393ab31
--- /dev/null
+++ b/platforms/market/src/app/screens/(main)/dashboard/subscribers/organisms/subscriber-list/SubscriberList.tsx
@@ -0,0 +1,96 @@
+'use client';
+
+import { Button } from '@lumina/island/atoms/button';
+import { FlexBox } from '@lumina/island/atoms/flex-box';
+import { Typography } from '@lumina/island/atoms/typography';
+import { EmptyState } from '@lumina/island/molecules/empty-state';
+import { ErrorState } from '@lumina/island/molecules/error-state';
+import { FilterChips } from '@lumina/island/molecules/filter-chips';
+import { List } from '@lumina/island/molecules/list-row';
+import { number } from '@lumina/tools/format';
+import { useTranslation } from 'react-i18next';
+
+import { useSubscribersPage } from '../../../../../../../features/overview';
+import { SubscriberRow } from '../../../organisms/subscriber-row';
+
+/**
+ * «مشترکان» (J10-1f, J10-1g): «همه» · «در حال انقضا», soonest-ending first, «نمایش بیشتر» for the
+ * next page. The rows stay while another chip's list loads; a failed page says so in its place.
+ */
+export function SubscriberList() {
+ const { t } = useTranslation(['dashboard', 'errors']);
+ const model = useSubscribersPage();
+
+ return (
+
+
+ {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/features/overview/index.ts b/platforms/market/src/features/overview/index.ts
index 058db1a..1ea2017 100644
--- a/platforms/market/src/features/overview/index.ts
+++ b/platforms/market/src/features/overview/index.ts
@@ -1,5 +1,3 @@
-export { useAudiencePart } from './models/audience';
-export type { AudiencePartModel } from './models/audience';
export {
planBreakdownRows,
useDashboardOverviewPart,
@@ -9,6 +7,15 @@ export type {
PlanBreakdownMetric,
PlanBreakdownRow,
} from './models/dashboard-overview';
+export {
+ subscriberDaysLeft,
+ useSubscribersPage,
+ useSubscribersPreviewPart,
+} from './models/subscribers';
+export type {
+ SubscribersPageModel,
+ SubscribersPreviewPartModel,
+} from './models/subscribers';
export { useOwnSubscriberCount } from './models/own-subscriber-count';
export type { UseOwnSubscriberCountOptions } from './models/own-subscriber-count';
export {
diff --git a/platforms/market/src/features/overview/models/audience/index.ts b/platforms/market/src/features/overview/models/audience/index.ts
deleted file mode 100644
index 091a930..0000000
--- a/platforms/market/src/features/overview/models/audience/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { useAudiencePart } from './use-audience-part';
-export type { AudiencePartModel } from './types';
diff --git a/platforms/market/src/features/overview/models/audience/types.ts b/platforms/market/src/features/overview/models/audience/types.ts
deleted file mode 100644
index 925bb52..0000000
--- a/platforms/market/src/features/overview/models/audience/types.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/** طرحهای اشتراک › «مخاطبان» (J10-1): counts only, never a list of people. */
-export type AudiencePartModel = {
- /** «دنبالکنندگان»: public, the same figure the channel shows everyone. */
- followers: number;
- /** «مشترکان فعال»: subscriptions running now; only the creator sees it. */
- activeSubscribers: number;
-};
diff --git a/platforms/market/src/features/overview/models/audience/use-audience-part.ts b/platforms/market/src/features/overview/models/audience/use-audience-part.ts
deleted file mode 100644
index 16b7774..0000000
--- a/platforms/market/src/features/overview/models/audience/use-audience-part.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { useSuspenseQueries } from '@tanstack/react-query';
-
-import { useCurrentAccount } from '../../../../stores/auth';
-import { channelKeys, channelRepository } from '../../../channel';
-import {
- creatorDashboardRepository,
- overviewKeys,
-} from '../../repositories/creator-dashboard';
-import type { AudiencePartModel } from './types';
-
-/**
- * طرحهای اشتراک › «مخاطبان» (J10-1): how many follow the creator (the channel's public count, so
- * a follow anywhere moves it) and how many subscriptions run now (from the creator's dashboard
- * figures). Counts only: the design shows no list of people. Read in the browser for the signed-in
- * creator; either read failing fails the part.
- */
-export function useAudiencePart(): AudiencePartModel {
- const creatorId = useCurrentAccount()?.id ?? '';
- const [followers, dashboard] = useSuspenseQueries({
- queries: [
- {
- queryKey: channelKeys.followerCount(creatorId),
- queryFn: ({ signal }: { signal: AbortSignal }) =>
- channelRepository.getFollowerCount({ creatorId }, { signal }),
- },
- {
- queryKey: overviewKeys.dashboard(),
- queryFn: ({ signal }: { signal: AbortSignal }) =>
- creatorDashboardRepository.get({ signal }),
- },
- ],
- });
-
- return {
- followers: followers.data,
- activeSubscribers: dashboard.data.activeSubscribers,
- };
-}
diff --git a/platforms/market/src/features/overview/models/subscribers/constants.ts b/platforms/market/src/features/overview/models/subscribers/constants.ts
new file mode 100644
index 0000000..e5cd281
--- /dev/null
+++ b/platforms/market/src/features/overview/models/subscribers/constants.ts
@@ -0,0 +1,8 @@
+/** The filter's place in the URL, so back and a reload keep it, and نمای کلی can link to it. */
+export const SUBSCRIBERS_FILTER_PARAM = 'filter';
+
+/** Rows طرحهای اشتراک shows before «مشاهده همه» (J10-1). */
+export const SUBSCRIBERS_PREVIEW_COUNT = 3;
+
+/** From here a row says how long it has left, as «در حال انقضا» counts them. */
+export const SUBSCRIBER_EXPIRING_DAYS = 7;
diff --git a/platforms/market/src/features/overview/models/subscribers/index.ts b/platforms/market/src/features/overview/models/subscribers/index.ts
new file mode 100644
index 0000000..c6246a3
--- /dev/null
+++ b/platforms/market/src/features/overview/models/subscribers/index.ts
@@ -0,0 +1,7 @@
+export { subscriberDaysLeft } from './subscriber-days';
+export { useSubscribersPage } from './use-subscribers-page';
+export { useSubscribersPreviewPart } from './use-subscribers-preview-part';
+export type {
+ SubscribersPageModel,
+ SubscribersPreviewPartModel,
+} from './types';
diff --git a/platforms/market/src/features/overview/models/subscribers/subscriber-days.test.ts b/platforms/market/src/features/overview/models/subscribers/subscriber-days.test.ts
new file mode 100644
index 0000000..d3d7cb3
--- /dev/null
+++ b/platforms/market/src/features/overview/models/subscribers/subscriber-days.test.ts
@@ -0,0 +1,21 @@
+import { describe, expect, it } from 'vitest';
+
+import { subscriberDaysLeft } from './subscriber-days';
+
+const now = Date.parse('2026-11-05T12:00:00Z');
+const inDays = (days: number) => new Date(now + days * 86400000).toISOString();
+
+describe('subscriberDaysLeft', () => {
+ it('counts a started day', () => {
+ expect(subscriberDaysLeft(inDays(3.5), now)).toBe(4);
+ });
+
+ it('stays quiet beyond a week', () => {
+ expect(subscriberDaysLeft(inDays(7), now)).toBe(7);
+ expect(subscriberDaysLeft(inDays(7.5), now)).toBeNull();
+ });
+
+ it('never says less than a day', () => {
+ expect(subscriberDaysLeft(inDays(0.1), now)).toBe(1);
+ });
+});
diff --git a/platforms/market/src/features/overview/models/subscribers/subscriber-days.ts b/platforms/market/src/features/overview/models/subscribers/subscriber-days.ts
new file mode 100644
index 0000000..f0d0060
--- /dev/null
+++ b/platforms/market/src/features/overview/models/subscribers/subscriber-days.ts
@@ -0,0 +1,12 @@
+import { SUBSCRIBER_EXPIRING_DAYS } from './constants';
+
+const DAY_MS = 24 * 60 * 60 * 1000;
+
+/** Whole days left, a started day counted, for a subscription ending soon; `null` otherwise. */
+export function subscriberDaysLeft(
+ endsAt: string,
+ now = Date.now(),
+): number | null {
+ const days = Math.ceil((new Date(endsAt).getTime() - now) / DAY_MS);
+ return days > SUBSCRIBER_EXPIRING_DAYS ? null : Math.max(days, 1);
+}
diff --git a/platforms/market/src/features/overview/models/subscribers/types.ts b/platforms/market/src/features/overview/models/subscribers/types.ts
new file mode 100644
index 0000000..20b1830
--- /dev/null
+++ b/platforms/market/src/features/overview/models/subscribers/types.ts
@@ -0,0 +1,25 @@
+import type { LoadMoreErrorKind } from '../../../../shared/utils';
+import type {
+ OwnSubscriberPayload,
+ OwnSubscribersFilter,
+} from '../../repositories/creator-dashboard';
+
+export type SubscribersPageModel = {
+ filter: OwnSubscribersFilter;
+ setFilter: (filter: OwnSubscribersFilter) => void;
+ isFiltering: boolean;
+ counts: Record;
+ items: OwnSubscriberPayload[];
+ hasMore: boolean;
+ loadMore: () => void;
+ isLoadingMore: boolean;
+ /** The next page failed: which message says so in place of «more». */
+ loadMoreError: LoadMoreErrorKind | null;
+};
+
+export type SubscribersPreviewPartModel = {
+ /** Who subscribes now, in all. */
+ total: number;
+ /** The soonest-ending few. */
+ items: OwnSubscriberPayload[];
+};
diff --git a/platforms/market/src/features/overview/models/subscribers/use-subscribers-page.ts b/platforms/market/src/features/overview/models/subscribers/use-subscribers-page.ts
new file mode 100644
index 0000000..1d4959d
--- /dev/null
+++ b/platforms/market/src/features/overview/models/subscribers/use-subscribers-page.ts
@@ -0,0 +1,69 @@
+import { useSuspenseInfiniteQuery } from '@tanstack/react-query';
+import { usePathname, useRouter, useSearchParams } from 'next/navigation';
+import { useTransition } from 'react';
+
+import { firstOfEach, loadMoreErrorKind } from '../../../../shared/utils';
+import {
+ creatorDashboardRepository,
+ overviewKeys,
+} from '../../repositories/creator-dashboard';
+import { SUBSCRIBERS_FILTER_PARAM } from './constants';
+import type { SubscribersPageModel } from './types';
+
+/**
+ * «مشترکان» (J10-1f, J10-1g): «همه» · «در حال انقضا» with the API's totals, the chip in the URL so
+ * back and a reload keep it, soonest-ending first, 20 a page by cursor.
+ */
+export function useSubscribersPage(): SubscribersPageModel {
+ const router = useRouter();
+ const pathname = usePathname();
+ const searchParams = useSearchParams();
+ const [isFiltering, startFiltering] = useTransition();
+ const filter =
+ searchParams.get(SUBSCRIBERS_FILTER_PARAM) === 'expiring'
+ ? 'expiring'
+ : 'all';
+
+ const list = useSuspenseInfiniteQuery({
+ queryKey: overviewKeys.subscribers(filter),
+ queryFn: ({ pageParam, signal }) =>
+ creatorDashboardRepository.listSubscribers(
+ { filter, cursor: pageParam },
+ { signal },
+ ),
+ initialPageParam: undefined as string | undefined,
+ getNextPageParam: (last) => last.nextCursor ?? undefined,
+ });
+
+ return {
+ filter,
+ setFilter: (next) => {
+ if (next === filter) return;
+ const params = new URLSearchParams(searchParams.toString());
+ if (next === 'all') params.delete(SUBSCRIBERS_FILTER_PARAM);
+ else params.set(SUBSCRIBERS_FILTER_PARAM, next);
+ const query = params.toString();
+ // In place: the page keeps its scroll, and the chip replaces the entry.
+ startFiltering(() => {
+ router.replace(query ? `${pathname}?${query}` : pathname, {
+ scroll: false,
+ });
+ });
+ },
+ isFiltering,
+ counts: list.data.pages[0].counts,
+ items: firstOfEach(
+ list.data.pages.flatMap((page) => page.items),
+ (item) => `${item.username}:${item.endsAt}`,
+ ),
+ hasMore: list.hasNextPage,
+ loadMore: () => {
+ // fetchNextPage would cancel a read of every page on its way and skip or repeat rows.
+ if (!list.isFetching) void list.fetchNextPage();
+ },
+ isLoadingMore: list.isFetchingNextPage,
+ loadMoreError: list.isFetchNextPageError
+ ? loadMoreErrorKind(list.error)
+ : null,
+ };
+}
diff --git a/platforms/market/src/features/overview/models/subscribers/use-subscribers-preview-part.ts b/platforms/market/src/features/overview/models/subscribers/use-subscribers-preview-part.ts
new file mode 100644
index 0000000..4b4a093
--- /dev/null
+++ b/platforms/market/src/features/overview/models/subscribers/use-subscribers-preview-part.ts
@@ -0,0 +1,21 @@
+import { useSuspenseQuery } from '@tanstack/react-query';
+
+import {
+ creatorDashboardRepository,
+ overviewKeys,
+} from '../../repositories/creator-dashboard';
+import { SUBSCRIBERS_PREVIEW_COUNT } from './constants';
+import type { SubscribersPreviewPartModel } from './types';
+
+/** طرحهای اشتراک › «مشترکان» (J10-1): how many, and the few who end soonest. */
+export function useSubscribersPreviewPart(): SubscribersPreviewPartModel {
+ const { data } = useSuspenseQuery({
+ queryKey: [...overviewKeys.subscribers('all'), 'preview'],
+ queryFn: ({ signal }) =>
+ creatorDashboardRepository.listSubscribers({ filter: 'all' }, { signal }),
+ });
+ return {
+ total: data.counts.all,
+ items: data.items.slice(0, SUBSCRIBERS_PREVIEW_COUNT),
+ };
+}
diff --git a/platforms/market/src/index.ts b/platforms/market/src/index.ts
index 68614ed..823b28a 100644
--- a/platforms/market/src/index.ts
+++ b/platforms/market/src/index.ts
@@ -343,11 +343,9 @@ export type {
export {
creatorDashboardRepository,
overviewKeys,
- useAudiencePart,
useOwnSubscriberCount,
} from './features/overview';
export type {
- AudiencePartModel,
CreatorDashboardPayload,
CreatorTierPayload,
RecentPaymentPayload,
diff --git a/platforms/market/src/shared/locales/fa/dashboard.json b/platforms/market/src/shared/locales/fa/dashboard.json
index ff83022..d341216 100644
--- a/platforms/market/src/shared/locales/fa/dashboard.json
+++ b/platforms/market/src/shared/locales/fa/dashboard.json
@@ -146,14 +146,6 @@
"finance": {
"meta-title": "مالی"
},
- "audience": {
- "title": "مخاطبان",
- "followers": "دنبالکنندگان",
- "subscribers": "مشترکان فعال",
- "note": "تعداد دنبالکنندگان برای همه دیده میشود؛ تعداد مشترکان فقط برای شما.",
- "loading": "در حال بارگذاری مخاطبان…",
- "error": "آمار مخاطبان بارگذاری نشد. دوباره تلاش کنید."
- },
"invite": {
"title": "کد دعوت",
"loading": "در حال بارگذاری کد دعوت…",
@@ -269,5 +261,29 @@
"text": "لینک کانال را در تلگرام، اینستاگرام یا هر جای دیگری که مخاطب دارید بگذارید. هر دنبالکننده و مشترک تازه اینجا شمرده میشود.",
"action": "اشتراکگذاری لینک کانال"
}
+ },
+ "subscribers": {
+ "meta-title": "مشترکان",
+ "title": "مشترکان",
+ "view-all": "مشاهده همه",
+ "loading": "در حال بارگذاری مشترکان…",
+ "error": "مشترکان بارگذاری نشدند. دوباره تلاش کنید.",
+ "filter": "فیلتر مشترکان",
+ "filters": {
+ "all": "همه ({{n}})",
+ "expiring": "در حال انقضا ({{n}})"
+ },
+ "until-plan": "{{plan}} · تا {{date}}",
+ "until": "تا {{date}}",
+ "days-left": "{{n}} روز مانده",
+ "expiring-note": "مشترکانی که اشتراکشان در 7 روز آینده تمام میشود.",
+ "privacy-short": "فقط نام کاربری مشترکان نمایش داده میشود.",
+ "privacy": "فقط نام کاربری مشترکان نمایش داده میشود؛ شماره موبایل و نام آنها هرگز.",
+ "empty": {
+ "all": "هنوز مشترکی ندارید.",
+ "expiring": "در 7 روز آینده اشتراکی تمام نمیشود."
+ },
+ "more": "نمایش مشترکان بیشتر",
+ "more-failed": "مشترکان بیشتر بارگذاری نشدند."
}
}