[dyad] Removed Recent Activity section - wrote 1 file(s), deleted 1 file(s)

This commit is contained in:
[dyad] 2025-09-11 11:43:14 +02:00
parent fdc4e81323
commit 37908e4957
2 changed files with 5 additions and 92 deletions

View file

@ -1,79 +0,0 @@
import React from 'react';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { ScrollArea } from '@/components/ui/scroll-area';
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
interface ActivityItem {
id: string;
type: 'order' | 'stock-in' | 'stock-out';
description: string;
timestamp: string;
user?: {
name: string;
avatarUrl?: string;
};
}
const mockActivity: ActivityItem[] = [
{
id: '1',
type: 'order',
description: 'New order #1001 placed by John Doe.',
timestamp: '2 hours ago',
user: { name: 'John Doe', avatarUrl: 'https://api.dicebear.com/7.x/initials/svg?seed=JD' },
},
{
id: '2',
type: 'stock-in',
description: '50 units of "Wireless Mouse" added to stock.',
timestamp: '5 hours ago',
},
{
id: '3',
type: 'stock-out',
description: '10 units of "Mechanical Keyboard" booked out for delivery.',
timestamp: '1 day ago',
},
{
id: '4',
type: 'order',
description: 'Order #1000 updated by Jane Smith.',
timestamp: '2 days ago',
user: { name: 'Jane Smith', avatarUrl: 'https://api.dicebear.com/7.x/initials/svg?seed=JS' },
},
{
id: '5',
type: 'stock-in',
description: '100 units of "USB-C Cable" received from supplier.',
timestamp: '3 days ago',
},
];
export const RecentActivity = () => {
return (
<Card>
<CardHeader>
<CardTitle>Recent Activity</CardTitle>
<CardDescription>Recent actions in your stock management system.</CardDescription>
</CardHeader>
<CardContent>
<ScrollArea className="h-[300px]">
<div className="space-y-4">
{mockActivity.map((activity) => (
<div key={activity.id} className="flex items-center space-x-4">
<Avatar>
<AvatarImage src={activity.user?.avatarUrl} />
<AvatarFallback>{activity.user ? activity.user.name.substring(0, 2) : 'NA'}</AvatarFallback>
</Avatar>
<div className="flex-1 space-y-1">
<p className="text-sm font-medium leading-none">{activity.description}</p>
<p className="text-sm text-muted-foreground">{activity.timestamp}</p>
</div>
</div>
))}
</div>
</ScrollArea>
</CardContent>
</Card>
);
};

View file

@ -1,13 +1,13 @@
import { StatCard } from '@/components/StatCard';
import { StockChart } from '@/components/StockChart';
import { RecentActivity } from '@/components/RecentActivity';
// import { RecentActivity } from '@/components/RecentActivity'; // Removed import
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { DollarSign, Package, ShoppingCart, Users } from 'lucide-react';
import { useQuery } from '@tanstack/react-query';
import { fetchDashboardData, DashboardData } from '@/lib/api'; // Import DashboardData interface
import { fetchDashboardData, DashboardData } from '@/lib/api';
const Index = () => {
const { data, isLoading, error } = useQuery<DashboardData>({ // Use DashboardData for typing
const { data, isLoading, error } = useQuery<DashboardData>({
queryKey: ['dashboardData'],
queryFn: fetchDashboardData,
});
@ -20,7 +20,6 @@ const Index = () => {
return <div>Error loading dashboard data: {error.message}</div>;
}
// Provide default values if data is undefined (though useQuery's type should handle this better now)
const { totalStockValue, totalItems, totalOrders, totalCustomers } = data || {
totalStockValue: 0,
totalItems: 0,
@ -60,7 +59,7 @@ const Index = () => {
/>
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-7">
<Card className="col-span-4">
<Card className="col-span-7"> {/* Changed col-span-4 to col-span-7 to make Stock Overview full width */}
<CardHeader>
<CardTitle>Stock Overview</CardTitle>
</CardHeader>
@ -68,14 +67,7 @@ const Index = () => {
<StockChart />
</CardContent>
</Card>
<Card className="col-span-3">
<CardHeader>
<CardTitle>Recent Activity</CardTitle>
</CardHeader>
<CardContent>
<RecentActivity />
</CardContent>
</Card>
{/* Removed Recent Activity Card */}
</div>
</div>
);