import { Phone, TrendingUp, Activity, BarChart2, ShoppingCart, ShoppingBag, Scale } from 'lucide-react';
import type { TileItem } from "../../api/types";
export interface StatsTilesProps {
tiles?: TileItem[];
}
export function StatsTiles({ tiles }: StatsTilesProps) {
if (!tiles?.length) return null;
return (
{tiles.map((tile, idx) => {
const displayLabel = (tile.key || `tile_${idx}`)
.replace(/_/g, " ")
.replace(/\b\w/g, (c) => c.toUpperCase());
const lowerKey = String(tile.key).toLowerCase();
let Icon = BarChart2;
if (lowerKey.includes('call') || lowerKey.includes('total')) Icon = Phone;
if (lowerKey.includes('productive')) Icon = TrendingUp;
if (lowerKey.includes('order') || lowerKey.includes('cart')) Icon = ShoppingCart;
if (lowerKey.includes('bag')) Icon = ShoppingBag;
if (lowerKey.includes('kg') || lowerKey.includes('weight')) Icon = Scale;
if (lowerKey.includes('active')) Icon = Activity;
const isDanger = lowerKey.includes('no_order');
return (
{displayLabel}
{(tile.value as React.ReactNode) ?? "-"}
);
})}
);
}