Skip to content

Commit e3dca1c

Browse files
committed
Improve Clients
1 parent 7f9a9b5 commit e3dca1c

11 files changed

Lines changed: 389 additions & 311 deletions

File tree

src/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ function MainContent() {
1919
}
2020

2121
return (
22-
<div className="flex flex-col gap-6 p-6">
22+
<div className="flex h-full flex-col gap-4 p-6">
2323
<RealmCard />
24-
<LicenseSection />
24+
<div className="min-h-0 flex-1">
25+
<LicenseSection />
26+
</div>
2527
</div>
2628
);
2729
}

src/components/client/ClientCombobox.tsx

Lines changed: 0 additions & 214 deletions
This file was deleted.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import { Check, Users } from "lucide-react";
2+
import { Button } from "@/components/ui/button";
3+
import type { Client } from "@/lib/types";
4+
import { cn } from "@/lib/utils";
5+
6+
interface ClientSelectorProps {
7+
clients: Client[];
8+
selectedClientId: string | null;
9+
onSelectClient: (clientId: string) => void;
10+
hasFilter?: boolean;
11+
}
12+
13+
export function ClientSelector({
14+
clients,
15+
selectedClientId,
16+
onSelectClient,
17+
hasFilter,
18+
}: ClientSelectorProps) {
19+
if (clients.length === 0) {
20+
return (
21+
<div className="flex flex-col items-center justify-center py-8 text-center">
22+
<Users className="mb-3 h-8 w-8 text-muted-foreground/50" />
23+
<p className="text-sm text-muted-foreground">
24+
{hasFilter
25+
? "No clients match your search."
26+
: "No clients yet. Create one to get started."}
27+
</p>
28+
</div>
29+
);
30+
}
31+
32+
return (
33+
<ul className="space-y-1">
34+
{clients.map((client) => {
35+
const isSelected = selectedClientId === client.id;
36+
37+
return (
38+
<li key={client.id}>
39+
<Button
40+
variant={isSelected ? "default" : "ghost"}
41+
onClick={() => onSelectClient(client.id)}
42+
className={cn(
43+
"h-auto w-full justify-start py-2",
44+
!isSelected && "text-foreground",
45+
)}
46+
>
47+
<div className="flex flex-1 flex-col items-start gap-0.5 overflow-hidden">
48+
<span className="truncate text-left text-sm font-medium">
49+
{client.label || client.client}
50+
</span>
51+
{client.label && (
52+
<span
53+
className={cn(
54+
"truncate text-left text-xs",
55+
isSelected
56+
? "text-primary-foreground/70"
57+
: "text-muted-foreground",
58+
)}
59+
>
60+
{client.client}
61+
</span>
62+
)}
63+
</div>
64+
{isSelected && (
65+
<Check className="h-4 w-4 shrink-0" />
66+
)}
67+
</Button>
68+
</li>
69+
);
70+
})}
71+
</ul>
72+
);
73+
}

0 commit comments

Comments
 (0)