krishnasales_mobile/src/screens/tabs.ts
2026-07-15 10:32:11 +05:30

43 lines
1.5 KiB
TypeScript

import { Store, Phone, ShoppingCart, ClipboardList, type LucideIcon } from 'lucide-react';
import {
OrdersView,
CallsView,
StoresView,
DailyLogsView,
type WiredRecordViewProps,
} from '../components/rv';
import {
OrderDetail,
CallDetail,
StoreDetail,
DailyLogDetail,
type WiredDetailViewProps,
} from '../components/dv';
import { AnalyticsPage } from './AnalyticsPage';
import { BarChart2 } from 'lucide-react';
export type ScreenKey = 'orders' | 'calls' | 'stores' | 'daily' | 'analytics';
export interface ScreenDef {
key: ScreenKey;
label: string;
icon: LucideIcon;
View: (p: WiredRecordViewProps) => React.JSX.Element | React.FC;
Detail?: (p: WiredDetailViewProps) => React.JSX.Element;
/** Singular noun for the detail title. */
noun?: string;
}
export const SCREENS: ScreenDef[] = [
{ key: 'analytics', label: 'Analytics', icon: BarChart2, View: AnalyticsPage as any },
{ key: 'orders', label: 'Orders', icon: ShoppingCart, View: OrdersView, Detail: OrderDetail, noun: 'Order' },
{ key: 'calls', label: 'Calls', icon: Phone, View: CallsView, Detail: CallDetail, noun: 'Call' },
{ key: 'stores', label: 'Stores', icon: Store, View: StoresView, Detail: StoreDetail, noun: 'Store' },
{ key: 'daily', label: 'Daily Logs', icon: ClipboardList, View: DailyLogsView, Detail: DailyLogDetail, noun: 'Daily Log' },
];
export function screenByKey(key: string | undefined): ScreenDef | undefined {
return SCREENS.find((t) => t.key === key);
}