fix: improve responsiveness and accessibility of dashboard and quotes pages

This commit is contained in:
SJCoetz 2026-05-24 16:51:12 +02:00
parent 363786ea36
commit a828432540
2 changed files with 107 additions and 63 deletions

View file

@ -151,10 +151,10 @@ export default function DashboardPage() {
<div className="space-y-6">
<div>
<h1 className="text-2xl font-bold tracking-tight">Dashboard</h1>
<p className="text-muted-foreground">Overview of your business</p>
<p className="text-muted-foreground text-sm sm:text-base">Overview of your business</p>
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
<div className="grid gap-4 grid-cols-2 lg:grid-cols-4">
{statCards.map((card) => (
<Card key={card.title}>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
@ -171,17 +171,18 @@ export default function DashboardPage() {
))}
</div>
<div className="grid gap-6 md:grid-cols-2">
<div className="grid gap-6 lg:grid-cols-2">
<Card>
<CardHeader>
<div className="flex items-center justify-between">
<CardTitle className="text-lg flex items-center gap-2">
<FileText className="h-5 w-5" />
Recent Quotes
<div className="flex items-center justify-between gap-2">
<CardTitle className="text-base sm:text-lg flex items-center gap-2">
<FileText className="h-4 w-4 sm:h-5 sm:w-5" />
<span className="hidden sm:inline">Recent Quotes</span>
<span className="sm:hidden">Quotes</span>
</CardTitle>
<Badge variant="secondary" className="gap-1">
<Badge variant="secondary" className="gap-1 shrink-0">
<Clock className="h-3 w-3" />
Live
<span className="hidden sm:inline">Live</span>
</Badge>
</div>
</CardHeader>
@ -192,46 +193,68 @@ export default function DashboardPage() {
<p>No quotes yet</p>
</div>
) : (
<Table>
<TableHeader>
<TableRow>
<TableHead>Quote #</TableHead>
<TableHead>Customer</TableHead>
<TableHead>Status</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<>
<div className="hidden sm:block">
<Table>
<TableHeader>
<TableRow>
<TableHead>Quote #</TableHead>
<TableHead>Customer</TableHead>
<TableHead>Status</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{recentQuotes.map((q) => (
<TableRow
key={q.id}
className="cursor-pointer"
onClick={() => router.push(`/quotes/${q.id}`)}
>
<TableCell className="font-medium">{q.quote_number}</TableCell>
<TableCell>{q.expand?.customer?.customer || "—"}</TableCell>
<TableCell>
<Badge variant={statusColors[q.status] || "secondary"}>
{q.status.replace("_", " ")}
</Badge>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
<div className="sm:hidden space-y-2 p-4">
{recentQuotes.map((q) => (
<TableRow
<div
key={q.id}
className="cursor-pointer"
className="flex items-center justify-between p-3 rounded-lg border cursor-pointer hover:bg-accent transition-colors"
onClick={() => router.push(`/quotes/${q.id}`)}
>
<TableCell className="font-medium">{q.quote_number}</TableCell>
<TableCell>{q.expand?.customer?.customer || "—"}</TableCell>
<TableCell>
<Badge variant={statusColors[q.status] || "secondary"}>
{q.status.replace("_", " ")}
</Badge>
</TableCell>
</TableRow>
<div className="min-w-0 flex-1">
<p className="font-medium text-sm truncate">{q.quote_number}</p>
<p className="text-xs text-muted-foreground truncate">{q.expand?.customer?.customer || "—"}</p>
</div>
<Badge variant={statusColors[q.status] || "secondary"} className="text-xs shrink-0 ml-2">
{q.status.replace("_", " ")}
</Badge>
</div>
))}
</TableBody>
</Table>
</div>
</>
)}
</CardContent>
</Card>
<Card>
<CardHeader>
<div className="flex items-center justify-between">
<CardTitle className="text-lg flex items-center gap-2">
<ShoppingCart className="h-5 w-5" />
Recent Orders
<div className="flex items-center justify-between gap-2">
<CardTitle className="text-base sm:text-lg flex items-center gap-2">
<ShoppingCart className="h-4 w-4 sm:h-5 sm:w-5" />
<span className="hidden sm:inline">Recent Orders</span>
<span className="sm:hidden">Orders</span>
</CardTitle>
<Badge variant="secondary" className="gap-1">
<Badge variant="secondary" className="gap-1 shrink-0">
<Clock className="h-3 w-3" />
Live
<span className="hidden sm:inline">Live</span>
</Badge>
</div>
</CardHeader>
@ -242,32 +265,53 @@ export default function DashboardPage() {
<p>No orders yet</p>
</div>
) : (
<Table>
<TableHeader>
<TableRow>
<TableHead>Order #</TableHead>
<TableHead>Company</TableHead>
<TableHead>Status</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<>
<div className="hidden sm:block">
<Table>
<TableHeader>
<TableRow>
<TableHead>Order #</TableHead>
<TableHead>Company</TableHead>
<TableHead>Status</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{recentOrders.map((o) => (
<TableRow
key={o.id}
className="cursor-pointer"
onClick={() => router.push(`/orders/${o.id}`)}
>
<TableCell className="font-medium">{o.order_number}</TableCell>
<TableCell>{o.expand?.company?.company || "—"}</TableCell>
<TableCell>
<Badge variant={statusColors[o.status] || "secondary"}>
{o.status.replace("_", " ")}
</Badge>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
<div className="sm:hidden space-y-2 p-4">
{recentOrders.map((o) => (
<TableRow
<div
key={o.id}
className="cursor-pointer"
className="flex items-center justify-between p-3 rounded-lg border cursor-pointer hover:bg-accent transition-colors"
onClick={() => router.push(`/orders/${o.id}`)}
>
<TableCell className="font-medium">{o.order_number}</TableCell>
<TableCell>{o.expand?.company?.company || "—"}</TableCell>
<TableCell>
<Badge variant={statusColors[o.status] || "secondary"}>
{o.status.replace("_", " ")}
</Badge>
</TableCell>
</TableRow>
<div className="min-w-0 flex-1">
<p className="font-medium text-sm truncate">{o.order_number}</p>
<p className="text-xs text-muted-foreground truncate">{o.expand?.company?.company || "—"}</p>
</div>
<Badge variant={statusColors[o.status] || "secondary"} className="text-xs shrink-0 ml-2">
{o.status.replace("_", " ")}
</Badge>
</div>
))}
</TableBody>
</Table>
</div>
</>
)}
</CardContent>
</Card>

View file

@ -91,23 +91,23 @@ export default function QuotesPage() {
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3">
<div>
<h1 className="text-2xl font-bold tracking-tight">Quotes</h1>
<p className="text-muted-foreground">Manage quote requests</p>
<p className="text-muted-foreground text-sm sm:text-base">Manage quote requests</p>
</div>
<div className="flex gap-2">
<div className="flex gap-2 flex-wrap">
<Button variant="outline" size="sm" onClick={() => router.push("/quotes/approvals")}>
<CheckCircle className="mr-1 h-4 w-4" />
Approvals
<span className="hidden sm:inline">Approvals</span>
</Button>
<Button variant="outline" size="sm" onClick={() => router.push("/quotes/archived")}>
<Archive className="mr-1 h-4 w-4" />
Archive
<span className="hidden sm:inline">Archive</span>
</Button>
<Button size="sm" onClick={() => setFormOpen(true)}>
<Plus className="mr-1 h-4 w-4" />
New Quote
<span className="hidden sm:inline">New Quote</span>
</Button>
</div>
</div>