@rudderhq/agent-runtime-claude-local 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/package.json +2 -2
  2. package/skills/app-builder/SKILL.md +39 -9
  3. package/skills/app-builder/assets/scaffold/app/globals.css +109 -16
  4. package/skills/app-builder/assets/scaffold/components/contacts-workspace.tsx +176 -152
  5. package/skills/app-builder/assets/scaffold/components/ui/alert.tsx +12 -0
  6. package/skills/app-builder/assets/scaffold/components/ui/badge.tsx +27 -0
  7. package/skills/app-builder/assets/scaffold/components/ui/button.tsx +9 -7
  8. package/skills/app-builder/assets/scaffold/components/ui/card.tsx +15 -3
  9. package/skills/app-builder/assets/scaffold/components/ui/empty.tsx +18 -0
  10. package/skills/app-builder/assets/scaffold/components/ui/field.tsx +23 -0
  11. package/skills/app-builder/assets/scaffold/components/ui/input.tsx +1 -1
  12. package/skills/app-builder/assets/scaffold/components/ui/label.tsx +1 -1
  13. package/skills/app-builder/assets/scaffold/components/ui/separator.tsx +6 -0
  14. package/skills/app-builder/assets/scaffold/components/ui/skeleton.tsx +6 -0
  15. package/skills/app-builder/assets/scaffold/components/ui/table.tsx +30 -0
  16. package/skills/app-builder/assets/scaffold/components.json +20 -0
  17. package/skills/app-builder/assets/scaffold/next-env.d.ts +1 -1
  18. package/skills/app-builder/assets/scaffold/next.config.ts +19 -0
  19. package/skills/app-builder/assets/scaffold/package.json +2 -1
  20. package/skills/app-builder/assets/scaffold/rudder.app.json +1 -1
  21. package/skills/app-builder/assets/scaffold/rudder.ui.json +13 -0
  22. package/skills/app-builder/assets/scaffold/scripts/validate-rudder-ui.mjs +50 -0
  23. package/skills/app-builder/assets/scaffold/tests/e2e/app.spec.ts +35 -1
  24. package/skills/app-builder/evals/evals.json +2 -1
  25. package/skills/app-builder/references/design-guidelines.md +19 -2
  26. package/skills/app-builder/references/rudder-ui-preset.md +73 -0
  27. package/skills/app-builder/references/scaffold-contract.md +12 -0
  28. package/skills/app-builder/references/verification.md +6 -0
  29. package/skills/app-builder/scripts/report-build-status.mjs +83 -0
  30. package/skills/rudder-docs/SKILL.md +2 -2
  31. package/skills/rudder-docs/evals/retrieval-authority-evals.json +40 -0
  32. package/skills/rudder-docs/evals/trigger-evals.json +2 -2
  33. package/skills/rudder-docs/references/api-reference.md +0 -2
  34. package/skills/rudder-docs/references/plugin-authoring.md +38 -114
  35. package/skills/rudder-docs/references/source-map.md +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rudderhq/agent-runtime-claude-local",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "homepage": "https://github.com/Undertone0809/rudder",
6
6
  "bugs": {
@@ -69,7 +69,7 @@
69
69
  "probe:quota:raw": "pnpm exec tsx src/cli/quota-probe.ts --json --raw-cli"
70
70
  },
71
71
  "dependencies": {
72
- "@rudderhq/agent-runtime-utils": "0.7.2",
72
+ "@rudderhq/agent-runtime-utils": "0.7.3",
73
73
  "picocolors": "^1.1.1"
74
74
  },
75
75
  "devDependencies": {
@@ -28,6 +28,9 @@ loopback attestation, and embedded opening.
28
28
  manager, development script, data boundary, and tests before editing.
29
29
  Preserve its stack and conventions; never replace it with the maintained
30
30
  scaffold merely to make it a Rudder App.
31
+ When the originating prompt includes `Rudder App handoff`, retain its App ID
32
+ for the completion protocol below. Do not guess an App ID or use one from a
33
+ different conversation.
31
34
  3. Read [references/scaffold-contract.md](references/scaffold-contract.md)
32
35
  before changing the runtime, database foundation, manifest, health endpoint,
33
36
  import/export contract, or background-job runner.
@@ -37,27 +40,51 @@ loopback attestation, and embedded opening.
37
40
  already has data, imports user data, changes its schema, or needs a real-data
38
41
  diagnosis.
39
42
  6. Follow [references/design-guidelines.md](references/design-guidelines.md)
40
- for visible UI work. Prefer coherent workflow screens over a generic
41
- dashboard assembled from decorative cards.
43
+ for visible UI work. For a new App, also read
44
+ [references/rudder-ui-preset.md](references/rudder-ui-preset.md) and start
45
+ from the versioned Rudder UI preset already present in the maintained
46
+ scaffold. Keep its semantic tokens and source-owned shadcn primitives unless
47
+ the brief explicitly requires a different product identity. For an existing
48
+ project, preserve its design system by default; align it to Rudder only when
49
+ the user asks for that change. Prefer coherent workflow screens over a
50
+ generic dashboard assembled from decorative cards.
42
51
  7. Run migrations against development or snapshot data, then run typecheck,
43
- unit tests, build, and relevant app E2E tests.
52
+ unit tests, build, and relevant app E2E tests. Review the final source and
53
+ rendered product for correctness, regressions, usability, data safety, and
54
+ evidence integrity; resolve every blocking finding before handoff.
44
55
  8. Prepare the website for its Rudder Apps handoff:
45
- - A new managed App created from Apps Home keeps its typed manifest and
46
- returns to that App's **Register & preview** action. Do not load the same
47
- source again through the manual Local App path.
56
+ - A new managed App created from Apps Home keeps its typed manifest. After
57
+ the completion gate passes, report `verified_source_ready` with the
58
+ originating App ID so Rudder Desktop can verify, start, and open that App
59
+ automatically. Do not load the same source through the manual Local App
60
+ path.
48
61
  - An independently authored existing project keeps a direct supported
49
62
  development script. Add the `package.json` `rudder` readiness or open-path
50
63
  fields only when discovery cannot infer them safely, then direct the
51
64
  operator to **Apps + > Add local web project** to select the folder and
52
65
  review the launch definition.
53
- The Agent writes and verifies source; Desktop alone owns runtime approval and
54
- process start. Do not invent a public URL, tunnel, cloud deployment, or
66
+ The Agent writes and verifies source; Desktop alone owns runtime admission
67
+ and process start. Do not invent a public URL, tunnel, cloud deployment, or
55
68
  unreviewed launch command.
56
69
  9. Read [references/verification.md](references/verification.md), then verify
57
70
  the rendered app with Rudder Browser. Exercise the main workflow plus at
58
71
  least one production-shaped edge case and inspect console errors.
59
72
  10. Materialize final screenshots and validation evidence in the originating
60
73
  Chat or Run. A localhost URL or tool-only screenshot is not durable output.
74
+ 11. For an originating managed App handoff, use the injected run context without
75
+ printing or requesting credentials:
76
+ - Run `node scripts/report-build-status.mjs building <app-id>` when
77
+ implementation begins.
78
+ - Run `node scripts/report-build-status.mjs verified_source_ready <app-id>`
79
+ only after every Completion Gate item passes. This is the machine-visible
80
+ signal that authorizes Desktop to verify, start, and open the exact
81
+ assigned source root.
82
+ - Run `node scripts/report-build-status.mjs failed <app-id>` when work ends
83
+ in a terminal failure. Do not emit `verified_source_ready` for a question,
84
+ partial implementation, canceled run, missing evidence, or blocker.
85
+ Finish by telling the user the App is opening and that they can continue
86
+ improving it in this Chat. If the status command fails, report that failure
87
+ honestly instead of claiming the App opened.
61
88
 
62
89
  ## Real Data Decision
63
90
 
@@ -86,7 +113,8 @@ controls and least-data workflow choices; explain the boundary honestly.
86
113
  screenshots, test fixtures, or logs. V1 does not provide a Rudder Secret
87
114
  binding UI, so ask the user how the App should obtain any required
88
115
  integration credential.
89
- - Opening Chat, Apps, an App tab, or a saved view must not passively start an app.
116
+ - Opening Chat, Apps Home, or a saved view must not passively start an app. A
117
+ run-scoped `verified_source_ready` handoff may start and open its managed App.
90
118
  - Cloud builds, hosted runtimes, public preview links, custom domains, managed
91
119
  cloud databases, and cross-device synchronization are outside this skill.
92
120
 
@@ -96,8 +124,10 @@ Do not call the app complete until:
96
124
 
97
125
  - source and any required manifest or `package.json` Rudder configuration are durable;
98
126
  - typecheck, unit tests, and build pass;
127
+ - blocking code and product review findings are resolved;
99
128
  - the reviewed readiness path is ready on an attested loopback process;
100
129
  - Browser verification covers the primary workflow and a relevant edge case;
130
+ - the versioned Rudder UI preset check passes for a new maintained App;
101
131
  - persistence behavior is verified against development or snapshot data;
102
132
  - current screenshot evidence is attached to the work;
103
133
  - user data was not modified without explicit intent; and
@@ -1,32 +1,125 @@
1
1
  @import "tailwindcss";
2
2
 
3
+ @custom-variant dark (&:is(.dark *));
4
+
3
5
  :root {
4
- --background: #f8fafc;
5
- --foreground: #172033;
6
- --card: #ffffff;
7
- --card-foreground: #172033;
8
- --muted: #eef2f7;
9
- --muted-foreground: #64748b;
10
- --primary: #2563eb;
11
- --primary-foreground: #ffffff;
12
- --destructive: #dc2626;
13
- --border: #dbe3ee;
14
- --ring: #3b82f6;
15
- --radius: 0.75rem;
6
+ color-scheme: light;
7
+ --background: oklch(0.975 0.008 80);
8
+ --foreground: oklch(0.22 0.012 75);
9
+ --card: oklch(0.992 0.004 80);
10
+ --card-foreground: oklch(0.22 0.012 75);
11
+ --popover: oklch(0.992 0.004 80);
12
+ --popover-foreground: oklch(0.22 0.012 75);
13
+ --primary: oklch(0.53 0.135 162);
14
+ --primary-foreground: oklch(0.985 0.01 160);
15
+ --secondary: oklch(0.94 0.009 78);
16
+ --secondary-foreground: oklch(0.29 0.012 75);
17
+ --muted: oklch(0.945 0.008 78);
18
+ --muted-foreground: oklch(0.52 0.014 75);
19
+ --accent: oklch(0.925 0.025 162);
20
+ --accent-foreground: oklch(0.32 0.08 162);
21
+ --destructive: oklch(0.56 0.2 27);
22
+ --destructive-foreground: oklch(0.985 0.005 27);
23
+ --border: oklch(0.875 0.01 75);
24
+ --input: oklch(0.875 0.01 75);
25
+ --ring: oklch(0.58 0.12 162);
26
+ --radius: 0.375rem;
16
27
  }
17
28
 
18
- * {
19
- border-color: var(--border);
29
+ .dark {
30
+ color-scheme: dark;
31
+ --background: oklch(0.18 0.012 75);
32
+ --foreground: oklch(0.93 0.008 75);
33
+ --card: oklch(0.215 0.012 75);
34
+ --card-foreground: oklch(0.93 0.008 75);
35
+ --popover: oklch(0.215 0.012 75);
36
+ --popover-foreground: oklch(0.93 0.008 75);
37
+ --primary: oklch(0.68 0.135 162);
38
+ --primary-foreground: oklch(0.17 0.03 162);
39
+ --secondary: oklch(0.27 0.012 75);
40
+ --secondary-foreground: oklch(0.91 0.008 75);
41
+ --muted: oklch(0.255 0.011 75);
42
+ --muted-foreground: oklch(0.69 0.012 75);
43
+ --accent: oklch(0.29 0.05 162);
44
+ --accent-foreground: oklch(0.88 0.06 162);
45
+ --destructive: oklch(0.66 0.18 27);
46
+ --destructive-foreground: oklch(0.98 0.005 27);
47
+ --border: oklch(0.34 0.012 75);
48
+ --input: oklch(0.34 0.012 75);
49
+ --ring: oklch(0.68 0.11 162);
50
+ }
51
+
52
+ @media (prefers-color-scheme: dark) {
53
+ :root:not(.light) {
54
+ color-scheme: dark;
55
+ --background: oklch(0.18 0.012 75);
56
+ --foreground: oklch(0.93 0.008 75);
57
+ --card: oklch(0.215 0.012 75);
58
+ --card-foreground: oklch(0.93 0.008 75);
59
+ --popover: oklch(0.215 0.012 75);
60
+ --popover-foreground: oklch(0.93 0.008 75);
61
+ --primary: oklch(0.68 0.135 162);
62
+ --primary-foreground: oklch(0.17 0.03 162);
63
+ --secondary: oklch(0.27 0.012 75);
64
+ --secondary-foreground: oklch(0.91 0.008 75);
65
+ --muted: oklch(0.255 0.011 75);
66
+ --muted-foreground: oklch(0.69 0.012 75);
67
+ --accent: oklch(0.29 0.05 162);
68
+ --accent-foreground: oklch(0.88 0.06 162);
69
+ --destructive: oklch(0.66 0.18 27);
70
+ --destructive-foreground: oklch(0.98 0.005 27);
71
+ --border: oklch(0.34 0.012 75);
72
+ --input: oklch(0.34 0.012 75);
73
+ --ring: oklch(0.68 0.11 162);
74
+ }
75
+ }
76
+
77
+ @theme inline {
78
+ --color-background: var(--background);
79
+ --color-foreground: var(--foreground);
80
+ --color-card: var(--card);
81
+ --color-card-foreground: var(--card-foreground);
82
+ --color-popover: var(--popover);
83
+ --color-popover-foreground: var(--popover-foreground);
84
+ --color-primary: var(--primary);
85
+ --color-primary-foreground: var(--primary-foreground);
86
+ --color-secondary: var(--secondary);
87
+ --color-secondary-foreground: var(--secondary-foreground);
88
+ --color-muted: var(--muted);
89
+ --color-muted-foreground: var(--muted-foreground);
90
+ --color-accent: var(--accent);
91
+ --color-accent-foreground: var(--accent-foreground);
92
+ --color-destructive: var(--destructive);
93
+ --color-destructive-foreground: var(--destructive-foreground);
94
+ --color-border: var(--border);
95
+ --color-input: var(--input);
96
+ --color-ring: var(--ring);
97
+ --radius-sm: calc(var(--radius) - 2px);
98
+ --radius-md: var(--radius);
99
+ --radius-lg: calc(var(--radius) + 2px);
20
100
  }
21
101
 
22
102
  body {
23
103
  margin: 0;
104
+ min-width: 320px;
24
105
  background: var(--background);
25
106
  color: var(--foreground);
26
107
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
108
+ text-rendering: optimizeLegibility;
27
109
  }
28
110
 
29
111
  button,
30
- input {
31
- font: inherit;
112
+ input,
113
+ select,
114
+ textarea {
115
+ color: inherit;
116
+ }
117
+
118
+ * {
119
+ border-color: var(--border);
120
+ }
121
+
122
+ ::selection {
123
+ background: var(--accent);
124
+ color: var(--accent-foreground);
32
125
  }
@@ -1,10 +1,15 @@
1
1
  "use client";
2
2
 
3
+ import { Alert } from "@/components/ui/alert";
4
+ import { Badge } from "@/components/ui/badge";
3
5
  import { Button } from "@/components/ui/button";
4
- import { Card, CardContent, CardHeader } from "@/components/ui/card";
6
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
7
+ import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
8
+ import { Field, FieldGroup, FieldLabel } from "@/components/ui/field";
5
9
  import { Input } from "@/components/ui/input";
6
- import { Label } from "@/components/ui/label";
7
- import { Download, Plus, Search, Trash2, Upload } from "lucide-react";
10
+ import { Skeleton } from "@/components/ui/skeleton";
11
+ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
12
+ import { Download, Plus, Search, Trash2, Upload, UsersRound } from "lucide-react";
8
13
  import { FormEvent, useCallback, useEffect, useMemo, useRef, useState } from "react";
9
14
 
10
15
  type Contact = {
@@ -25,6 +30,13 @@ type Draft = {
25
30
 
26
31
  const emptyDraft: Draft = { name: "", email: "", company: "" };
27
32
 
33
+ const statusVariant: Record<Contact["status"], "secondary" | "outline" | "success"> = {
34
+ new: "secondary",
35
+ contacted: "outline",
36
+ replied: "success",
37
+ paused: "outline",
38
+ };
39
+
28
40
  export function ContactsWorkspace() {
29
41
  const [contacts, setContacts] = useState<Contact[]>([]);
30
42
  const [draft, setDraft] = useState<Draft>(emptyDraft);
@@ -118,175 +130,187 @@ export function ContactsWorkspace() {
118
130
  }
119
131
 
120
132
  return (
121
- <div className="mx-auto grid max-w-7xl gap-6 px-4 py-6 lg:grid-cols-[minmax(0,1fr)_22rem] lg:px-8">
122
- <section className="min-w-0">
123
- <header className="mb-5 flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">
124
- <div>
125
- <p className="mb-1 text-sm font-medium text-[var(--primary)]">Contacts</p>
126
- <h1 className="m-0 text-2xl font-semibold tracking-tight">Customer workspace</h1>
127
- <p className="mb-0 mt-2 text-sm text-[var(--muted-foreground)]">
128
- Keep the next conversation visible and every record on this device.
129
- </p>
130
- </div>
131
- <div className="flex flex-wrap gap-2">
132
- <input
133
- ref={importRef}
134
- aria-label="Import app data"
135
- className="sr-only"
136
- type="file"
137
- accept="application/json,.json"
138
- onChange={(event) => {
139
- const file = event.currentTarget.files?.[0];
140
- if (file) void importData(file);
141
- }}
142
- />
143
- <Button type="button" variant="outline" onClick={() => importRef.current?.click()}>
144
- <Upload aria-hidden size={16} />
145
- Import
146
- </Button>
147
- <Button asChild variant="outline">
148
- <a href="/api/data/export" download>
149
- <Download aria-hidden size={16} />
150
- Export
151
- </a>
152
- </Button>
133
+ <div className="min-h-screen bg-background text-foreground">
134
+ <header className="border-b bg-card/80">
135
+ <div className="mx-auto flex h-14 max-w-7xl items-center justify-between px-4 lg:px-6">
136
+ <div className="flex min-w-0 items-center gap-3">
137
+ <span className="flex size-8 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground">
138
+ <UsersRound aria-hidden className="size-4" />
139
+ </span>
140
+ <div className="min-w-0">
141
+ <p className="m-0 truncate text-sm font-semibold">Pipeline Desk</p>
142
+ <p className="m-0 text-xs text-muted-foreground">Local customer workspace</p>
143
+ </div>
153
144
  </div>
154
- </header>
145
+ <Badge variant="outline">Development data</Badge>
146
+ </div>
147
+ </header>
155
148
 
156
- <Card>
157
- <CardHeader className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
149
+ <main className="mx-auto grid max-w-7xl gap-4 px-4 py-5 lg:grid-cols-[minmax(0,1fr)_20rem] lg:px-6">
150
+ <section className="min-w-0">
151
+ <div className="mb-4 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
158
152
  <div>
159
- <h2 className="m-0 text-base font-semibold">All contacts</h2>
160
- <p className="mb-0 mt-1 text-sm text-[var(--muted-foreground)]">
161
- {contacts.length} {contacts.length === 1 ? "record" : "records"}
153
+ <h1 className="m-0 text-2xl font-semibold">Contacts</h1>
154
+ <p className="mb-0 mt-1 text-sm text-muted-foreground">
155
+ Keep the next conversation visible and every record on this device.
162
156
  </p>
163
157
  </div>
164
- <div className="relative w-full sm:w-72">
165
- <Search
166
- aria-hidden
167
- className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-[var(--muted-foreground)]"
168
- size={16}
169
- />
170
- <Input
171
- aria-label="Search contacts"
172
- className="pl-9"
173
- placeholder="Search name, email, company…"
174
- value={query}
175
- onChange={(event) => setQuery(event.target.value)}
158
+ <div className="flex flex-wrap gap-2">
159
+ <input
160
+ ref={importRef}
161
+ aria-label="Import app data"
162
+ className="sr-only"
163
+ type="file"
164
+ accept="application/json,.json"
165
+ onChange={(event) => {
166
+ const file = event.currentTarget.files?.[0];
167
+ if (file) void importData(file);
168
+ }}
176
169
  />
170
+ <Button type="button" variant="outline" onClick={() => importRef.current?.click()}>
171
+ <Upload aria-hidden data-icon="inline-start" />
172
+ Import
173
+ </Button>
174
+ <Button asChild variant="outline">
175
+ <a href="/api/data/export" download>
176
+ <Download aria-hidden data-icon="inline-start" />
177
+ Export
178
+ </a>
179
+ </Button>
177
180
  </div>
178
- </CardHeader>
179
- <div aria-live="polite">
180
- {loading ? (
181
- <p className="p-8 text-center text-sm text-[var(--muted-foreground)]">
182
- Loading contacts…
183
- </p>
184
- ) : visibleContacts.length === 0 ? (
185
- <div className="p-10 text-center">
186
- <h3 className="m-0 text-base font-semibold">
187
- {contacts.length === 0 ? "No contacts yet" : "No matching contacts"}
188
- </h3>
189
- <p className="mb-0 mt-2 text-sm text-[var(--muted-foreground)]">
190
- {contacts.length === 0
191
- ? "Add the first contact with the form beside this list."
192
- : "Try a different name, email, company, or status."}
193
- </p>
181
+ </div>
182
+
183
+ <Card>
184
+ <CardHeader className="sm:flex-row sm:items-center sm:justify-between">
185
+ <div>
186
+ <CardTitle>All contacts</CardTitle>
187
+ <CardDescription>{contacts.length} {contacts.length === 1 ? "record" : "records"}</CardDescription>
188
+ </div>
189
+ <div className="relative w-full sm:w-64">
190
+ <Search aria-hidden className="pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" />
191
+ <Input
192
+ aria-label="Search contacts"
193
+ className="pl-9"
194
+ placeholder="Search contacts"
195
+ value={query}
196
+ onChange={(event) => setQuery(event.target.value)}
197
+ />
194
198
  </div>
195
- ) : (
196
- <div className="overflow-x-auto">
197
- <table className="w-full min-w-[42rem] border-collapse text-left text-sm">
198
- <thead className="bg-[var(--muted)] text-xs uppercase tracking-wide text-[var(--muted-foreground)]">
199
- <tr>
200
- <th className="px-5 py-3 font-medium" scope="col">Contact</th>
201
- <th className="px-5 py-3 font-medium" scope="col">Company</th>
202
- <th className="px-5 py-3 font-medium" scope="col">Status</th>
203
- <th className="px-5 py-3 text-right font-medium" scope="col">Actions</th>
204
- </tr>
205
- </thead>
206
- <tbody>
199
+ </CardHeader>
200
+ <div aria-live="polite">
201
+ {loading ? (
202
+ <div className="flex flex-col gap-3 p-4" aria-label="Loading contacts">
203
+ {[0, 1, 2].map((item) => <Skeleton className="h-11 w-full" key={item} />)}
204
+ </div>
205
+ ) : visibleContacts.length === 0 ? (
206
+ <Empty>
207
+ <EmptyHeader>
208
+ <EmptyTitle>{contacts.length === 0 ? "No contacts yet" : "No matching contacts"}</EmptyTitle>
209
+ <EmptyDescription>
210
+ {contacts.length === 0
211
+ ? "Add the first contact with the form beside this list."
212
+ : "Try a different name, email, company, or status."}
213
+ </EmptyDescription>
214
+ </EmptyHeader>
215
+ </Empty>
216
+ ) : (
217
+ <Table className="table-fixed sm:min-w-[40rem] sm:table-auto">
218
+ <TableHeader>
219
+ <TableRow>
220
+ <TableHead scope="col">Contact</TableHead>
221
+ <TableHead className="hidden sm:table-cell" scope="col">Company</TableHead>
222
+ <TableHead className="w-20 sm:w-auto" scope="col">Status</TableHead>
223
+ <TableHead aria-label="Actions" className="w-12 text-right sm:w-auto" scope="col">
224
+ <span className="hidden sm:inline">Actions</span>
225
+ </TableHead>
226
+ </TableRow>
227
+ </TableHeader>
228
+ <TableBody>
207
229
  {visibleContacts.map((contact) => (
208
- <tr className="border-t" key={contact.id}>
209
- <td className="px-5 py-4">
230
+ <TableRow key={contact.id}>
231
+ <TableCell>
210
232
  <strong className="block font-medium">{contact.name}</strong>
211
- <span className="text-[var(--muted-foreground)]">{contact.email}</span>
212
- </td>
213
- <td className="px-5 py-4">{contact.company || ""}</td>
214
- <td className="px-5 py-4">
215
- <span className="rounded-full bg-[var(--muted)] px-2.5 py-1 text-xs font-medium capitalize">
216
- {contact.status}
233
+ <span className="block break-all text-muted-foreground sm:inline">{contact.email}</span>
234
+ <span className="mt-1 block text-xs text-muted-foreground sm:hidden">
235
+ {contact.company || "Company not set"}
217
236
  </span>
218
- </td>
219
- <td className="px-5 py-4 text-right">
237
+ </TableCell>
238
+ <TableCell className="hidden sm:table-cell">{contact.company || "Not set"}</TableCell>
239
+ <TableCell>
240
+ <Badge variant={statusVariant[contact.status]}>{contact.status}</Badge>
241
+ </TableCell>
242
+ <TableCell className="text-right">
220
243
  <Button
221
244
  aria-label={`Delete ${contact.name}`}
222
- size="sm"
245
+ size="icon-sm"
223
246
  type="button"
224
247
  variant="ghost"
225
248
  onClick={() => void deleteContact(contact)}
226
249
  >
227
- <Trash2 aria-hidden size={16} />
250
+ <Trash2 aria-hidden />
228
251
  </Button>
229
- </td>
230
- </tr>
252
+ </TableCell>
253
+ </TableRow>
231
254
  ))}
232
- </tbody>
233
- </table>
234
- </div>
235
- )}
236
- </div>
237
- </Card>
238
- </section>
255
+ </TableBody>
256
+ </Table>
257
+ )}
258
+ </div>
259
+ </Card>
260
+ </section>
239
261
 
240
- <aside>
241
- <Card>
242
- <CardHeader>
243
- <h2 className="m-0 flex items-center gap-2 text-base font-semibold">
244
- <Plus aria-hidden size={18} />
245
- Add contact
246
- </h2>
247
- </CardHeader>
248
- <CardContent>
249
- <form className="grid gap-4" onSubmit={(event) => void createContact(event)}>
250
- <div className="grid gap-1.5">
251
- <Label htmlFor="contact-name">Name</Label>
252
- <Input
253
- id="contact-name"
254
- required
255
- autoComplete="name"
256
- value={draft.name}
257
- onChange={(event) => setDraft({ ...draft, name: event.target.value })}
258
- />
259
- </div>
260
- <div className="grid gap-1.5">
261
- <Label htmlFor="contact-email">Email</Label>
262
- <Input
263
- id="contact-email"
264
- required
265
- autoComplete="email"
266
- type="email"
267
- value={draft.email}
268
- onChange={(event) => setDraft({ ...draft, email: event.target.value })}
269
- />
270
- </div>
271
- <div className="grid gap-1.5">
272
- <Label htmlFor="contact-company">Company</Label>
273
- <Input
274
- id="contact-company"
275
- autoComplete="organization"
276
- value={draft.company}
277
- onChange={(event) => setDraft({ ...draft, company: event.target.value })}
278
- />
279
- </div>
280
- {error ? (
281
- <p className="m-0 text-sm text-[var(--destructive)]" role="alert">{error}</p>
282
- ) : null}
283
- <Button disabled={saving} type="submit">
284
- {saving ? "Adding" : "Add contact"}
285
- </Button>
286
- </form>
287
- </CardContent>
288
- </Card>
289
- </aside>
262
+ <aside>
263
+ <Card>
264
+ <CardHeader>
265
+ <CardTitle className="flex items-center gap-2">
266
+ <Plus aria-hidden className="size-4" />
267
+ Add contact
268
+ </CardTitle>
269
+ <CardDescription>Create a development record.</CardDescription>
270
+ </CardHeader>
271
+ <CardContent>
272
+ <form onSubmit={(event) => void createContact(event)}>
273
+ <FieldGroup>
274
+ <Field>
275
+ <FieldLabel htmlFor="contact-name">Name</FieldLabel>
276
+ <Input
277
+ id="contact-name"
278
+ required
279
+ autoComplete="name"
280
+ value={draft.name}
281
+ onChange={(event) => setDraft({ ...draft, name: event.target.value })}
282
+ />
283
+ </Field>
284
+ <Field>
285
+ <FieldLabel htmlFor="contact-email">Email</FieldLabel>
286
+ <Input
287
+ id="contact-email"
288
+ required
289
+ autoComplete="email"
290
+ type="email"
291
+ value={draft.email}
292
+ onChange={(event) => setDraft({ ...draft, email: event.target.value })}
293
+ />
294
+ </Field>
295
+ <Field>
296
+ <FieldLabel htmlFor="contact-company">Company</FieldLabel>
297
+ <Input
298
+ id="contact-company"
299
+ autoComplete="organization"
300
+ value={draft.company}
301
+ onChange={(event) => setDraft({ ...draft, company: event.target.value })}
302
+ />
303
+ </Field>
304
+ {error ? <Alert>{error}</Alert> : null}
305
+ <Button disabled={saving} type="submit">
306
+ {saving ? "Adding..." : "Add contact"}
307
+ </Button>
308
+ </FieldGroup>
309
+ </form>
310
+ </CardContent>
311
+ </Card>
312
+ </aside>
313
+ </main>
290
314
  </div>
291
315
  );
292
316
  }
@@ -0,0 +1,12 @@
1
+ import { cn } from "@/lib/utils";
2
+ import * as React from "react";
3
+
4
+ export function Alert({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
5
+ return (
6
+ <div
7
+ role="alert"
8
+ className={cn("rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-sm text-destructive", className)}
9
+ {...props}
10
+ />
11
+ );
12
+ }