-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5142559
commit 838377f
Showing
33 changed files
with
1,968 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Store, ShoppingCart, Users } from 'lucide-react'; | ||
import Link from 'next/link'; | ||
|
||
export default function DashboardLayout({ | ||
children | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<div className='min-h-screen flex'> | ||
{/* Sidebar */} | ||
<aside className='w-64 bg-gray-900 text-white'> | ||
<div className='p-4'> | ||
<h1 className='text-2xl font-bold'>Admin Panel</h1> | ||
</div> | ||
<nav className='mt-8'> | ||
<div className='px-4 space-y-2'> | ||
<Link | ||
href='/dashboard/stores' | ||
className='flex items-center space-x-2 p-2 rounded-lg hover:bg-gray-800' | ||
> | ||
<Store className='h-5 w-5' /> | ||
<span>Stores</span> | ||
</Link> | ||
<Link | ||
href='/dashboard/orders' | ||
className='flex items-center space-x-2 p-2 rounded-lg hover:bg-gray-800' | ||
> | ||
<ShoppingCart className='h-5 w-5' /> | ||
<span>Orders</span> | ||
</Link> | ||
<Link | ||
href='/dashboard/users' | ||
className='flex items-center space-x-2 p-2 rounded-lg hover:bg-gray-800' | ||
> | ||
<Users className='h-5 w-5' /> | ||
<span>Users</span> | ||
</Link> | ||
</div> | ||
</nav> | ||
</aside> | ||
|
||
{/* Main Content */} | ||
<main className='flex-1 p-8 bg-gray-100 dark:bg-gray-800'> | ||
{children} | ||
</main> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
'use client'; | ||
|
||
import { Eye } from 'lucide-react'; | ||
|
||
import { Badge } from '@/components/ui/badge'; | ||
import { Button } from '@/components/ui/button'; | ||
import { | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableHead, | ||
TableHeader, | ||
TableRow | ||
} from '@/components/ui/table'; | ||
import { useOrdersQuery } from '@/data/queries/orders'; | ||
|
||
const statusVariants = { | ||
Pending: 'secondary', | ||
Processing: 'default', | ||
Completed: 'success', | ||
Cancelled: 'destructive', | ||
Delivered: 'success' | ||
} as const; | ||
|
||
export default function OrdersPage() { | ||
const { data: orders, isLoading } = useOrdersQuery(); | ||
return ( | ||
<div className='space-y-6'> | ||
<div className='flex justify-between items-center'> | ||
<h1 className='text-3xl font-bold'>Orders</h1> | ||
</div> | ||
|
||
<div className='bg-white dark:bg-gray-900 shadow rounded-lg'> | ||
<Table> | ||
<TableHeader> | ||
<TableRow> | ||
<TableHead>Order ID</TableHead> | ||
<TableHead>Customer</TableHead> | ||
<TableHead>Store</TableHead> | ||
<TableHead>Status</TableHead> | ||
<TableHead>Total</TableHead> | ||
<TableHead>Date</TableHead> | ||
<TableHead>Actions</TableHead> | ||
</TableRow> | ||
</TableHeader> | ||
<TableBody> | ||
{isLoading ? ( | ||
<TableRow> | ||
<TableCell colSpan={7} className='text-center'> | ||
Loading... | ||
</TableCell> | ||
</TableRow> | ||
) : ( | ||
orders?.map(order => ( | ||
<TableRow key={order.id}> | ||
<TableCell>{order.id}</TableCell> | ||
<TableCell>{order.user.name}</TableCell> | ||
<TableCell>{order.store.name}</TableCell> | ||
<TableCell> | ||
<Badge | ||
variant={ | ||
statusVariants[ | ||
order.status as keyof typeof statusVariants | ||
] | ||
} | ||
> | ||
{order.status} | ||
</Badge> | ||
</TableCell> | ||
<TableCell>${order.total.toFixed(2)}</TableCell> | ||
<TableCell> | ||
{new Date(order.createdAt).toLocaleDateString()} | ||
</TableCell> | ||
<TableCell> | ||
<div className='flex gap-2'> | ||
<Button variant='ghost' size='sm' className='h-8 w-8 p-0'> | ||
<Eye className='h-4 w-4' /> | ||
</Button> | ||
</div> | ||
</TableCell> | ||
</TableRow> | ||
)) | ||
)} | ||
</TableBody> | ||
</Table> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
'use client'; | ||
|
||
import { Edit, Trash } from 'lucide-react'; | ||
|
||
import { Button } from '@/components/ui/button'; | ||
import { | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableHead, | ||
TableHeader, | ||
TableRow | ||
} from '@/components/ui/table'; | ||
import { useStoresQuery } from '@/data/queries/stores'; | ||
|
||
export default function StoresPage() { | ||
const { data: stores, isLoading } = useStoresQuery(); | ||
|
||
return ( | ||
<div className='space-y-6'> | ||
<div className='flex justify-between items-center'> | ||
<h1 className='text-3xl font-bold'>Stores</h1> | ||
</div> | ||
|
||
<div className='bg-white dark:bg-gray-900 shadow rounded-lg'> | ||
<Table> | ||
<TableHeader> | ||
<TableRow> | ||
<TableHead>Store Name</TableHead> | ||
<TableHead>Actions</TableHead> | ||
</TableRow> | ||
</TableHeader> | ||
<TableBody> | ||
{isLoading ? ( | ||
<TableRow> | ||
<TableCell colSpan={5} className='text-center'> | ||
Loading... | ||
</TableCell> | ||
</TableRow> | ||
) : ( | ||
stores?.map(store => ( | ||
<TableRow key={store.id}> | ||
<TableCell>{store.name}</TableCell> | ||
<TableCell> | ||
<div className='flex gap-2'> | ||
<Button variant='ghost' size='sm' className='h-8 w-8 p-0'> | ||
<Edit className='h-4 w-4' /> | ||
</Button> | ||
<Button | ||
variant='ghost' | ||
size='sm' | ||
className='h-8 w-8 p-0 text-destructive hover:text-destructive' | ||
> | ||
<Trash className='h-4 w-4' /> | ||
</Button> | ||
</div> | ||
</TableCell> | ||
</TableRow> | ||
)) | ||
)} | ||
</TableBody> | ||
</Table> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
'use client'; | ||
|
||
import { Edit, Trash } from 'lucide-react'; | ||
|
||
import { Button } from '@/components/ui/button'; | ||
import { | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableHead, | ||
TableHeader, | ||
TableRow | ||
} from '@/components/ui/table'; | ||
import { useUsersQuery } from '@/data/queries/users'; | ||
|
||
export default function UsersPage() { | ||
const { data: users, isLoading } = useUsersQuery(); | ||
|
||
return ( | ||
<div className='space-y-6'> | ||
<div className='flex justify-between items-center'> | ||
<h1 className='text-3xl font-bold'>Users</h1> | ||
</div> | ||
|
||
<div className='bg-white dark:bg-gray-900 shadow rounded-lg'> | ||
<Table> | ||
<TableHeader> | ||
<TableRow> | ||
<TableHead>Name</TableHead> | ||
<TableHead>Email</TableHead> | ||
<TableHead>Joined</TableHead> | ||
<TableHead>Actions</TableHead> | ||
</TableRow> | ||
</TableHeader> | ||
<TableBody> | ||
{isLoading ? ( | ||
<TableRow> | ||
<TableCell colSpan={6} className='text-center'> | ||
Loading... | ||
</TableCell> | ||
</TableRow> | ||
) : ( | ||
users?.map(user => ( | ||
<TableRow key={user.id}> | ||
<TableCell>{user.name}</TableCell> | ||
<TableCell>{user.email}</TableCell> | ||
<TableCell> | ||
{new Date(user.createdAt).toLocaleDateString()} | ||
</TableCell> | ||
<TableCell> | ||
<div className='flex gap-2'> | ||
<Button variant='ghost' size='sm' className='h-8 w-8 p-0'> | ||
<Edit className='h-4 w-4' /> | ||
</Button> | ||
<Button | ||
variant='ghost' | ||
size='sm' | ||
className='h-8 w-8 p-0 text-destructive hover:text-destructive' | ||
> | ||
<Trash className='h-4 w-4' /> | ||
</Button> | ||
</div> | ||
</TableCell> | ||
</TableRow> | ||
)) | ||
)} | ||
</TableBody> | ||
</Table> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.