@nebulit/embuilder 0.1.39

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 (212) hide show
  1. package/README.md +254 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +138 -0
  4. package/package.json +49 -0
  5. package/templates/.claude/hooks/QUICKSTART.md +256 -0
  6. package/templates/.claude/hooks/README.md +533 -0
  7. package/templates/.claude/hooks/analyze-commit.sh +22 -0
  8. package/templates/.claude/hooks/analyze-commit.ts +518 -0
  9. package/templates/.claude/hooks/analyzers/README.md +198 -0
  10. package/templates/.claude/hooks/analyzers/code-quality-checker.ts +154 -0
  11. package/templates/.claude/hooks/analyzers/code-quality.md +54 -0
  12. package/templates/.claude/hooks/analyzers/commit-blocker-example.ts.disabled +110 -0
  13. package/templates/.claude/hooks/analyzers/commit-policy.md +49 -0
  14. package/templates/.claude/hooks/analyzers/event-model-validator.md +49 -0
  15. package/templates/.claude/hooks/analyzers/event-model-validator.ts +169 -0
  16. package/templates/.claude/hooks/analyzers/example-logger.ts +70 -0
  17. package/templates/.claude/hooks/analyzers/slice-scope-validator.md +81 -0
  18. package/templates/.claude/hooks/check-review-result.sh +47 -0
  19. package/templates/.claude/hooks/prepare-review.sh +34 -0
  20. package/templates/.claude/hooks/review-agent-prompt.md +42 -0
  21. package/templates/.claude/hooks/run-review-agent.sh +124 -0
  22. package/templates/.claude/settings.local.json +37 -0
  23. package/templates/.claude/skills/help/README.md +84 -0
  24. package/templates/.claude/skills/help/SKILL.md +393 -0
  25. package/templates/.claude/skills/help/templates/demo-config.json +6753 -0
  26. package/templates/.claude/skills/sample-slices/SKILL.md +8 -0
  27. package/templates/.claude/skills/sample-slices/templates/.slices/Library/addbook/code-slice.json +124 -0
  28. package/templates/.claude/skills/sample-slices/templates/.slices/Library/addbook/slice.json +255 -0
  29. package/templates/.claude/skills/sample-slices/templates/.slices/Library/availablebooks/slice.json +107 -0
  30. package/templates/.claude/skills/sample-slices/templates/.slices/index.json +20 -0
  31. package/templates/.claude/skills/sample-slices/templates/Cart/additem/slice.json +979 -0
  32. package/templates/.claude/skills/sample-slices/templates/Cart/archiveitem/slice.json +529 -0
  33. package/templates/.claude/skills/sample-slices/templates/Cart/cartitems/slice.json +1072 -0
  34. package/templates/.claude/skills/sample-slices/templates/Cart/cartwithproducts/slice.json +394 -0
  35. package/templates/.claude/skills/sample-slices/templates/Cart/changedprices/slice.json +88 -0
  36. package/templates/.claude/skills/sample-slices/templates/Cart/changeinventory/slice.json +264 -0
  37. package/templates/.claude/skills/sample-slices/templates/Cart/changeprice/slice.json +308 -0
  38. package/templates/.claude/skills/sample-slices/templates/Cart/clearcart/slice.json +358 -0
  39. package/templates/.claude/skills/sample-slices/templates/Cart/inventories/slice.json +203 -0
  40. package/templates/.claude/skills/sample-slices/templates/Cart/publishcart/slice.json +876 -0
  41. package/templates/.claude/skills/sample-slices/templates/Cart/removeitem/slice.json +560 -0
  42. package/templates/.claude/skills/sample-slices/templates/Cart/submitcart/slice.json +708 -0
  43. package/templates/.claude/skills/sample-slices/templates/Cart/submittedcartdata/slice.json +399 -0
  44. package/templates/.claude/skills/sample-slices/templates/index.json +108 -0
  45. package/templates/.claude/skills/slice-automation/SKILL.md +49 -0
  46. package/templates/.claude/skills/slice-state-change/SKILL.md +369 -0
  47. package/templates/.claude/skills/slice-state-change/templates/AddLocation/AddLocation.test.ts.sample +76 -0
  48. package/templates/.claude/skills/slice-state-change/templates/AddLocation/AddLocationCommand.ts.sample +84 -0
  49. package/templates/.claude/skills/slice-state-change/templates/AddLocation/routes.ts.sample +73 -0
  50. package/templates/.claude/skills/slice-state-change/templates/README.md +46 -0
  51. package/templates/.claude/skills/slice-state-view/SKILL.md +336 -0
  52. package/templates/.claude/skills/slice-state-view/templates/Locations/Locations.test.ts.sample +84 -0
  53. package/templates/.claude/skills/slice-state-view/templates/Locations/LocationsProjection.ts.sample +50 -0
  54. package/templates/.claude/skills/slice-state-view/templates/Locations/routes.ts.sample +46 -0
  55. package/templates/.claude/skills/slice-state-view/templates/README.md +109 -0
  56. package/templates/.claude/skills/slice-state-view/templates/Tables/Tables.test.ts.sample +104 -0
  57. package/templates/.claude/skills/slice-state-view/templates/Tables/TablesProjection.ts.sample +59 -0
  58. package/templates/.claude/skills/slice-state-view/templates/Tables/routes.ts.sample +46 -0
  59. package/templates/.claude/skills/slice-state-view/templates/V2__tables.sql +7 -0
  60. package/templates/.claude/skills/slice-state-view/templates/V8__locations.sql +7 -0
  61. package/templates/.claude/skills/test-analyzer/SKILL.md +373 -0
  62. package/templates/.claude/skills/test-analyzer/examples/specification-format.md +143 -0
  63. package/templates/.claude/skills/test-analyzer/examples/state-change-example.md +111 -0
  64. package/templates/.claude/skills/test-analyzer/examples/state-view-example.md +122 -0
  65. package/templates/AGENTS.md +110 -0
  66. package/templates/Claude.md +58 -0
  67. package/templates/README.md +178 -0
  68. package/templates/backend/.env +9 -0
  69. package/templates/backend/BACKEND_AUTH_SETUP.md +183 -0
  70. package/templates/backend/SWAGGER.md +213 -0
  71. package/templates/backend/eslint.config.mjs +31 -0
  72. package/templates/backend/flyway.conf +17 -0
  73. package/templates/backend/package.json +44 -0
  74. package/templates/backend/prd.json.example +64 -0
  75. package/templates/backend/public/assets/images/banner.png +0 -0
  76. package/templates/backend/public/assets/logo.png +0 -0
  77. package/templates/backend/public/file.svg +4 -0
  78. package/templates/backend/public/globe.svg +12 -0
  79. package/templates/backend/public/next.svg +6 -0
  80. package/templates/backend/public/vercel.svg +3 -0
  81. package/templates/backend/public/window.svg +5 -0
  82. package/templates/backend/server.ts +129 -0
  83. package/templates/backend/setup-env.sh +50 -0
  84. package/templates/backend/src/common/assertions.ts +6 -0
  85. package/templates/backend/src/common/db.ts +1 -0
  86. package/templates/backend/src/common/loadPostgresEventstore.ts +16 -0
  87. package/templates/backend/src/common/parseEndpoint.ts +51 -0
  88. package/templates/backend/src/common/replay.ts +9 -0
  89. package/templates/backend/src/common/routes.ts +19 -0
  90. package/templates/backend/src/common/testHelpers.ts +53 -0
  91. package/templates/backend/src/core/readmodel.ts +28 -0
  92. package/templates/backend/src/core/types.ts +26 -0
  93. package/templates/backend/src/process/process.ts +53 -0
  94. package/templates/backend/src/supabase/LoginHandler.ts +36 -0
  95. package/templates/backend/src/supabase/ProtectedPageProps.ts +21 -0
  96. package/templates/backend/src/supabase/README.md +171 -0
  97. package/templates/backend/src/supabase/api.ts +63 -0
  98. package/templates/backend/src/supabase/authMiddleware.ts +53 -0
  99. package/templates/backend/src/supabase/component.ts +12 -0
  100. package/templates/backend/src/supabase/requireUser.ts +72 -0
  101. package/templates/backend/src/supabase/serverProps.ts +25 -0
  102. package/templates/backend/src/supabase/staticProps.ts +10 -0
  103. package/templates/backend/src/swagger.ts +34 -0
  104. package/templates/backend/src/util/assertions.ts +6 -0
  105. package/templates/backend/supabase/config.toml +295 -0
  106. package/templates/backend/supabase/migrations/20260121155918593_catalogentries.sql.sample +23 -0
  107. package/templates/backend/supabase/seed.sql +1 -0
  108. package/templates/backend/tsconfig.json +31 -0
  109. package/templates/frontend/.env.development +3 -0
  110. package/templates/frontend/AGENTS.md +7 -0
  111. package/templates/frontend/README.md +73 -0
  112. package/templates/frontend/components.json +20 -0
  113. package/templates/frontend/eslint.config.js +26 -0
  114. package/templates/frontend/index.html +18 -0
  115. package/templates/frontend/package-lock.json +8347 -0
  116. package/templates/frontend/package.json +94 -0
  117. package/templates/frontend/postcss.config.js +6 -0
  118. package/templates/frontend/public/favicon.ico +0 -0
  119. package/templates/frontend/public/logo.png +0 -0
  120. package/templates/frontend/public/placeholder.svg +1 -0
  121. package/templates/frontend/public/robots.txt +14 -0
  122. package/templates/frontend/src/App.css +42 -0
  123. package/templates/frontend/src/App.tsx +47 -0
  124. package/templates/frontend/src/components/NavLink.tsx +28 -0
  125. package/templates/frontend/src/components/ProtectedRoute.tsx +24 -0
  126. package/templates/frontend/src/components/calendar/Calendar.tsx +302 -0
  127. package/templates/frontend/src/components/layout/DashboardLayout.tsx +21 -0
  128. package/templates/frontend/src/components/layout/Header.tsx +45 -0
  129. package/templates/frontend/src/components/layout/Sidebar.tsx +82 -0
  130. package/templates/frontend/src/components/tables/ReservationTemplates.tsx +189 -0
  131. package/templates/frontend/src/components/ui/accordion.tsx +52 -0
  132. package/templates/frontend/src/components/ui/alert-dialog.tsx +104 -0
  133. package/templates/frontend/src/components/ui/alert.tsx +43 -0
  134. package/templates/frontend/src/components/ui/aspect-ratio.tsx +5 -0
  135. package/templates/frontend/src/components/ui/avatar.tsx +38 -0
  136. package/templates/frontend/src/components/ui/badge.tsx +29 -0
  137. package/templates/frontend/src/components/ui/breadcrumb.tsx +90 -0
  138. package/templates/frontend/src/components/ui/button.tsx +47 -0
  139. package/templates/frontend/src/components/ui/calendar.tsx +54 -0
  140. package/templates/frontend/src/components/ui/card.tsx +43 -0
  141. package/templates/frontend/src/components/ui/carousel.tsx +224 -0
  142. package/templates/frontend/src/components/ui/chart.tsx +303 -0
  143. package/templates/frontend/src/components/ui/checkbox.tsx +26 -0
  144. package/templates/frontend/src/components/ui/collapsible.tsx +9 -0
  145. package/templates/frontend/src/components/ui/command.tsx +132 -0
  146. package/templates/frontend/src/components/ui/context-menu.tsx +178 -0
  147. package/templates/frontend/src/components/ui/dialog.tsx +95 -0
  148. package/templates/frontend/src/components/ui/drawer.tsx +87 -0
  149. package/templates/frontend/src/components/ui/dropdown-menu.tsx +179 -0
  150. package/templates/frontend/src/components/ui/form.tsx +129 -0
  151. package/templates/frontend/src/components/ui/hover-card.tsx +27 -0
  152. package/templates/frontend/src/components/ui/input-otp.tsx +61 -0
  153. package/templates/frontend/src/components/ui/input.tsx +22 -0
  154. package/templates/frontend/src/components/ui/label.tsx +17 -0
  155. package/templates/frontend/src/components/ui/menubar.tsx +207 -0
  156. package/templates/frontend/src/components/ui/navigation-menu.tsx +120 -0
  157. package/templates/frontend/src/components/ui/pagination.tsx +81 -0
  158. package/templates/frontend/src/components/ui/popover.tsx +29 -0
  159. package/templates/frontend/src/components/ui/progress.tsx +23 -0
  160. package/templates/frontend/src/components/ui/radio-group.tsx +36 -0
  161. package/templates/frontend/src/components/ui/resizable.tsx +37 -0
  162. package/templates/frontend/src/components/ui/scroll-area.tsx +38 -0
  163. package/templates/frontend/src/components/ui/select.tsx +143 -0
  164. package/templates/frontend/src/components/ui/separator.tsx +20 -0
  165. package/templates/frontend/src/components/ui/sheet.tsx +107 -0
  166. package/templates/frontend/src/components/ui/sidebar.tsx +637 -0
  167. package/templates/frontend/src/components/ui/skeleton.tsx +7 -0
  168. package/templates/frontend/src/components/ui/slider.tsx +23 -0
  169. package/templates/frontend/src/components/ui/sonner.tsx +27 -0
  170. package/templates/frontend/src/components/ui/stat-card.tsx +44 -0
  171. package/templates/frontend/src/components/ui/switch.tsx +27 -0
  172. package/templates/frontend/src/components/ui/table.tsx +72 -0
  173. package/templates/frontend/src/components/ui/tabs.tsx +53 -0
  174. package/templates/frontend/src/components/ui/textarea.tsx +21 -0
  175. package/templates/frontend/src/components/ui/toast.tsx +111 -0
  176. package/templates/frontend/src/components/ui/toaster.tsx +24 -0
  177. package/templates/frontend/src/components/ui/toggle-group.tsx +49 -0
  178. package/templates/frontend/src/components/ui/toggle.tsx +37 -0
  179. package/templates/frontend/src/components/ui/tooltip.tsx +28 -0
  180. package/templates/frontend/src/components/ui/use-toast.ts +3 -0
  181. package/templates/frontend/src/contexts/AuthContext.tsx +94 -0
  182. package/templates/frontend/src/contexts/RefreshContext.tsx +236 -0
  183. package/templates/frontend/src/hooks/api/index.ts +2 -0
  184. package/templates/frontend/src/hooks/api/useLocations.ts +15 -0
  185. package/templates/frontend/src/hooks/use-mobile.tsx +19 -0
  186. package/templates/frontend/src/hooks/use-toast.ts +186 -0
  187. package/templates/frontend/src/hooks/useApiContext.ts +11 -0
  188. package/templates/frontend/src/index.css +118 -0
  189. package/templates/frontend/src/integrations/supabase/client.ts +9 -0
  190. package/templates/frontend/src/lib/api-client.ts +136 -0
  191. package/templates/frontend/src/lib/api.ts +1028 -0
  192. package/templates/frontend/src/lib/utils.ts +6 -0
  193. package/templates/frontend/src/main.tsx +5 -0
  194. package/templates/frontend/src/pages/Auth.tsx +408 -0
  195. package/templates/frontend/src/pages/Dashboard.tsx +168 -0
  196. package/templates/frontend/src/pages/Menus.tsx +224 -0
  197. package/templates/frontend/src/pages/NotFound.tsx +24 -0
  198. package/templates/frontend/src/pages/Register.tsx +285 -0
  199. package/templates/frontend/src/test/example.test.ts +0 -0
  200. package/templates/frontend/src/test/setup.ts +15 -0
  201. package/templates/frontend/src/types/index.ts +8 -0
  202. package/templates/frontend/src/vite-env.d.ts +1 -0
  203. package/templates/frontend/tailwind.config.ts +101 -0
  204. package/templates/frontend/tsconfig.app.json +31 -0
  205. package/templates/frontend/tsconfig.json +16 -0
  206. package/templates/frontend/tsconfig.node.json +22 -0
  207. package/templates/frontend/vite.config.ts +21 -0
  208. package/templates/frontend/vitest.config.ts +16 -0
  209. package/templates/init.sh +1 -0
  210. package/templates/prompt.md +139 -0
  211. package/templates/ralph.sh +120 -0
  212. package/templates/server.mjs +505 -0
@@ -0,0 +1,82 @@
1
+ import { NavLink, useLocation } from "react-router-dom";
2
+ import {
3
+ Users,
4
+ Calendar,
5
+ ClipboardList,
6
+ LayoutDashboard,
7
+ Settings,
8
+ FileText,
9
+ TreePalm,
10
+ Layers,
11
+ } from "lucide-react";
12
+ import { cn } from "@/lib/utils";
13
+
14
+ const navigation = [
15
+ { name: "Overview", href: "/", icon: LayoutDashboard },
16
+ { name: "Items", href: "/tables", icon: Layers },
17
+ { name: "Staff", href: "/staff", icon: Users },
18
+ { name: "Shifts", href: "/shifts", icon: Calendar },
19
+ { name: "Tasks", href: "/tasks", icon: ClipboardList },
20
+ { name: "Documents", href: "/menus", icon: FileText },
21
+ { name: "Vacations", href: "/vacations", icon: TreePalm },
22
+ ];
23
+
24
+ export function Sidebar() {
25
+ const location = useLocation();
26
+
27
+ return (
28
+ <aside className="fixed inset-y-0 left-0 z-50 flex h-full w-64 flex-col bg-sidebar">
29
+ {/* Logo */}
30
+ <div className="flex h-16 items-center gap-3 border-b border-sidebar-border px-6">
31
+ <div className="flex h-9 w-9 items-center justify-center rounded-lg bg-primary">
32
+ <LayoutDashboard className="h-5 w-5 text-primary-foreground" />
33
+ </div>
34
+ <span className="text-lg font-semibold text-sidebar-foreground">
35
+ App
36
+ </span>
37
+ </div>
38
+
39
+ {/* Navigation */}
40
+ <nav className="flex-1 space-y-1 px-3 py-4">
41
+ {navigation.map((item) => {
42
+ const isActive =
43
+ item.href === "/"
44
+ ? location.pathname === "/"
45
+ : location.pathname.startsWith(item.href);
46
+
47
+ return (
48
+ <NavLink
49
+ key={item.name}
50
+ to={item.href}
51
+ className={cn(
52
+ "flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-colors",
53
+ isActive
54
+ ? "bg-sidebar-accent text-sidebar-primary"
55
+ : "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground"
56
+ )}
57
+ >
58
+ <item.icon className="h-5 w-5" />
59
+ {item.name}
60
+ </NavLink>
61
+ );
62
+ })}
63
+ </nav>
64
+
65
+ {/* Settings */}
66
+ <div className="border-t border-sidebar-border p-3">
67
+ <NavLink
68
+ to="/settings"
69
+ className={cn(
70
+ "flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-colors",
71
+ location.pathname === "/settings"
72
+ ? "bg-sidebar-accent text-sidebar-primary"
73
+ : "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground"
74
+ )}
75
+ >
76
+ <Settings className="h-5 w-5" />
77
+ Settings
78
+ </NavLink>
79
+ </div>
80
+ </aside>
81
+ );
82
+ }
@@ -0,0 +1,189 @@
1
+ import { useRef, useState, useEffect } from "react";
2
+ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3
+ import { Button } from "@/components/ui/button";
4
+ import { Textarea } from "@/components/ui/textarea";
5
+ import { Label } from "@/components/ui/label";
6
+ import { Loader2, Mail, Phone } from "lucide-react";
7
+ import { toast } from "sonner";
8
+ import { useReservationTemplates, useSaveReservationTemplate } from "@/hooks/api/useReservationTemplates";
9
+ import { Skeleton } from "@/components/ui/skeleton";
10
+
11
+ const TEMPLATE_VARIABLES = [
12
+ { key: "name", label: "Name" },
13
+ { key: "from", label: "From" },
14
+ { key: "to", label: "To" },
15
+ { key: "persons", label: "Persons" },
16
+ { key: "location", label: "Location" },
17
+ ];
18
+
19
+ export function ReservationTemplates() {
20
+ const { data: templates = [], isLoading } = useReservationTemplates();
21
+ const saveMutation = useSaveReservationTemplate();
22
+
23
+ const [emailTemplate, setEmailTemplate] = useState("");
24
+ const [phoneTemplate, setPhoneTemplate] = useState("");
25
+ const [focusedField, setFocusedField] = useState<"email" | "phone" | null>(null);
26
+
27
+ const emailRef = useRef<HTMLTextAreaElement>(null);
28
+ const phoneRef = useRef<HTMLTextAreaElement>(null);
29
+
30
+ // Load templates when data is fetched
31
+ useEffect(() => {
32
+ const emailTpl = templates.find(t => t.templateType === "EMAIL");
33
+ const phoneTpl = templates.find(t => t.templateType === "PHONE");
34
+
35
+ if (emailTpl) setEmailTemplate(emailTpl.template);
36
+ if (phoneTpl) setPhoneTemplate(phoneTpl.template);
37
+ }, [templates]);
38
+
39
+ const insertVariable = (variable: string) => {
40
+ const insertion = `{${variable}}`;
41
+
42
+ if (focusedField === "email" && emailRef.current) {
43
+ const textarea = emailRef.current;
44
+ const start = textarea.selectionStart;
45
+ const end = textarea.selectionEnd;
46
+ const newValue = emailTemplate.slice(0, start) + insertion + emailTemplate.slice(end);
47
+ setEmailTemplate(newValue);
48
+
49
+ // Restore cursor position after insertion
50
+ setTimeout(() => {
51
+ textarea.focus();
52
+ textarea.setSelectionRange(start + insertion.length, start + insertion.length);
53
+ }, 0);
54
+ } else if (focusedField === "phone" && phoneRef.current) {
55
+ const textarea = phoneRef.current;
56
+ const start = textarea.selectionStart;
57
+ const end = textarea.selectionEnd;
58
+ const newValue = phoneTemplate.slice(0, start) + insertion + phoneTemplate.slice(end);
59
+ setPhoneTemplate(newValue);
60
+
61
+ setTimeout(() => {
62
+ textarea.focus();
63
+ textarea.setSelectionRange(start + insertion.length, start + insertion.length);
64
+ }, 0);
65
+ } else {
66
+ toast.error("Please select a text field first");
67
+ }
68
+ };
69
+
70
+ const handleSaveEmail = async () => {
71
+ const existingTemplate = templates.find(t => t.templateType === "EMAIL");
72
+ const templateId = existingTemplate?.templateId || `tpl-email-${Date.now()}`;
73
+
74
+ try {
75
+ await saveMutation.mutateAsync({
76
+ templateId,
77
+ templateType: "EMAIL",
78
+ template: emailTemplate,
79
+ });
80
+ toast.success("Email template saved");
81
+ } catch (err) {
82
+ toast.error(`Error: ${err instanceof Error ? err.message : "Unknown error"}`);
83
+ }
84
+ };
85
+
86
+ const handleSavePhone = async () => {
87
+ const existingTemplate = templates.find(t => t.templateType === "PHONE");
88
+ const templateId = existingTemplate?.templateId || `tpl-phone-${Date.now()}`;
89
+
90
+ try {
91
+ await saveMutation.mutateAsync({
92
+ templateId,
93
+ templateType: "PHONE",
94
+ template: phoneTemplate,
95
+ });
96
+ toast.success("SMS template saved");
97
+ } catch (err) {
98
+ toast.error(`Error: ${err instanceof Error ? err.message : "Unknown error"}`);
99
+ }
100
+ };
101
+
102
+ if (isLoading) {
103
+ return (
104
+ <Card>
105
+ <CardHeader>
106
+ <Skeleton className="h-6 w-48" />
107
+ </CardHeader>
108
+ <CardContent className="space-y-4">
109
+ <Skeleton className="h-32 w-full" />
110
+ </CardContent>
111
+ </Card>
112
+ );
113
+ }
114
+
115
+ return (
116
+ <Card>
117
+ <CardHeader>
118
+ <CardTitle>Notification Templates</CardTitle>
119
+ </CardHeader>
120
+ <CardContent className="space-y-6">
121
+ {/* Variable buttons */}
122
+ <div className="flex flex-wrap gap-2">
123
+ {TEMPLATE_VARIABLES.map((variable) => (
124
+ <Button
125
+ key={variable.key}
126
+ variant="outline"
127
+ size="sm"
128
+ onClick={() => insertVariable(variable.key)}
129
+ className="text-xs"
130
+ >
131
+ {variable.label}
132
+ </Button>
133
+ ))}
134
+ </div>
135
+
136
+ {/* Templates grid */}
137
+ <div className="grid gap-6 md:grid-cols-2">
138
+ {/* Email template */}
139
+ <div className="space-y-3">
140
+ <div className="flex items-center gap-2">
141
+ <Mail className="h-4 w-4 text-muted-foreground" />
142
+ <Label>Email</Label>
143
+ </div>
144
+ <Textarea
145
+ ref={emailRef}
146
+ value={emailTemplate}
147
+ onChange={(e) => setEmailTemplate(e.target.value)}
148
+ onFocus={() => setFocusedField("email")}
149
+ placeholder="Enter email template..."
150
+ className="min-h-[150px] resize-none"
151
+ />
152
+ <Button
153
+ onClick={handleSaveEmail}
154
+ disabled={saveMutation.isPending}
155
+ className="w-full"
156
+ >
157
+ {saveMutation.isPending && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
158
+ Save
159
+ </Button>
160
+ </div>
161
+
162
+ {/* Phone/SMS template */}
163
+ <div className="space-y-3">
164
+ <div className="flex items-center gap-2">
165
+ <Phone className="h-4 w-4 text-muted-foreground" />
166
+ <Label>SMS</Label>
167
+ </div>
168
+ <Textarea
169
+ ref={phoneRef}
170
+ value={phoneTemplate}
171
+ onChange={(e) => setPhoneTemplate(e.target.value)}
172
+ onFocus={() => setFocusedField("phone")}
173
+ placeholder="Enter SMS template..."
174
+ className="min-h-[150px] resize-none"
175
+ />
176
+ <Button
177
+ onClick={handleSavePhone}
178
+ disabled={saveMutation.isPending}
179
+ className="w-full"
180
+ >
181
+ {saveMutation.isPending && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
182
+ Save
183
+ </Button>
184
+ </div>
185
+ </div>
186
+ </CardContent>
187
+ </Card>
188
+ );
189
+ }
@@ -0,0 +1,52 @@
1
+ import * as React from "react";
2
+ import * as AccordionPrimitive from "@radix-ui/react-accordion";
3
+ import { ChevronDown } from "lucide-react";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ const Accordion = AccordionPrimitive.Root;
8
+
9
+ const AccordionItem = React.forwardRef<
10
+ React.ElementRef<typeof AccordionPrimitive.Item>,
11
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
12
+ >(({ className, ...props }, ref) => (
13
+ <AccordionPrimitive.Item ref={ref} className={cn("border-b", className)} {...props} />
14
+ ));
15
+ AccordionItem.displayName = "AccordionItem";
16
+
17
+ const AccordionTrigger = React.forwardRef<
18
+ React.ElementRef<typeof AccordionPrimitive.Trigger>,
19
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
20
+ >(({ className, children, ...props }, ref) => (
21
+ <AccordionPrimitive.Header className="flex">
22
+ <AccordionPrimitive.Trigger
23
+ ref={ref}
24
+ className={cn(
25
+ "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
26
+ className,
27
+ )}
28
+ {...props}
29
+ >
30
+ {children}
31
+ <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
32
+ </AccordionPrimitive.Trigger>
33
+ </AccordionPrimitive.Header>
34
+ ));
35
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
36
+
37
+ const AccordionContent = React.forwardRef<
38
+ React.ElementRef<typeof AccordionPrimitive.Content>,
39
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
40
+ >(({ className, children, ...props }, ref) => (
41
+ <AccordionPrimitive.Content
42
+ ref={ref}
43
+ className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
44
+ {...props}
45
+ >
46
+ <div className={cn("pb-4 pt-0", className)}>{children}</div>
47
+ </AccordionPrimitive.Content>
48
+ ));
49
+
50
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName;
51
+
52
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
@@ -0,0 +1,104 @@
1
+ import * as React from "react";
2
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
3
+
4
+ import { cn } from "@/lib/utils";
5
+ import { buttonVariants } from "@/components/ui/button";
6
+
7
+ const AlertDialog = AlertDialogPrimitive.Root;
8
+
9
+ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
10
+
11
+ const AlertDialogPortal = AlertDialogPrimitive.Portal;
12
+
13
+ const AlertDialogOverlay = React.forwardRef<
14
+ React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
15
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
16
+ >(({ className, ...props }, ref) => (
17
+ <AlertDialogPrimitive.Overlay
18
+ className={cn(
19
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
20
+ className,
21
+ )}
22
+ {...props}
23
+ ref={ref}
24
+ />
25
+ ));
26
+ AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
27
+
28
+ const AlertDialogContent = React.forwardRef<
29
+ React.ElementRef<typeof AlertDialogPrimitive.Content>,
30
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
31
+ >(({ className, ...props }, ref) => (
32
+ <AlertDialogPortal>
33
+ <AlertDialogOverlay />
34
+ <AlertDialogPrimitive.Content
35
+ ref={ref}
36
+ className={cn(
37
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
38
+ className,
39
+ )}
40
+ {...props}
41
+ />
42
+ </AlertDialogPortal>
43
+ ));
44
+ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
45
+
46
+ const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
47
+ <div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
48
+ );
49
+ AlertDialogHeader.displayName = "AlertDialogHeader";
50
+
51
+ const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
52
+ <div className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)} {...props} />
53
+ );
54
+ AlertDialogFooter.displayName = "AlertDialogFooter";
55
+
56
+ const AlertDialogTitle = React.forwardRef<
57
+ React.ElementRef<typeof AlertDialogPrimitive.Title>,
58
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
59
+ >(({ className, ...props }, ref) => (
60
+ <AlertDialogPrimitive.Title ref={ref} className={cn("text-lg font-semibold", className)} {...props} />
61
+ ));
62
+ AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
63
+
64
+ const AlertDialogDescription = React.forwardRef<
65
+ React.ElementRef<typeof AlertDialogPrimitive.Description>,
66
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
67
+ >(({ className, ...props }, ref) => (
68
+ <AlertDialogPrimitive.Description ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
69
+ ));
70
+ AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
71
+
72
+ const AlertDialogAction = React.forwardRef<
73
+ React.ElementRef<typeof AlertDialogPrimitive.Action>,
74
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
75
+ >(({ className, ...props }, ref) => (
76
+ <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
77
+ ));
78
+ AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
79
+
80
+ const AlertDialogCancel = React.forwardRef<
81
+ React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
82
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
83
+ >(({ className, ...props }, ref) => (
84
+ <AlertDialogPrimitive.Cancel
85
+ ref={ref}
86
+ className={cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className)}
87
+ {...props}
88
+ />
89
+ ));
90
+ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
91
+
92
+ export {
93
+ AlertDialog,
94
+ AlertDialogPortal,
95
+ AlertDialogOverlay,
96
+ AlertDialogTrigger,
97
+ AlertDialogContent,
98
+ AlertDialogHeader,
99
+ AlertDialogFooter,
100
+ AlertDialogTitle,
101
+ AlertDialogDescription,
102
+ AlertDialogAction,
103
+ AlertDialogCancel,
104
+ };
@@ -0,0 +1,43 @@
1
+ import * as React from "react";
2
+ import { cva, type VariantProps } from "class-variance-authority";
3
+
4
+ import { cn } from "@/lib/utils";
5
+
6
+ const alertVariants = cva(
7
+ "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-background text-foreground",
12
+ destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
13
+ },
14
+ },
15
+ defaultVariants: {
16
+ variant: "default",
17
+ },
18
+ },
19
+ );
20
+
21
+ const Alert = React.forwardRef<
22
+ HTMLDivElement,
23
+ React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
24
+ >(({ className, variant, ...props }, ref) => (
25
+ <div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
26
+ ));
27
+ Alert.displayName = "Alert";
28
+
29
+ const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
30
+ ({ className, ...props }, ref) => (
31
+ <h5 ref={ref} className={cn("mb-1 font-medium leading-none tracking-tight", className)} {...props} />
32
+ ),
33
+ );
34
+ AlertTitle.displayName = "AlertTitle";
35
+
36
+ const AlertDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
37
+ ({ className, ...props }, ref) => (
38
+ <div ref={ref} className={cn("text-sm [&_p]:leading-relaxed", className)} {...props} />
39
+ ),
40
+ );
41
+ AlertDescription.displayName = "AlertDescription";
42
+
43
+ export { Alert, AlertTitle, AlertDescription };
@@ -0,0 +1,5 @@
1
+ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
2
+
3
+ const AspectRatio = AspectRatioPrimitive.Root;
4
+
5
+ export { AspectRatio };
@@ -0,0 +1,38 @@
1
+ import * as React from "react";
2
+ import * as AvatarPrimitive from "@radix-ui/react-avatar";
3
+
4
+ import { cn } from "@/lib/utils";
5
+
6
+ const Avatar = React.forwardRef<
7
+ React.ElementRef<typeof AvatarPrimitive.Root>,
8
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
9
+ >(({ className, ...props }, ref) => (
10
+ <AvatarPrimitive.Root
11
+ ref={ref}
12
+ className={cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className)}
13
+ {...props}
14
+ />
15
+ ));
16
+ Avatar.displayName = AvatarPrimitive.Root.displayName;
17
+
18
+ const AvatarImage = React.forwardRef<
19
+ React.ElementRef<typeof AvatarPrimitive.Image>,
20
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
21
+ >(({ className, ...props }, ref) => (
22
+ <AvatarPrimitive.Image ref={ref} className={cn("aspect-square h-full w-full", className)} {...props} />
23
+ ));
24
+ AvatarImage.displayName = AvatarPrimitive.Image.displayName;
25
+
26
+ const AvatarFallback = React.forwardRef<
27
+ React.ElementRef<typeof AvatarPrimitive.Fallback>,
28
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
29
+ >(({ className, ...props }, ref) => (
30
+ <AvatarPrimitive.Fallback
31
+ ref={ref}
32
+ className={cn("flex h-full w-full items-center justify-center rounded-full bg-muted", className)}
33
+ {...props}
34
+ />
35
+ ));
36
+ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
37
+
38
+ export { Avatar, AvatarImage, AvatarFallback };
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ import { cva, type VariantProps } from "class-variance-authority";
3
+
4
+ import { cn } from "@/lib/utils";
5
+
6
+ const badgeVariants = cva(
7
+ "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
12
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
13
+ destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
14
+ outline: "text-foreground",
15
+ },
16
+ },
17
+ defaultVariants: {
18
+ variant: "default",
19
+ },
20
+ },
21
+ );
22
+
23
+ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
24
+
25
+ function Badge({ className, variant, ...props }: BadgeProps) {
26
+ return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
27
+ }
28
+
29
+ export { Badge, badgeVariants };
@@ -0,0 +1,90 @@
1
+ import * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { ChevronRight, MoreHorizontal } from "lucide-react";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ const Breadcrumb = React.forwardRef<
8
+ HTMLElement,
9
+ React.ComponentPropsWithoutRef<"nav"> & {
10
+ separator?: React.ReactNode;
11
+ }
12
+ >(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />);
13
+ Breadcrumb.displayName = "Breadcrumb";
14
+
15
+ const BreadcrumbList = React.forwardRef<HTMLOListElement, React.ComponentPropsWithoutRef<"ol">>(
16
+ ({ className, ...props }, ref) => (
17
+ <ol
18
+ ref={ref}
19
+ className={cn(
20
+ "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
21
+ className,
22
+ )}
23
+ {...props}
24
+ />
25
+ ),
26
+ );
27
+ BreadcrumbList.displayName = "BreadcrumbList";
28
+
29
+ const BreadcrumbItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<"li">>(
30
+ ({ className, ...props }, ref) => (
31
+ <li ref={ref} className={cn("inline-flex items-center gap-1.5", className)} {...props} />
32
+ ),
33
+ );
34
+ BreadcrumbItem.displayName = "BreadcrumbItem";
35
+
36
+ const BreadcrumbLink = React.forwardRef<
37
+ HTMLAnchorElement,
38
+ React.ComponentPropsWithoutRef<"a"> & {
39
+ asChild?: boolean;
40
+ }
41
+ >(({ asChild, className, ...props }, ref) => {
42
+ const Comp = asChild ? Slot : "a";
43
+
44
+ return <Comp ref={ref} className={cn("transition-colors hover:text-foreground", className)} {...props} />;
45
+ });
46
+ BreadcrumbLink.displayName = "BreadcrumbLink";
47
+
48
+ const BreadcrumbPage = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<"span">>(
49
+ ({ className, ...props }, ref) => (
50
+ <span
51
+ ref={ref}
52
+ role="link"
53
+ aria-disabled="true"
54
+ aria-current="page"
55
+ className={cn("font-normal text-foreground", className)}
56
+ {...props}
57
+ />
58
+ ),
59
+ );
60
+ BreadcrumbPage.displayName = "BreadcrumbPage";
61
+
62
+ const BreadcrumbSeparator = ({ children, className, ...props }: React.ComponentProps<"li">) => (
63
+ <li role="presentation" aria-hidden="true" className={cn("[&>svg]:size-3.5", className)} {...props}>
64
+ {children ?? <ChevronRight />}
65
+ </li>
66
+ );
67
+ BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
68
+
69
+ const BreadcrumbEllipsis = ({ className, ...props }: React.ComponentProps<"span">) => (
70
+ <span
71
+ role="presentation"
72
+ aria-hidden="true"
73
+ className={cn("flex h-9 w-9 items-center justify-center", className)}
74
+ {...props}
75
+ >
76
+ <MoreHorizontal className="h-4 w-4" />
77
+ <span className="sr-only">More</span>
78
+ </span>
79
+ );
80
+ BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
81
+
82
+ export {
83
+ Breadcrumb,
84
+ BreadcrumbList,
85
+ BreadcrumbItem,
86
+ BreadcrumbLink,
87
+ BreadcrumbPage,
88
+ BreadcrumbSeparator,
89
+ BreadcrumbEllipsis,
90
+ };
@@ -0,0 +1,47 @@
1
+ import * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cva, type VariantProps } from "class-variance-authority";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ const buttonVariants = cva(
8
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
13
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
14
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
15
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
16
+ ghost: "hover:bg-accent hover:text-accent-foreground",
17
+ link: "text-primary underline-offset-4 hover:underline",
18
+ },
19
+ size: {
20
+ default: "h-10 px-4 py-2",
21
+ sm: "h-9 rounded-md px-3",
22
+ lg: "h-11 rounded-md px-8",
23
+ icon: "h-10 w-10",
24
+ },
25
+ },
26
+ defaultVariants: {
27
+ variant: "default",
28
+ size: "default",
29
+ },
30
+ },
31
+ );
32
+
33
+ export interface ButtonProps
34
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
35
+ VariantProps<typeof buttonVariants> {
36
+ asChild?: boolean;
37
+ }
38
+
39
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
40
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
41
+ const Comp = asChild ? Slot : "button";
42
+ return <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />;
43
+ },
44
+ );
45
+ Button.displayName = "Button";
46
+
47
+ export { Button, buttonVariants };