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
@@ -0,0 +1,41 @@
|
||||
import { apiRequest } from '../lib/api'
|
||||
import { getActiveBusinessId } from '../lib/businessContext'
|
||||
|
||||
export interface DailyActivityPoint {
|
||||
date: string
|
||||
count: number
|
||||
}
|
||||
|
||||
export interface DailyActivitySeries {
|
||||
days: number
|
||||
total: number
|
||||
items: DailyActivityPoint[]
|
||||
}
|
||||
|
||||
export interface DualDailyActivityResponse {
|
||||
days: number
|
||||
primary: DailyActivitySeries
|
||||
secondary: DailyActivitySeries
|
||||
}
|
||||
|
||||
function businessPath(resource: 'orders' | 'customers', suffix = '') {
|
||||
const businessId = getActiveBusinessId()
|
||||
if (!businessId) {
|
||||
throw new Error('No active business selected. Please sign in again.')
|
||||
}
|
||||
return `/businesses/${businessId}/${resource}${suffix}`
|
||||
}
|
||||
|
||||
export async function getOrdersDailyActivity(days = 30, signal?: AbortSignal) {
|
||||
return apiRequest<DualDailyActivityResponse>(
|
||||
`${businessPath('orders', '/activity')}?days=${days}`,
|
||||
{ auth: true, signal },
|
||||
)
|
||||
}
|
||||
|
||||
export async function getCustomersDailyActivity(days = 30, signal?: AbortSignal) {
|
||||
return apiRequest<DualDailyActivityResponse>(
|
||||
`${businessPath('customers', '/activity')}?days=${days}`,
|
||||
{ auth: true, signal },
|
||||
)
|
||||
}
|
||||
@@ -64,6 +64,7 @@ export interface Order {
|
||||
status: OrderStatus
|
||||
processStepId: string
|
||||
processStepLabel?: string | null
|
||||
processStepLabelFa?: string | null
|
||||
processStepColor?: string | null
|
||||
source: OrderSource
|
||||
subtotal: number
|
||||
|
||||
@@ -105,6 +105,7 @@ export function mapPortfolioApiToUi(portfolio: PortfolioApi): Portfolio {
|
||||
categoryName: portfolio.categoryName,
|
||||
tags: portfolio.tags,
|
||||
titleImageUrl: resolvePortfolioTitleImageUrl(portfolio),
|
||||
sortOrder: portfolio.sortOrder ?? 0,
|
||||
commentCount: portfolio.commentCount,
|
||||
publishedAt: portfolio.publishedAt,
|
||||
createdAt: portfolio.createdAt,
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { BusinessPrimaryColorId } from '../utils/businessPrimaryColors'
|
||||
|
||||
export interface BrandingSettings {
|
||||
primaryColor: BusinessPrimaryColorId
|
||||
defaultLocale?: 'en' | 'fa'
|
||||
}
|
||||
|
||||
export interface DashboardSettings {
|
||||
@@ -15,6 +16,7 @@ export interface DashboardSettings {
|
||||
export interface OrderProcessStep {
|
||||
id: string
|
||||
label: string
|
||||
labelFa: string
|
||||
color: string
|
||||
}
|
||||
|
||||
@@ -35,10 +37,30 @@ export interface SettingsResponse {
|
||||
}
|
||||
|
||||
export const DEFAULT_ORDER_PROCESS_STEPS: OrderProcessStep[] = [
|
||||
{ id: 'processing', label: 'Under processing', color: '#3B82F6' },
|
||||
{ id: 'ready-for-shipping', label: 'Ready for shipping', color: '#F59E0B' },
|
||||
{ id: 'shipped', label: 'Shipped', color: '#8B5CF6' },
|
||||
{ id: 'delivered', label: 'Delivered', color: '#22C55E' },
|
||||
{
|
||||
id: 'processing',
|
||||
label: 'Under processing',
|
||||
labelFa: 'در حال پردازش',
|
||||
color: '#3B82F6',
|
||||
},
|
||||
{
|
||||
id: 'ready-for-shipping',
|
||||
label: 'Ready for shipping',
|
||||
labelFa: 'آماده ارسال',
|
||||
color: '#F59E0B',
|
||||
},
|
||||
{
|
||||
id: 'shipped',
|
||||
label: 'Shipped',
|
||||
labelFa: 'ارسالشده',
|
||||
color: '#8B5CF6',
|
||||
},
|
||||
{
|
||||
id: 'delivered',
|
||||
label: 'Delivered',
|
||||
labelFa: 'تحویلشده',
|
||||
color: '#22C55E',
|
||||
},
|
||||
]
|
||||
|
||||
function settingsPath() {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { apiRequest } from '../lib/api'
|
||||
import type { DashboardLocale } from '@meshkee/dashboard-core'
|
||||
|
||||
export interface ResolvedTenant {
|
||||
id: string
|
||||
@@ -6,6 +7,7 @@ export interface ResolvedTenant {
|
||||
nameFa: string | null
|
||||
slug: string
|
||||
domain: string
|
||||
defaultLocale?: DashboardLocale
|
||||
logoUrl?: string | null
|
||||
faviconUrl?: string | null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user