@tscircuit/fake-snippets 0.0.102 → 0.0.104

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.
@@ -1,343 +0,0 @@
1
- import { useEffect, useState } from "react"
2
- import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
3
- import { Button } from "@/components/ui/button"
4
- import { Input } from "@/components/ui/input"
5
- import { Label } from "@/components/ui/label"
6
- import { Switch } from "@/components/ui/switch"
7
- import { Textarea } from "@/components/ui/textarea"
8
- import {
9
- AlertDialog,
10
- AlertDialogAction,
11
- AlertDialogCancel,
12
- AlertDialogContent,
13
- AlertDialogDescription,
14
- AlertDialogFooter,
15
- AlertDialogHeader,
16
- AlertDialogTitle,
17
- AlertDialogTrigger,
18
- } from "@/components/ui/alert-dialog"
19
- import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
20
- import { Settings, Github, Shield, Trash2, Save } from "lucide-react"
21
-
22
- interface ConnectedRepoSettingsProps {
23
- projectName?: string
24
- onSave?: (settings: any) => void
25
- }
26
-
27
- export const ConnectedRepoSettings = ({
28
- projectName = "tscircuit-project",
29
- onSave,
30
- }: ConnectedRepoSettingsProps) => {
31
- // MOCK
32
- const initialSettings = {
33
- general: {
34
- projectName: projectName,
35
- description: "A TypeScript circuit design project",
36
- },
37
- git: {
38
- repository: "github.com/user/tscircuit-project",
39
- productionBranch: "main",
40
- autoBuildEnabled: true,
41
- prComment: true,
42
- buildPrs: true,
43
- },
44
- security: {
45
- privateBuilds: false,
46
- requireApprovalForPrs: true,
47
- },
48
- }
49
-
50
- const [settings, setSettings] = useState(initialSettings)
51
- const [hasChanges, setHasChanges] = useState(false)
52
-
53
- // Track changes
54
- useEffect(() => {
55
- const isChanged =
56
- JSON.stringify(settings) !== JSON.stringify(initialSettings)
57
- setHasChanges(isChanged)
58
- }, [settings])
59
-
60
- const handleSave = () => {
61
- onSave?.(settings)
62
- setHasChanges(false)
63
- }
64
-
65
- return (
66
- <div className="space-y-4 sm:space-y-6 p-4 sm:p-6">
67
- <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
68
- <div>
69
- <h2 className="text-xl sm:text-2xl font-bold text-gray-900">
70
- Settings
71
- </h2>
72
- <p className="text-sm sm:text-base text-gray-600">
73
- Configure your build settings
74
- </p>
75
- </div>
76
- <div className="flex justify-end">
77
- <Button
78
- onClick={handleSave}
79
- disabled={!hasChanges}
80
- className="flex items-center gap-2 w-full sm:w-auto"
81
- >
82
- <Save className="w-4 h-4" />
83
- Save Changes
84
- </Button>
85
- </div>
86
- </div>
87
-
88
- <Tabs defaultValue="general" className="space-y-4 sm:space-y-6">
89
- <TabsList className="grid w-full grid-cols-3">
90
- <TabsTrigger
91
- value="general"
92
- className="flex items-center gap-1 sm:gap-2 text-xs sm:text-sm"
93
- >
94
- <Settings className="w-3 h-3 sm:w-4 sm:h-4" />
95
- <span className="hidden sm:inline">General</span>
96
- <span className="sm:hidden">Gen</span>
97
- </TabsTrigger>
98
- <TabsTrigger
99
- value="git"
100
- className="flex items-center gap-1 sm:gap-2 text-xs sm:text-sm"
101
- >
102
- <Github className="w-3 h-3 sm:w-4 sm:h-4" />
103
- Git
104
- </TabsTrigger>
105
- <TabsTrigger
106
- value="security"
107
- className="flex items-center gap-1 sm:gap-2 text-xs sm:text-sm"
108
- >
109
- <Shield className="w-3 h-3 sm:w-4 sm:h-4" />
110
- <span className="hidden sm:inline">Security</span>
111
- <span className="sm:hidden">Sec</span>
112
- </TabsTrigger>
113
- </TabsList>
114
-
115
- <TabsContent value="general" className="space-y-4 sm:space-y-6">
116
- <Card>
117
- <CardHeader>
118
- <CardTitle className="text-lg sm:text-xl">
119
- General Settings
120
- </CardTitle>
121
- </CardHeader>
122
- <CardContent className="space-y-4 p-4 sm:p-6">
123
- <div className="space-y-2">
124
- <Label htmlFor="projectName">Project Name</Label>
125
- <Input
126
- id="projectName"
127
- value={settings.general.projectName}
128
- onChange={(e) =>
129
- setSettings((prev) => ({
130
- ...prev,
131
- general: { ...prev.general, projectName: e.target.value },
132
- }))
133
- }
134
- />
135
- </div>
136
-
137
- <div className="space-y-2">
138
- <Label htmlFor="description">Description</Label>
139
- <Textarea
140
- id="description"
141
- value={settings.general.description}
142
- onChange={(e) =>
143
- setSettings((prev) => ({
144
- ...prev,
145
- general: { ...prev.general, description: e.target.value },
146
- }))
147
- }
148
- rows={3}
149
- />
150
- </div>
151
- </CardContent>
152
- </Card>
153
- </TabsContent>
154
-
155
- <TabsContent value="git" className="space-y-4 sm:space-y-6">
156
- <Card>
157
- <CardHeader>
158
- <CardTitle className="text-lg sm:text-xl">
159
- Git Integration
160
- </CardTitle>
161
- </CardHeader>
162
- <CardContent className="space-y-4 p-4 sm:p-6">
163
- <div className="space-y-2">
164
- <Label htmlFor="repository">Repository</Label>
165
- <Input
166
- id="repository"
167
- value={settings.git.repository}
168
- onChange={(e) =>
169
- setSettings((prev) => ({
170
- ...prev,
171
- git: { ...prev.git, repository: e.target.value },
172
- }))
173
- }
174
- placeholder="github.com/user/repo"
175
- />
176
- </div>
177
-
178
- <div className="space-y-2">
179
- <Label htmlFor="productionBranch">Production Branch</Label>
180
- <Input
181
- id="productionBranch"
182
- value={settings.git.productionBranch}
183
- onChange={(e) =>
184
- setSettings((prev) => ({
185
- ...prev,
186
- git: { ...prev.git, productionBranch: e.target.value },
187
- }))
188
- }
189
- />
190
- </div>
191
-
192
- <div className="space-y-3">
193
- <div className="flex items-center space-x-2">
194
- <Switch
195
- id="autoBuildEnabled"
196
- checked={settings.git.autoBuildEnabled}
197
- onCheckedChange={(checked) =>
198
- setSettings((prev) => ({
199
- ...prev,
200
- git: { ...prev.git, autoBuildEnabled: checked },
201
- }))
202
- }
203
- />
204
- <Label htmlFor="autoBuildEnabled">
205
- Enable automatic builds
206
- </Label>
207
- </div>
208
-
209
- <div className="flex items-center space-x-2">
210
- <Switch
211
- id="prComment"
212
- checked={settings.git.prComment}
213
- onCheckedChange={(checked) =>
214
- setSettings((prev) => ({
215
- ...prev,
216
- git: { ...prev.git, prComment: checked },
217
- }))
218
- }
219
- />
220
- <Label htmlFor="prComment">
221
- Comment on pull requests with build preview
222
- </Label>
223
- </div>
224
-
225
- <div className="flex items-center space-x-2">
226
- <Switch
227
- id="buildPrs"
228
- checked={settings.git.buildPrs}
229
- onCheckedChange={(checked) =>
230
- setSettings((prev) => ({
231
- ...prev,
232
- git: { ...prev.git, buildPrs: checked },
233
- }))
234
- }
235
- />
236
- <Label htmlFor="buildPrs">
237
- Build pull requests automatically
238
- </Label>
239
- </div>
240
- </div>
241
- </CardContent>
242
- </Card>
243
- </TabsContent>
244
-
245
- <TabsContent value="security" className="space-y-4 sm:space-y-6">
246
- <Card>
247
- <CardHeader>
248
- <CardTitle className="text-lg sm:text-xl">
249
- Security Settings
250
- </CardTitle>
251
- </CardHeader>
252
- <CardContent className="space-y-4 p-4 sm:p-6">
253
- <div className="space-y-3">
254
- <div className="flex items-center space-x-2">
255
- <Switch
256
- id="privateBuilds"
257
- checked={settings.security.privateBuilds}
258
- onCheckedChange={(checked) =>
259
- setSettings((prev) => ({
260
- ...prev,
261
- security: {
262
- ...prev.security,
263
- privateBuilds: checked,
264
- },
265
- }))
266
- }
267
- />
268
- <Label htmlFor="privateBuilds">Make builds private</Label>
269
- </div>
270
-
271
- <div className="flex items-center space-x-2">
272
- <Switch
273
- id="requireApprovalForPrs"
274
- checked={settings.security.requireApprovalForPrs}
275
- onCheckedChange={(checked) =>
276
- setSettings((prev) => ({
277
- ...prev,
278
- security: {
279
- ...prev.security,
280
- requireApprovalForPrs: checked,
281
- },
282
- }))
283
- }
284
- />
285
- <Label htmlFor="requireApprovalForPrs">
286
- Require approval for PR builds
287
- </Label>
288
- </div>
289
- </div>
290
- </CardContent>
291
- </Card>
292
-
293
- <Card className="border-red-200">
294
- <CardHeader>
295
- <CardTitle className="text-red-600 text-lg sm:text-xl">
296
- Danger Zone
297
- </CardTitle>
298
- </CardHeader>
299
- <CardContent className="p-4 sm:p-6">
300
- <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4 p-4 border border-red-200 rounded-lg">
301
- <div>
302
- <h4 className="font-medium text-red-600">Delete Project</h4>
303
- <p className="text-sm text-gray-600">
304
- Permanently delete this project and all its builds
305
- </p>
306
- </div>
307
- <AlertDialog>
308
- <AlertDialogTrigger asChild>
309
- <Button
310
- variant="destructive"
311
- className="flex items-center gap-2 w-full sm:w-auto"
312
- >
313
- <Trash2 className="w-4 h-4" />
314
- Delete Project
315
- </Button>
316
- </AlertDialogTrigger>
317
- <AlertDialogContent>
318
- <AlertDialogHeader>
319
- <AlertDialogTitle>
320
- Are you absolutely sure?
321
- </AlertDialogTitle>
322
- <AlertDialogDescription>
323
- This action cannot be undone. This will permanently
324
- delete the project and remove all build data from our
325
- servers.
326
- </AlertDialogDescription>
327
- </AlertDialogHeader>
328
- <AlertDialogFooter>
329
- <AlertDialogCancel>Cancel</AlertDialogCancel>
330
- <AlertDialogAction className="bg-red-600 hover:bg-red-700">
331
- Delete Project
332
- </AlertDialogAction>
333
- </AlertDialogFooter>
334
- </AlertDialogContent>
335
- </AlertDialog>
336
- </div>
337
- </CardContent>
338
- </Card>
339
- </TabsContent>
340
- </Tabs>
341
- </div>
342
- )
343
- }