@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.
- package/package.json +2 -2
- package/skills/app-builder/SKILL.md +39 -9
- package/skills/app-builder/assets/scaffold/app/globals.css +109 -16
- package/skills/app-builder/assets/scaffold/components/contacts-workspace.tsx +176 -152
- package/skills/app-builder/assets/scaffold/components/ui/alert.tsx +12 -0
- package/skills/app-builder/assets/scaffold/components/ui/badge.tsx +27 -0
- package/skills/app-builder/assets/scaffold/components/ui/button.tsx +9 -7
- package/skills/app-builder/assets/scaffold/components/ui/card.tsx +15 -3
- package/skills/app-builder/assets/scaffold/components/ui/empty.tsx +18 -0
- package/skills/app-builder/assets/scaffold/components/ui/field.tsx +23 -0
- package/skills/app-builder/assets/scaffold/components/ui/input.tsx +1 -1
- package/skills/app-builder/assets/scaffold/components/ui/label.tsx +1 -1
- package/skills/app-builder/assets/scaffold/components/ui/separator.tsx +6 -0
- package/skills/app-builder/assets/scaffold/components/ui/skeleton.tsx +6 -0
- package/skills/app-builder/assets/scaffold/components/ui/table.tsx +30 -0
- package/skills/app-builder/assets/scaffold/components.json +20 -0
- package/skills/app-builder/assets/scaffold/next-env.d.ts +1 -1
- package/skills/app-builder/assets/scaffold/next.config.ts +19 -0
- package/skills/app-builder/assets/scaffold/package.json +2 -1
- package/skills/app-builder/assets/scaffold/rudder.app.json +1 -1
- package/skills/app-builder/assets/scaffold/rudder.ui.json +13 -0
- package/skills/app-builder/assets/scaffold/scripts/validate-rudder-ui.mjs +50 -0
- package/skills/app-builder/assets/scaffold/tests/e2e/app.spec.ts +35 -1
- package/skills/app-builder/evals/evals.json +2 -1
- package/skills/app-builder/references/design-guidelines.md +19 -2
- package/skills/app-builder/references/rudder-ui-preset.md +73 -0
- package/skills/app-builder/references/scaffold-contract.md +12 -0
- package/skills/app-builder/references/verification.md +6 -0
- package/skills/app-builder/scripts/report-build-status.mjs +83 -0
- package/skills/rudder-docs/SKILL.md +2 -2
- package/skills/rudder-docs/evals/retrieval-authority-evals.json +40 -0
- package/skills/rudder-docs/evals/trigger-evals.json +2 -2
- package/skills/rudder-docs/references/api-reference.md +0 -2
- package/skills/rudder-docs/references/plugin-authoring.md +38 -114
- 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.
|
|
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.
|
|
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.
|
|
41
|
-
|
|
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
|
|
46
|
-
|
|
47
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
5
|
-
--
|
|
6
|
-
--
|
|
7
|
-
--card
|
|
8
|
-
--
|
|
9
|
-
--
|
|
10
|
-
--
|
|
11
|
-
--primary
|
|
12
|
-
--
|
|
13
|
-
--
|
|
14
|
-
--
|
|
15
|
-
--
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
7
|
-
import {
|
|
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="
|
|
122
|
-
<
|
|
123
|
-
<
|
|
124
|
-
<div>
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
|
|
145
|
+
<Badge variant="outline">Development data</Badge>
|
|
146
|
+
</div>
|
|
147
|
+
</header>
|
|
155
148
|
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
<
|
|
160
|
-
<p className="mb-0 mt-1 text-sm text-
|
|
161
|
-
|
|
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="
|
|
165
|
-
<
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
</
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
</
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
<
|
|
209
|
-
<
|
|
230
|
+
<TableRow key={contact.id}>
|
|
231
|
+
<TableCell>
|
|
210
232
|
<strong className="block font-medium">{contact.name}</strong>
|
|
211
|
-
<span className="text-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
</
|
|
219
|
-
<
|
|
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
|
|
250
|
+
<Trash2 aria-hidden />
|
|
228
251
|
</Button>
|
|
229
|
-
</
|
|
230
|
-
</
|
|
252
|
+
</TableCell>
|
|
253
|
+
</TableRow>
|
|
231
254
|
))}
|
|
232
|
-
</
|
|
233
|
-
</
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
</
|
|
237
|
-
</
|
|
238
|
-
</section>
|
|
255
|
+
</TableBody>
|
|
256
|
+
</Table>
|
|
257
|
+
)}
|
|
258
|
+
</div>
|
|
259
|
+
</Card>
|
|
260
|
+
</section>
|
|
239
261
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
<
|
|
250
|
-
<
|
|
251
|
-
<
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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
|
+
}
|