Add mobile-stacked card layout for all admin tables
Implemented responsive card layout for mobile devices across all admin pages: - Desktop (md+): Shows traditional table layout - Mobile (<md): Shows stacked card layout with better readability AdminProducts.tsx: - Mobile cards display title, type, price (with sale badge), status - Action buttons (edit/delete) in header AdminOrders.tsx: - Mobile cards display order ID, email, status badge, total, payment method, date - View detail button in header AdminMembers.tsx: - Mobile cards display name, email, role badge, join date - Action buttons (detail/toggle admin) at bottom with full width AdminConsulting.tsx (upcoming & past tabs): - Mobile cards display date, time, client, category, status, meet link - Action buttons (link/complete/cancel) stacked at bottom AdminEvents.tsx (events & availability tabs): - Mobile cards display title/event type or block type, dates, status, notes - Action buttons (edit/delete) at bottom This approach provides much better UX on mobile compared to horizontal scrolling, especially for complex cells like sale prices with badges and multiple action buttons.
This commit is contained in:
@@ -235,7 +235,8 @@ export default function AdminEvents() {
|
||||
</Button>
|
||||
</CardHeader>
|
||||
<CardContent className="p-0">
|
||||
<div className="overflow-x-auto">
|
||||
{/* Desktop Table */}
|
||||
<div className="hidden md:block overflow-x-auto">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
@@ -277,6 +278,46 @@ export default function AdminEvents() {
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
|
||||
{/* Mobile Card Layout */}
|
||||
<div className="md:hidden space-y-3 p-4">
|
||||
{events.map((event) => (
|
||||
<Card key={event.id} className="border-2 border-border">
|
||||
<CardContent className="p-4 space-y-3">
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="font-semibold text-base line-clamp-1">{event.title}</h3>
|
||||
<p className="text-sm text-muted-foreground capitalize">{event.type}</p>
|
||||
</div>
|
||||
<Badge className={event.status === 'confirmed' ? 'bg-accent' : 'bg-muted shrink-0'}>
|
||||
{event.status}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm text-muted-foreground">Mulai:</span>
|
||||
<span className="text-sm">{formatDateTime(event.starts_at)}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-2 pt-2 border-t border-border">
|
||||
<Button variant="ghost" size="sm" onClick={() => handleEditEvent(event)} className="flex-1">
|
||||
<Pencil className="w-4 h-4 mr-1" />
|
||||
Edit
|
||||
</Button>
|
||||
<Button variant="ghost" size="sm" onClick={() => handleDeleteEvent(event.id)} className="flex-1 text-destructive">
|
||||
<Trash2 className="w-4 h-4 mr-1" />
|
||||
Hapus
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
{events.length === 0 && (
|
||||
<div className="text-center py-8 text-muted-foreground">
|
||||
Belum ada event
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</TabsContent>
|
||||
@@ -291,7 +332,8 @@ export default function AdminEvents() {
|
||||
</Button>
|
||||
</CardHeader>
|
||||
<CardContent className="p-0">
|
||||
<div className="overflow-x-auto">
|
||||
{/* Desktop Table */}
|
||||
<div className="hidden md:block overflow-x-auto">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
@@ -333,6 +375,57 @@ export default function AdminEvents() {
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
|
||||
{/* Mobile Card Layout */}
|
||||
<div className="md:hidden space-y-3 p-4">
|
||||
{blocks.map((block) => (
|
||||
<Card key={block.id} className="border-2 border-border">
|
||||
<CardContent className="p-4 space-y-3">
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="font-semibold text-base">
|
||||
{block.kind === 'available' ? 'Tersedia' : 'Tidak Tersedia'}
|
||||
</h3>
|
||||
</div>
|
||||
<Badge className={block.kind === 'available' ? 'bg-accent' : 'bg-destructive shrink-0'}>
|
||||
{block.kind === 'available' ? 'Tersedia' : 'Tidak'}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm text-muted-foreground">Mulai:</span>
|
||||
<span className="text-sm">{formatDateTime(block.starts_at)}</span>
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm text-muted-foreground">Selesai:</span>
|
||||
<span className="text-sm">{formatDateTime(block.ends_at)}</span>
|
||||
</div>
|
||||
{block.note && (
|
||||
<div className="flex items-start justify-between">
|
||||
<span className="text-sm text-muted-foreground">Catatan:</span>
|
||||
<span className="text-sm text-right flex-1 ml-4">{block.note}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex gap-2 pt-2 border-t border-border">
|
||||
<Button variant="ghost" size="sm" onClick={() => handleEditBlock(block)} className="flex-1">
|
||||
<Pencil className="w-4 h-4 mr-1" />
|
||||
Edit
|
||||
</Button>
|
||||
<Button variant="ghost" size="sm" onClick={() => handleDeleteBlock(block.id)} className="flex-1 text-destructive">
|
||||
<Trash2 className="w-4 h-4 mr-1" />
|
||||
Hapus
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
{blocks.length === 0 && (
|
||||
<div className="text-center py-8 text-muted-foreground">
|
||||
Belum ada blok ketersediaan
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</TabsContent>
|
||||
|
||||
Reference in New Issue
Block a user