ifixkart-admin/app/(admin)/dashboard/mockData.ts

232 lines
8.4 KiB
TypeScript

import type {
DashboardStats,
SessionInfo,
} from '@/services/api/adminService';
const dailyRevenue = [
12400, 15820, 11250, 18640, 22100, 19880, 25400,
17320, 20950, 16780, 24110, 28840, 21560, 30120,
18940, 22670, 27450, 19830, 31200, 26780, 18440,
23900, 29150, 21880, 33500, 27640, 19220, 24880,
30750, 28410,
].map((revenue, index) => {
const day = String(index + 1).padStart(2, '0');
return {
date: `08-${day}`,
revenue,
orders: Math.max(4, Math.round(revenue / 1850)),
};
});
export const MOCK_DASHBOARD_STATS: DashboardStats = {
total_users: 184,
total_orders: 326,
total_products: 148,
total_brands: 22,
total_device_models: 86,
total_device_series: 31,
total_categories: 18,
revenue_all_time: 1852580,
revenue_last_30_days: 684320,
revenue_last_7_days: 186280,
orders_by_status: {
pending: 28,
confirmed: 42,
processing: 36,
shipped: 51,
delivered: 142,
cancelled: 18,
returned: 9,
},
revenue_chart_daily: dailyRevenue,
revenue_chart_monthly: [
{ label: 'January', revenue: 98200, orders: 42 },
{ label: 'February', revenue: 114500, orders: 51 },
{ label: 'March', revenue: 128800, orders: 58 },
{ label: 'April', revenue: 121400, orders: 54 },
{ label: 'May', revenue: 142600, orders: 63 },
{ label: 'June', revenue: 156200, orders: 71 },
{ label: 'July', revenue: 168900, orders: 76 },
{ label: 'August', revenue: 184320, orders: 82 },
],
top_products: [
{ name: 'Refurbished Sony PlayStation 5 Disc Edition', total_sold: 14, total_revenue: 559986 },
{ name: 'Apple Mobile Camera for iPhone 16 Pro', total_sold: 38, total_revenue: 167230 },
{ name: 'Refurbished Sony WH-1000XM5 Noise Canceling Headphones', total_sold: 11, total_revenue: 219989 },
{ name: 'OLED Display Screen Assembly for Samsung Galaxy S24 Ultra', total_sold: 16, total_revenue: 184000 },
{ name: 'Apple Mobile Display for iPhone 16 Pro Max', total_sold: 18, total_revenue: 164139 },
{ name: 'Apple Mobile Cases for iPhone 15', total_sold: 29, total_revenue: 114246 },
{ name: 'Apple Mobile Display for iPhone 16', total_sold: 15, total_revenue: 71570 },
{ name: 'Apple Camera Lens Guards for iPhone 16 Plus', total_sold: 22, total_revenue: 92117 },
{ name: 'Apple Mobile Display for iPhone 15 Pro', total_sold: 19, total_revenue: 64404 },
{ name: 'Xiaomi Mobile Display for Xiaomi 14 Ultra', total_sold: 12, total_revenue: 22828 },
{ name: 'Apple Mobile Cases for iPhone 13 Mini', total_sold: 17, total_revenue: 29613 },
{ name: 'Samsung Mobile Camera for Samsung Galaxy A53 5G', total_sold: 14, total_revenue: 23433 },
{ name: 'Samsung Mobile Back Panel for Samsung Galaxy S23+', total_sold: 13, total_revenue: 20730 },
{ name: 'Samsung bluetooth speaker for Samsung Galaxy S23 Ultra', total_sold: 25, total_revenue: 34716 },
{ name: 'Samsung Screen Guards for Samsung Galaxy S23', total_sold: 31, total_revenue: 36486 },
{ name: 'Google Pixel Camera Lens Guards for Google Pixel 6', total_sold: 26, total_revenue: 25910 },
{ name: 'Stereo Loudspeaker for iPhone 14 Pro', total_sold: 10, total_revenue: 18990 },
{ name: 'Fast Charging Adapter 65W GaN', total_sold: 34, total_revenue: 33660 },
{ name: 'MagSafe Wireless Power Bank 10000mAh', total_sold: 21, total_revenue: 41790 },
{ name: 'OnePlus 12 Curved AMOLED Display Module', total_sold: 9, total_revenue: 76500 },
{ name: 'iPad Pro 12.9 Liquid Retina Touch Screen', total_sold: 6, total_revenue: 108000 },
{ name: 'Apple Watch Series 9 Sapphire Glass Panel', total_sold: 8, total_revenue: 39920 },
{ name: 'MacBook Pro M3 Pro Magnetic Keyboard Assembly', total_sold: 5, total_revenue: 84500 },
{ name: 'GoPro Hero 12 Black Lens Replacement Kit', total_sold: 7, total_revenue: 27930 },
{ name: 'Universal BGA Reballing Stencil Set 120-in-1', total_sold: 15, total_revenue: 22500 },
],
recent_orders: [
{
order_no: 'IFK-10482',
amount: 4899,
status: 'delivered',
payment_status: 'paid',
created_at: '2026-08-30T09:12:00Z',
customer_name: 'Arjun Mehta',
customer_email: 'arjun.mehta@gmail.com',
},
{
order_no: 'IFK-10481',
amount: 2199,
status: 'shipped',
payment_status: 'paid',
created_at: '2026-08-30T07:44:00Z',
customer_name: 'Priya Nair',
customer_email: 'priya.nair@gmail.com',
},
{
order_no: 'IFK-10480',
amount: 7499,
status: 'processing',
payment_status: 'paid',
created_at: '2026-08-29T18:21:00Z',
customer_name: 'Rahul Iyer',
customer_email: 'rahul.iyer@outlook.com',
},
{
order_no: 'IFK-10479',
amount: 1299,
status: 'confirmed',
payment_status: 'paid',
created_at: '2026-08-29T15:08:00Z',
customer_name: 'Sneha Kapoor',
customer_email: 'sneha.kapoor@gmail.com',
},
{
order_no: 'IFK-10478',
amount: 3499,
status: 'pending',
payment_status: 'unpaid',
created_at: '2026-08-29T11:36:00Z',
customer_name: 'Vikram Shah',
customer_email: 'vikram.shah@yahoo.com',
},
{
order_no: 'IFK-10477',
amount: 899,
status: 'cancelled',
payment_status: 'refunded',
created_at: '2026-08-28T20:02:00Z',
customer_name: 'Ananya Rao',
customer_email: 'ananya.rao@gmail.com',
},
],
low_stock_variants: 14,
out_of_stock_variants: 6,
total_stock_units: 4280,
};
export const MOCK_DASHBOARD_SESSIONS: SessionInfo[] = [
{
session_id: 'sess_ui_01',
user_id: 'usr_admin',
device_name: 'Office Desktop',
device_type: 'desktop',
browser: 'Chrome 128.0.0',
operating_system: 'Windows 11',
ip_address: '106.219.180.207',
expires_at: '2026-08-31T18:00:00Z',
is_active: true,
},
{
session_id: 'sess_ui_02',
user_id: 'usr_admin',
device_name: 'MacBook Pro',
device_type: 'desktop',
browser: 'Safari 18.2',
operating_system: 'macOS Sequoia',
ip_address: '49.36.112.44',
expires_at: '2026-08-31T16:30:00Z',
is_active: true,
},
{
session_id: 'sess_ui_03',
user_id: 'usr_manager',
device_name: 'Pixel 8',
device_type: 'mobile',
browser: 'Chrome 127.0.0',
operating_system: 'Android 15',
ip_address: '152.58.204.19',
expires_at: '2026-08-31T12:10:00Z',
is_active: true,
},
{
session_id: 'sess_ui_04',
user_id: 'usr_tech',
device_name: 'iPad Air',
device_type: 'tablet',
browser: 'Safari 18.1',
operating_system: 'iPadOS 18',
ip_address: '103.21.244.12',
expires_at: '2026-08-31T09:45:00Z',
is_active: true,
},
{
session_id: 'sess_ui_05',
user_id: 'usr_staff',
device_name: 'Store Counter PC',
device_type: 'desktop',
browser: 'Edge 127.0.0',
operating_system: 'Windows 10',
ip_address: '117.99.80.63',
expires_at: '2026-08-30T22:00:00Z',
is_active: true,
},
];
export function withDashboardMock(
stats: DashboardStats | null,
sessions: SessionInfo[],
): { stats: DashboardStats; sessions: SessionInfo[] } {
if (stats) {
return {
stats: {
total_users: stats.total_users ?? 0,
total_orders: stats.total_orders ?? 0,
total_products: stats.total_products ?? 0,
total_brands: stats.total_brands ?? 0,
total_device_models: stats.total_device_models ?? 0,
total_device_series: stats.total_device_series ?? 0,
total_categories: stats.total_categories ?? 0,
revenue_all_time: stats.revenue_all_time ?? 0,
revenue_last_30_days: stats.revenue_last_30_days ?? 0,
revenue_last_7_days: stats.revenue_last_7_days ?? 0,
orders_by_status: stats.orders_by_status ?? {},
revenue_chart_daily: stats.revenue_chart_daily ?? [],
revenue_chart_monthly: stats.revenue_chart_monthly ?? [],
top_products: stats.top_products ?? [],
recent_orders: stats.recent_orders ?? [],
low_stock_variants: stats.low_stock_variants ?? 0,
out_of_stock_variants: stats.out_of_stock_variants ?? 0,
total_stock_units: stats.total_stock_units ?? 0,
},
sessions: sessions ?? [],
};
}
return {
stats: MOCK_DASHBOARD_STATS,
sessions: MOCK_DASHBOARD_SESSIONS,
};
}