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/screens/(main)/dashboard/overview/organisms/dashboard-overview/DashboardOverview.tsx b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/DashboardOverview.tsx
index 604167b..08bb545 100644
--- 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
@@ -3,11 +3,19 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { useDashboardOverviewPart } from '../../../../../../../features/overview';
+import { AudienceSection } from './components/AudienceSection';
+import { IncomeSection } from './components/IncomeSection';
import type { DashboardOverviewProps } from './types';
/** داشبورد › نمای کلی (J10-0), the creator's default tab. Loads and fails as one. */
export function DashboardOverview({ layout }: DashboardOverviewProps) {
- useDashboardOverviewPart();
+ const overview = useDashboardOverviewPart();
+ const cols = layout === 'desktop' ? 'grid-cols-3' : 'grid-cols-2';
- return ;
+ return (
+
+
+
+
+ );
}
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..4d91d2d
--- /dev/null
+++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/AudienceSection.tsx
@@ -0,0 +1,77 @@
+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 { 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..c270427
--- /dev/null
+++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/components/IncomeSection.tsx
@@ -0,0 +1,88 @@
+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 { 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/constants.ts b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/constants.ts
new file mode 100644
index 0000000..1bb4674
--- /dev/null
+++ b/platforms/market/src/app/screens/(main)/dashboard/overview/organisms/dashboard-overview/constants.ts
@@ -0,0 +1,4 @@
+import { ROUTES } from '../../../../../../navigation/navigation';
+
+/** «مشترکان» opened on who ends within a week (J10-1g). */
+export const SUBSCRIBERS_EXPIRING_HREF = `${ROUTES.dashboard.subscribers}?filter=expiring`;
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
index 30af7fe..1f169d3 100644
--- 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
@@ -1,7 +1,15 @@
+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: «در حال بارگذاری نمای کلی…». */
diff --git a/platforms/market/src/shared/locales/fa/dashboard.json b/platforms/market/src/shared/locales/fa/dashboard.json
index c5c2951..ab23c51 100644
--- a/platforms/market/src/shared/locales/fa/dashboard.json
+++ b/platforms/market/src/shared/locales/fa/dashboard.json
@@ -221,6 +221,27 @@
"overview": {
"meta-title": "نمای کلی",
"loading": "در حال بارگذاری نمای کلی…",
- "error": "نمای کلی بارگذاری نشد. دوباره تلاش کنید."
+ "error": "نمای کلی بارگذاری نشد. دوباره تلاش کنید.",
+ "audience": {
+ "title": "مخاطبان",
+ "followers": "دنبالکنندگان",
+ "followers-tip": "شامل مشترکان هم میشود.",
+ "followers-tip-label": "توضیح دنبالکنندگان",
+ "subscribers": "مشترکان فعال",
+ "subscribers-plans": "در {{n}} طرح",
+ "subscribers-none": "هنوز مشترکی ندارید",
+ "expiring": "در حال انقضا",
+ "expiring-hint": "7 روز آینده",
+ "expiring-link": "مشاهده مشترکان"
+ },
+ "income": {
+ "title": "درآمد",
+ "total": "درآمد کل",
+ "total-tip": "از ابتدا، خالص بعد از کمیسیون لومینا و بازگشت وجهها.",
+ "total-tip-label": "توضیح درآمد کل",
+ "month": "درآمد این ماه",
+ "payable": "قابل واریز",
+ "payable-link": "رفتن به مالی"
+ }
}
}