@tscircuit/fake-snippets 0.0.100 → 0.0.102
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/api/generated-index.js +23 -1
- package/bun.lock +2 -2
- package/dist/bundle.js +620 -412
- package/dist/index.d.ts +33 -4
- package/dist/index.js +43 -1
- package/dist/schema.d.ts +94 -1
- package/dist/schema.js +17 -1
- package/fake-snippets-api/lib/db/db-client.ts +38 -1
- package/fake-snippets-api/lib/db/schema.ts +15 -0
- package/fake-snippets-api/lib/public-mapping/public-map-package.ts +2 -0
- package/fake-snippets-api/routes/api/accounts/search.ts +20 -0
- package/fake-snippets-api/routes/api/github/installations/create_new_installation_redirect.ts +75 -0
- package/fake-snippets-api/routes/api/github/repos/list_available.ts +91 -0
- package/fake-snippets-api/routes/api/packages/update.ts +4 -0
- package/package.json +2 -2
- package/src/App.tsx +10 -1
- package/src/components/CmdKMenu.tsx +154 -19
- package/src/components/CreateReleaseDialog.tsx +124 -0
- package/src/components/FileSidebar.tsx +128 -23
- package/src/components/Header2.tsx +106 -25
- package/src/components/PackageBuildsPage/package-build-header.tsx +28 -16
- package/src/components/PageSearchComponent.tsx +2 -2
- package/src/components/SearchComponent.tsx +2 -2
- package/src/components/SuspenseRunFrame.tsx +2 -2
- package/src/components/TrendingPackagesCarousel.tsx +2 -2
- package/src/components/ViewPackagePage/components/important-files-view.tsx +18 -13
- package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +1 -0
- package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +1 -0
- package/src/components/dialogs/GitHubRepositorySelector.tsx +123 -0
- package/src/components/dialogs/create-use-dialog.tsx +8 -2
- package/src/components/dialogs/edit-package-details-dialog.tsx +22 -3
- package/src/components/dialogs/view-ts-files-dialog.tsx +178 -33
- package/src/components/package-port/CodeAndPreview.tsx +4 -1
- package/src/components/package-port/CodeEditor.tsx +42 -35
- package/src/components/package-port/CodeEditorHeader.tsx +26 -20
- package/src/components/package-port/EditorNav.tsx +94 -37
- package/src/components/preview/BuildsList.tsx +238 -0
- package/src/components/preview/ConnectedRepoDashboard.tsx +258 -0
- package/src/components/preview/ConnectedRepoOverview.tsx +454 -0
- package/src/components/preview/ConnectedRepoSettings.tsx +343 -0
- package/src/components/preview/ConnectedReposCards.tsx +191 -0
- package/src/components/preview/index.tsx +207 -0
- package/src/components/ui/tree-view.tsx +23 -6
- package/src/hooks/use-axios.ts +2 -2
- package/src/hooks/use-create-release-dialog.ts +160 -0
- package/src/hooks/use-package-details-form.ts +7 -0
- package/src/hooks/use-packages-base-api-url.ts +1 -1
- package/src/hooks/use-sign-in.ts +2 -2
- package/src/hooks/useFileManagement.ts +22 -2
- package/src/index.css +4 -0
- package/src/lib/utils/formatTimeAgo.ts +10 -0
- package/src/lib/utils/isValidFileName.ts +15 -3
- package/src/pages/dashboard.tsx +2 -2
- package/src/pages/dev-login.tsx +2 -2
- package/src/pages/landing.tsx +1 -1
- package/src/pages/latest.tsx +2 -2
- package/src/pages/preview-build.tsx +380 -0
- package/src/pages/search.tsx +2 -2
- package/src/pages/trending.tsx +2 -2
- package/src/pages/user-profile.tsx +32 -24
- package/src/pages/view-connected-repo.tsx +24 -0
|
@@ -0,0 +1,343 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import React, { useState } from "react"
|
|
2
|
+
import { Card, CardContent, CardHeader } from "@/components/ui/card"
|
|
3
|
+
import { Badge } from "@/components/ui/badge"
|
|
4
|
+
import { Button } from "@/components/ui/button"
|
|
5
|
+
import { GitBranch, Rocket, Github } from "lucide-react"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { PrefetchPageLink } from "../PrefetchPageLink"
|
|
8
|
+
import { formatTimeAgo } from "@/lib/utils/formatTimeAgo"
|
|
9
|
+
import { getBuildStatus, MOCK_DEPLOYMENTS, PackageBuild, StatusIcon } from "."
|
|
10
|
+
|
|
11
|
+
interface ConnectedRepoCardProps {
|
|
12
|
+
ConnectedRepo: PackageBuild
|
|
13
|
+
className?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const ConnectedRepoCard = ({
|
|
17
|
+
ConnectedRepo,
|
|
18
|
+
className,
|
|
19
|
+
}: ConnectedRepoCardProps) => {
|
|
20
|
+
const { status, label } = getBuildStatus(ConnectedRepo)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Card
|
|
24
|
+
className={cn(
|
|
25
|
+
"group relative overflow-hidden",
|
|
26
|
+
"border border-gray-200",
|
|
27
|
+
"hover:border-gray-300",
|
|
28
|
+
"bg-white",
|
|
29
|
+
"p-6",
|
|
30
|
+
"flex flex-col",
|
|
31
|
+
"min-h-[200px]",
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
>
|
|
35
|
+
<div className="flex items-start justify-between mb-4">
|
|
36
|
+
<div className="flex items-center gap-3">
|
|
37
|
+
<a
|
|
38
|
+
href="#"
|
|
39
|
+
className="text-lg font-semibold text-gray-900 hover:text-blue-600 transition-colors"
|
|
40
|
+
>
|
|
41
|
+
tsc-deploy
|
|
42
|
+
</a>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div className="flex items-center justify-center gap-2">
|
|
46
|
+
<Badge
|
|
47
|
+
variant={
|
|
48
|
+
status === "success"
|
|
49
|
+
? "default"
|
|
50
|
+
: status === "error"
|
|
51
|
+
? "destructive"
|
|
52
|
+
: "secondary"
|
|
53
|
+
}
|
|
54
|
+
className="text-xs flex items-center"
|
|
55
|
+
>
|
|
56
|
+
{label}
|
|
57
|
+
</Badge>
|
|
58
|
+
<div className="flex items-center justify-center">
|
|
59
|
+
<StatusIcon status={status} />
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div className="flex items-center gap-2 mb-4">
|
|
65
|
+
<Github className="w-4 h-4 text-gray-600" />
|
|
66
|
+
<a
|
|
67
|
+
href={`https://github.com/${ConnectedRepo.commit_author}/tsc-deploy`}
|
|
68
|
+
className="text-sm font-medium text-gray-700 hover:text-blue-600 transition-colors"
|
|
69
|
+
>
|
|
70
|
+
{ConnectedRepo.commit_author}/tsc-deploy
|
|
71
|
+
</a>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
{ConnectedRepo.commit_message && (
|
|
75
|
+
<div className="mb-6 flex-1">
|
|
76
|
+
<h4
|
|
77
|
+
title={ConnectedRepo.commit_message}
|
|
78
|
+
className="text-sm font-medium truncate text-gray-900 mb-2"
|
|
79
|
+
>
|
|
80
|
+
{ConnectedRepo.commit_message}
|
|
81
|
+
</h4>
|
|
82
|
+
<div className="flex items-center gap-2 text-xs text-gray-500">
|
|
83
|
+
<span>{formatTimeAgo(ConnectedRepo.created_at)} on</span>
|
|
84
|
+
<div className="flex items-center gap-1">
|
|
85
|
+
<GitBranch className="w-3 h-3" />
|
|
86
|
+
<span className="bg-blue-100 text-blue-800 px-2 py-0.5 rounded-full font-medium">
|
|
87
|
+
{ConnectedRepo.branch_name || "main"}
|
|
88
|
+
</span>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
)}
|
|
93
|
+
|
|
94
|
+
<div className="flex gap-2 w-full mt-auto">
|
|
95
|
+
<PrefetchPageLink
|
|
96
|
+
className="w-full"
|
|
97
|
+
href={`/build/${ConnectedRepo.package_build_id}`}
|
|
98
|
+
>
|
|
99
|
+
<Button
|
|
100
|
+
size="sm"
|
|
101
|
+
className="bg-blue-600 w-full hover:bg-blue-700 text-white px-4 py-2"
|
|
102
|
+
>
|
|
103
|
+
View
|
|
104
|
+
</Button>
|
|
105
|
+
</PrefetchPageLink>
|
|
106
|
+
{ConnectedRepo.preview_url && status === "success" && (
|
|
107
|
+
<PrefetchPageLink
|
|
108
|
+
className="w-full"
|
|
109
|
+
href={`/build/${ConnectedRepo.package_build_id}/preview`}
|
|
110
|
+
>
|
|
111
|
+
<Button size="sm" variant="outline" className="px-4 py-2 w-full">
|
|
112
|
+
Preview
|
|
113
|
+
</Button>
|
|
114
|
+
</PrefetchPageLink>
|
|
115
|
+
)}
|
|
116
|
+
</div>
|
|
117
|
+
</Card>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const ConnectedRepoCardSkeleton: React.FC = () => {
|
|
122
|
+
return (
|
|
123
|
+
<Card className="animate-pulse">
|
|
124
|
+
<CardHeader className="pb-3">
|
|
125
|
+
<div className="flex items-start justify-between">
|
|
126
|
+
<div className="flex items-center gap-2 flex-1">
|
|
127
|
+
<div className="w-4 h-4 bg-gray-200 rounded" />
|
|
128
|
+
<div className="space-y-2 flex-1">
|
|
129
|
+
<div className="flex items-center gap-2">
|
|
130
|
+
<div className="w-12 h-4 bg-gray-200 rounded" />
|
|
131
|
+
<div className="w-16 h-3 bg-gray-200 rounded" />
|
|
132
|
+
</div>
|
|
133
|
+
<div className="w-20 h-3 bg-gray-200 rounded" />
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</CardHeader>
|
|
138
|
+
<CardContent className="pt-0 space-y-3">
|
|
139
|
+
<div className="w-full h-4 bg-gray-200 rounded" />
|
|
140
|
+
<div className="flex gap-2">
|
|
141
|
+
<div className="w-16 h-3 bg-gray-200 rounded" />
|
|
142
|
+
<div className="w-20 h-3 bg-gray-200 rounded" />
|
|
143
|
+
</div>
|
|
144
|
+
<div className="flex gap-2 pt-2">
|
|
145
|
+
<div className="flex-1 h-8 bg-gray-200 rounded" />
|
|
146
|
+
<div className="flex-1 h-8 bg-gray-200 rounded" />
|
|
147
|
+
</div>
|
|
148
|
+
</CardContent>
|
|
149
|
+
</Card>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export const ConnectedReposCards = ({ user }: { user: string }) => {
|
|
154
|
+
const [isLoading, setIsLoading] = useState(false)
|
|
155
|
+
const [ConnectedRepos, setConnectedRepos] = useState(MOCK_DEPLOYMENTS)
|
|
156
|
+
|
|
157
|
+
if (isLoading) {
|
|
158
|
+
return (
|
|
159
|
+
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
|
160
|
+
{[...Array(6)].map((_, i) => (
|
|
161
|
+
<ConnectedRepoCardSkeleton key={i} />
|
|
162
|
+
))}
|
|
163
|
+
</div>
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (ConnectedRepos.length === 0) {
|
|
168
|
+
return (
|
|
169
|
+
<div className="flex flex-col items-center justify-center py-20 text-black">
|
|
170
|
+
<Rocket className="w-12 h-12 mb-4 text-black" />
|
|
171
|
+
<h3 className="text-xl font-semibold mb-3">
|
|
172
|
+
No Connected Repositories
|
|
173
|
+
</h3>
|
|
174
|
+
<p className="text-sm text-center max-w-md text-gray-600">
|
|
175
|
+
Connect your GitHub repositories to start building and deploying your
|
|
176
|
+
circuits. Your connected repositories and builds will appear here.
|
|
177
|
+
</p>
|
|
178
|
+
</div>
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<div className="space-y-4">
|
|
184
|
+
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
|
185
|
+
{ConnectedRepos.map((repo) => (
|
|
186
|
+
<ConnectedRepoCard key={repo.package_build_id} ConnectedRepo={repo} />
|
|
187
|
+
))}
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
)
|
|
191
|
+
}
|