Refactor UI imports and update component paths
Some checks failed
Build Frontend / build (push) Failing after 7s
Some checks failed
Build Frontend / build (push) Failing after 7s
Replaces imports from 'components/ui' with 'components/common' across the app and dashboard pages, and updates model and API imports to use new paths under 'lib'. Removes redundant authentication checks from several dashboard pages. Adds new dashboard components and utility files, and reorganizes hooks and services into the 'lib' directory for improved structure.
This commit is contained in:
@@ -7,16 +7,16 @@ import {
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
} from "@/components/common/card";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/common/tabs";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Button } from "@/components/ui/button";
|
||||
} from "@/components/common/select";
|
||||
import { Button } from "@/components/common/button";
|
||||
import {
|
||||
AlertCircle,
|
||||
BarChart,
|
||||
@@ -29,8 +29,8 @@ import {
|
||||
Package,
|
||||
Trophy,
|
||||
} from "lucide-react";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { fetchClient } from "@/lib/api-client";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/common/alert";
|
||||
import { fetchClient } from "@/lib/api/api-client";
|
||||
import {
|
||||
BarChart as RechartsBarChart,
|
||||
Bar,
|
||||
@@ -43,7 +43,7 @@ import {
|
||||
Line,
|
||||
ComposedChart,
|
||||
} from "recharts";
|
||||
import { formatGBP } from "@/utils/format";
|
||||
import { formatGBP, formatNumber } from "@/lib/utils/format";
|
||||
import { PieChart, Pie, Cell, Legend } from "recharts";
|
||||
|
||||
interface GrowthData {
|
||||
@@ -691,7 +691,7 @@ export default function AdminAnalytics() {
|
||||
{formatCurrency(bestMonth.revenue)}
|
||||
</div>
|
||||
<div className="text-sm text-muted-foreground mt-1">
|
||||
{bestMonth.orders.toLocaleString()} orders
|
||||
{formatNumber(bestMonth.orders)} orders
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -714,7 +714,7 @@ export default function AdminAnalytics() {
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">
|
||||
{analyticsData?.orders?.total?.toLocaleString() || "0"}
|
||||
{formatNumber(analyticsData?.orders?.total)}
|
||||
</div>
|
||||
<div className="flex items-center text-xs text-muted-foreground mt-1">
|
||||
<span className="bg-muted/50 px-1.5 py-0.5 rounded">Today: {analyticsData?.orders?.totalToday || 0}</span>
|
||||
@@ -876,7 +876,7 @@ export default function AdminAnalytics() {
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">
|
||||
{analyticsData?.products?.total?.toLocaleString() || "0"}
|
||||
{formatNumber(analyticsData?.products?.total)}
|
||||
</div>
|
||||
<div className="flex items-center text-xs text-muted-foreground mt-1">
|
||||
<span className="bg-muted/50 px-1.5 py-0.5 rounded">New This Week: {analyticsData?.products?.recent || 0}</span>
|
||||
@@ -1096,27 +1096,25 @@ export default function AdminAnalytics() {
|
||||
<div className="bg-muted/50 p-4 rounded-lg">
|
||||
<div className="text-sm font-medium mb-1">Total Vendors</div>
|
||||
<div className="text-2xl font-bold">
|
||||
{analyticsData?.vendors?.total?.toLocaleString() || "0"}
|
||||
{formatNumber(analyticsData?.vendors?.total)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 p-4 rounded-lg">
|
||||
<div className="text-sm font-medium mb-1">Active Vendors</div>
|
||||
<div className="text-2xl font-bold">
|
||||
{analyticsData?.vendors?.active?.toLocaleString() || "0"}
|
||||
{formatNumber(analyticsData?.vendors?.active)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 p-4 rounded-lg">
|
||||
<div className="text-sm font-medium mb-1">Active Stores</div>
|
||||
<div className="text-2xl font-bold">
|
||||
{analyticsData?.vendors?.activeStores?.toLocaleString() ||
|
||||
"0"}
|
||||
{formatNumber(analyticsData?.vendors?.activeStores)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-muted/50 p-4 rounded-lg">
|
||||
<div className="text-sm font-medium mb-1">New This Week</div>
|
||||
<div className="text-2xl font-bold">
|
||||
{analyticsData?.vendors?.newThisWeek?.toLocaleString() ||
|
||||
"0"}
|
||||
{formatNumber(analyticsData?.vendors?.newThisWeek)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1202,7 +1200,7 @@ export default function AdminAnalytics() {
|
||||
<Card className="col-span-1 border-border/40 bg-background/50 backdrop-blur-sm hover:bg-background/60 transition-colors">
|
||||
<CardContent className="pt-4 flex flex-col items-center justify-center text-center">
|
||||
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wider mb-1">Total Orders</div>
|
||||
<div className="text-2xl font-bold">{growthData.cumulative.orders.toLocaleString()}</div>
|
||||
<div className="text-2xl font-bold">{formatNumber(growthData.cumulative.orders)}</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Card className="col-span-1 border-green-500/20 bg-green-500/5 backdrop-blur-sm hover:bg-green-500/10 transition-colors">
|
||||
@@ -1214,19 +1212,19 @@ export default function AdminAnalytics() {
|
||||
<Card className="col-span-1 border-border/40 bg-background/50 backdrop-blur-sm hover:bg-background/60 transition-colors">
|
||||
<CardContent className="pt-4 flex flex-col items-center justify-center text-center">
|
||||
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wider mb-1">Customers</div>
|
||||
<div className="text-2xl font-bold">{growthData.cumulative.customers.toLocaleString()}</div>
|
||||
<div className="text-2xl font-bold">{formatNumber(growthData.cumulative.customers)}</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Card className="col-span-1 border-border/40 bg-background/50 backdrop-blur-sm hover:bg-background/60 transition-colors">
|
||||
<CardContent className="pt-4 flex flex-col items-center justify-center text-center">
|
||||
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wider mb-1">Vendors</div>
|
||||
<div className="text-2xl font-bold">{growthData.cumulative.vendors.toLocaleString()}</div>
|
||||
<div className="text-2xl font-bold">{formatNumber(growthData.cumulative.vendors)}</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Card className="col-span-1 border-border/40 bg-background/50 backdrop-blur-sm hover:bg-background/60 transition-colors">
|
||||
<CardContent className="pt-4 flex flex-col items-center justify-center text-center">
|
||||
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wider mb-1">Products</div>
|
||||
<div className="text-2xl font-bold">{growthData.cumulative.products.toLocaleString()}</div>
|
||||
<div className="text-2xl font-bold">{formatNumber(growthData.cumulative.products)}</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Card className="col-span-1 border-purple-500/20 bg-purple-500/5 backdrop-blur-sm hover:bg-purple-500/10 transition-colors">
|
||||
@@ -1292,7 +1290,7 @@ export default function AdminAnalytics() {
|
||||
<span className="text-sm text-muted-foreground flex items-center gap-2">
|
||||
<div className="w-2 h-2 rounded-full bg-blue-500" /> Orders
|
||||
</span>
|
||||
<span className="font-medium">{data.orders.toLocaleString()}</span>
|
||||
<span className="font-medium">{formatNumber(data.orders)}</span>
|
||||
</div>
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<span className="text-sm text-muted-foreground flex items-center gap-2">
|
||||
@@ -1304,7 +1302,7 @@ export default function AdminAnalytics() {
|
||||
<span className="text-sm text-muted-foreground flex items-center gap-2">
|
||||
<div className="w-2 h-2 rounded-full bg-purple-500" /> Customers
|
||||
</span>
|
||||
<span className="font-medium">{data.customers.toLocaleString()}</span>
|
||||
<span className="font-medium">{formatNumber(data.customers)}</span>
|
||||
</div>
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<span className="text-sm text-muted-foreground flex items-center gap-2">
|
||||
@@ -1554,3 +1552,5 @@ export default function AdminAnalytics() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user