mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-11 22:30:58 +04:30
Add FA/EN locale, home activity charts, and theme-aware polish.
Ship shared LocaleProvider, business/customer i18n, branding defaultLocale, curated home tiles with dual 30-day charts, and chart/page aura tokens; refresh PROJECT_CONTEXT. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
f5b2193ba1
commit
66004a0fba
@@ -14,9 +14,13 @@ function toMonthKey(iso: string): string {
|
||||
return `${year}-${month}`
|
||||
}
|
||||
|
||||
function formatMonthLabel(monthKey: string): string {
|
||||
function formatMonthLabel(monthKey: string, locale: string): string {
|
||||
const [year, month] = monthKey.split('-').map(Number)
|
||||
return new Date(year, month - 1, 1).toLocaleString('en-US', { month: 'short' })
|
||||
return new Date(year, month - 1, 1).toLocaleString(locale === 'fa' ? 'fa-IR' : 'en-US', {
|
||||
month: 'short',
|
||||
calendar: 'gregory',
|
||||
numberingSystem: 'latn',
|
||||
})
|
||||
}
|
||||
|
||||
export function buildLast12MonthKeys(): string[] {
|
||||
@@ -33,7 +37,10 @@ export function buildLast12MonthKeys(): string[] {
|
||||
return keys
|
||||
}
|
||||
|
||||
export function aggregateProductActivity(products: ProductApi[]): ProductMonthActivity[] {
|
||||
export function aggregateProductActivity(
|
||||
products: ProductApi[],
|
||||
locale: string = 'en',
|
||||
): ProductMonthActivity[] {
|
||||
const monthKeys = buildLast12MonthKeys()
|
||||
const added = new Map(monthKeys.map((key) => [key, 0]))
|
||||
const updated = new Map(monthKeys.map((key) => [key, 0]))
|
||||
@@ -56,7 +63,7 @@ export function aggregateProductActivity(products: ProductApi[]): ProductMonthAc
|
||||
|
||||
return monthKeys.map((monthKey) => ({
|
||||
monthKey,
|
||||
label: formatMonthLabel(monthKey),
|
||||
label: formatMonthLabel(monthKey, locale),
|
||||
added: added.get(monthKey) ?? 0,
|
||||
updated: updated.get(monthKey) ?? 0,
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user