@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.
- package/dist/bundle.js +20 -10
- package/dist/index.d.ts +15 -0
- package/dist/index.js +6 -2
- package/dist/schema.d.ts +24 -0
- package/dist/schema.js +6 -2
- package/fake-snippets-api/lib/db/schema.ts +5 -0
- package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +2 -0
- package/fake-snippets-api/lib/public-mapping/public-map-package.ts +2 -0
- package/fake-snippets-api/routes/api/packages/update.ts +7 -2
- package/package.json +1 -1
- package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +1 -0
- package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +13 -1
- package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +17 -0
- package/src/components/dialogs/GitHubRepositorySelector.tsx +103 -66
- package/src/components/dialogs/edit-package-details-dialog.tsx +18 -3
- package/src/components/preview/BuildsList.tsx +19 -16
- package/src/components/preview/{ConnectedReposCards.tsx → ConnectedPackagesList.tsx} +64 -68
- package/src/components/preview/ConnectedRepoDashboard.tsx +37 -52
- package/src/components/preview/ConnectedRepoOverview.tsx +2 -2
- package/src/components/preview/index.tsx +42 -1
- package/src/hooks/use-package-details-form.ts +13 -1
- package/src/pages/user-profile.tsx +14 -6
- package/src/pages/view-connected-repo.tsx +1 -7
- package/src/components/preview/ConnectedRepoSettings.tsx +0 -343
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useRef } from "react"
|
|
2
2
|
import {
|
|
3
3
|
Select,
|
|
4
4
|
SelectContent,
|
|
@@ -11,27 +11,31 @@ import { useApiBaseUrl } from "@/hooks/use-packages-base-api-url"
|
|
|
11
11
|
import { useQuery } from "react-query"
|
|
12
12
|
import { Button } from "../ui/button"
|
|
13
13
|
import { Label } from "../ui/label"
|
|
14
|
-
import { Plus } from "lucide-react"
|
|
14
|
+
import { Minus, Plus } from "lucide-react"
|
|
15
|
+
import { Switch } from "../ui/switch"
|
|
15
16
|
|
|
16
17
|
interface GitHubRepositorySelectorProps {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
selectedRepository?: string
|
|
19
|
+
setSelectedRepository?: (value: string | null) => void
|
|
19
20
|
disabled?: boolean
|
|
20
21
|
open?: boolean
|
|
22
|
+
addFormContent?: (props: {
|
|
23
|
+
allowPrPreviews?: boolean
|
|
24
|
+
}) => void
|
|
25
|
+
formData?: any
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
export const GitHubRepositorySelector = ({
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
selectedRepository,
|
|
30
|
+
setSelectedRepository,
|
|
26
31
|
disabled = false,
|
|
27
32
|
open = false,
|
|
33
|
+
addFormContent,
|
|
34
|
+
formData,
|
|
28
35
|
}: GitHubRepositorySelectorProps) => {
|
|
29
36
|
const axios = useAxios()
|
|
30
37
|
const apiBaseUrl = useApiBaseUrl()
|
|
31
|
-
const
|
|
32
|
-
value || "",
|
|
33
|
-
)
|
|
34
|
-
|
|
38
|
+
const initialValue = useRef(selectedRepository).current
|
|
35
39
|
// Fetch available repositories
|
|
36
40
|
const { data: repositoriesData, error: repositoriesError } = useQuery(
|
|
37
41
|
["github-repositories"],
|
|
@@ -52,72 +56,105 @@ export const GitHubRepositorySelector = ({
|
|
|
52
56
|
const handleValueChange = (newValue: string) => {
|
|
53
57
|
if (newValue === "connect-more") {
|
|
54
58
|
handleConnectMoreRepos()
|
|
59
|
+
} else if (newValue === "unlink//repo") {
|
|
60
|
+
setSelectedRepository?.("unlink//repo")
|
|
55
61
|
} else {
|
|
56
|
-
setSelectedRepository(newValue)
|
|
57
|
-
onValueChange?.(newValue)
|
|
62
|
+
setSelectedRepository?.(newValue)
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
return (
|
|
62
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<div className="
|
|
69
|
-
|
|
67
|
+
<>
|
|
68
|
+
<div className="space-y-1 mb-3">
|
|
69
|
+
<Label htmlFor="repository">GitHub Repository</Label>
|
|
70
|
+
{(repositoriesError as any)?.response?.status === 400 &&
|
|
71
|
+
(repositoriesError as any)?.response?.data?.error_code ===
|
|
72
|
+
"github_not_connected" ? (
|
|
73
|
+
<div className="space-y-2">
|
|
74
|
+
<div className="text-sm text-muted-foreground">
|
|
75
|
+
Connect your GitHub account to link this package to a repository.
|
|
76
|
+
</div>
|
|
77
|
+
<Button
|
|
78
|
+
type="button"
|
|
79
|
+
variant="outline"
|
|
80
|
+
onClick={handleConnectMoreRepos}
|
|
81
|
+
className="w-full"
|
|
82
|
+
disabled={disabled}
|
|
83
|
+
>
|
|
84
|
+
<svg
|
|
85
|
+
className="w-4 h-4 mr-2"
|
|
86
|
+
viewBox="0 0 24 24"
|
|
87
|
+
fill="currentColor"
|
|
88
|
+
>
|
|
89
|
+
<path d="M12 0C5.374 0 0 5.373 0 12 0 17.302 3.438 21.8 8.207 23.387c.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z" />
|
|
90
|
+
</svg>
|
|
91
|
+
Connect GitHub Account
|
|
92
|
+
</Button>
|
|
70
93
|
</div>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
>
|
|
78
|
-
<svg
|
|
79
|
-
className="w-4 h-4 mr-2"
|
|
80
|
-
viewBox="0 0 24 24"
|
|
81
|
-
fill="currentColor"
|
|
94
|
+
) : (
|
|
95
|
+
<div className="space-y-2">
|
|
96
|
+
<Select
|
|
97
|
+
value={selectedRepository}
|
|
98
|
+
onValueChange={handleValueChange}
|
|
99
|
+
disabled={disabled}
|
|
82
100
|
>
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<span>
|
|
103
|
-
{repo.private && (
|
|
104
|
-
<span className="text-xs text-muted-foreground">
|
|
105
|
-
(private)
|
|
106
|
-
</span>
|
|
107
|
-
)}
|
|
101
|
+
<SelectTrigger className="w-full">
|
|
102
|
+
<SelectValue placeholder="Select a repository" />
|
|
103
|
+
</SelectTrigger>
|
|
104
|
+
<SelectContent className="!z-[999]">
|
|
105
|
+
{repositoriesData?.repos?.map((repo: any) => (
|
|
106
|
+
<SelectItem key={repo.full_name} value={repo.full_name}>
|
|
107
|
+
<div className="flex items-center space-x-2">
|
|
108
|
+
<span>{repo.unscoped_name}</span>
|
|
109
|
+
{repo.private && (
|
|
110
|
+
<span className="text-xs text-muted-foreground">
|
|
111
|
+
(private)
|
|
112
|
+
</span>
|
|
113
|
+
)}
|
|
114
|
+
</div>
|
|
115
|
+
</SelectItem>
|
|
116
|
+
))}
|
|
117
|
+
<SelectItem value="connect-more">
|
|
118
|
+
<div className="flex items-center space-x-2 text-blue-600">
|
|
119
|
+
<Plus className="w-3 h-3" />
|
|
120
|
+
<span>Connect More Repos</span>
|
|
108
121
|
</div>
|
|
109
122
|
</SelectItem>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
123
|
+
{Boolean(initialValue) && (
|
|
124
|
+
<SelectItem value="unlink//repo">
|
|
125
|
+
<div className="flex items-center space-x-2 text-red-600">
|
|
126
|
+
<Minus className="w-3 h-3" />
|
|
127
|
+
<span>Unlink Repo</span>
|
|
128
|
+
</div>
|
|
129
|
+
</SelectItem>
|
|
130
|
+
)}
|
|
131
|
+
</SelectContent>
|
|
132
|
+
</Select>
|
|
133
|
+
</div>
|
|
134
|
+
)}
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
{initialValue && selectedRepository !== "unlink//repo" && (
|
|
138
|
+
<div className="space-y-4 mt-4 p-4 border rounded-lg bg-gray-50">
|
|
139
|
+
<div className="flex items-center justify-between">
|
|
140
|
+
<div className="space-y-0.5">
|
|
141
|
+
<Label className="text-sm font-medium">Enable PR Preview</Label>
|
|
142
|
+
<p className="text-xs text-gray-500">
|
|
143
|
+
Generate preview builds for pull requests
|
|
144
|
+
</p>
|
|
145
|
+
</div>
|
|
146
|
+
<Switch
|
|
147
|
+
checked={formData?.allowPrPreviews}
|
|
148
|
+
onCheckedChange={(checked) =>
|
|
149
|
+
addFormContent?.({
|
|
150
|
+
allowPrPreviews: checked,
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
disabled={disabled}
|
|
154
|
+
/>
|
|
155
|
+
</div>
|
|
119
156
|
</div>
|
|
120
157
|
)}
|
|
121
|
-
|
|
158
|
+
</>
|
|
122
159
|
)
|
|
123
160
|
}
|
|
@@ -48,7 +48,9 @@ interface EditPackageDetailsDialogProps {
|
|
|
48
48
|
newWebsite: string,
|
|
49
49
|
newLicense: string | null,
|
|
50
50
|
newDefaultView: string,
|
|
51
|
+
newAllowPrPreviews?: boolean,
|
|
51
52
|
) => void
|
|
53
|
+
currentAllowPrPreviews?: boolean
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
export const EditPackageDetailsDialog = ({
|
|
@@ -64,6 +66,7 @@ export const EditPackageDetailsDialog = ({
|
|
|
64
66
|
unscopedPackageName,
|
|
65
67
|
packageReleaseId,
|
|
66
68
|
packageAuthor,
|
|
69
|
+
currentAllowPrPreviews,
|
|
67
70
|
onUpdate,
|
|
68
71
|
}: EditPackageDetailsDialogProps) => {
|
|
69
72
|
const axios = useAxios()
|
|
@@ -85,6 +88,7 @@ export const EditPackageDetailsDialog = ({
|
|
|
85
88
|
initialUnscopedPackageName: unscopedPackageName,
|
|
86
89
|
isDialogOpen: open,
|
|
87
90
|
initialVisibility: isPrivate ? "private" : "public",
|
|
91
|
+
initialAllowPrPreviews: currentAllowPrPreviews,
|
|
88
92
|
})
|
|
89
93
|
|
|
90
94
|
const [showConfirmDelete, setShowConfirmDelete] = useState(false)
|
|
@@ -117,7 +121,11 @@ export const EditPackageDetailsDialog = ({
|
|
|
117
121
|
website: formData.website.trim(),
|
|
118
122
|
is_private: formData.visibility == "private",
|
|
119
123
|
default_view: formData.defaultView,
|
|
120
|
-
|
|
124
|
+
allow_pr_previews: formData.allowPrPreviews,
|
|
125
|
+
github_repo_full_name:
|
|
126
|
+
formData.githubRepoFullName === "unlink//repo"
|
|
127
|
+
? null
|
|
128
|
+
: formData.githubRepoFullName,
|
|
121
129
|
...(formData.unscopedPackageName !== unscopedPackageName && {
|
|
122
130
|
name: formData.unscopedPackageName.trim(),
|
|
123
131
|
}),
|
|
@@ -377,8 +385,8 @@ export const EditPackageDetailsDialog = ({
|
|
|
377
385
|
</div>
|
|
378
386
|
<div className="space-y-1">
|
|
379
387
|
<GitHubRepositorySelector
|
|
380
|
-
|
|
381
|
-
|
|
388
|
+
selectedRepository={formData.githubRepoFullName || ""}
|
|
389
|
+
setSelectedRepository={(value) =>
|
|
382
390
|
setFormData((prev) => ({
|
|
383
391
|
...prev,
|
|
384
392
|
githubRepoFullName: value,
|
|
@@ -386,6 +394,13 @@ export const EditPackageDetailsDialog = ({
|
|
|
386
394
|
}
|
|
387
395
|
disabled={updatePackageDetailsMutation.isLoading}
|
|
388
396
|
open={open}
|
|
397
|
+
formData={formData}
|
|
398
|
+
addFormContent={(content) => {
|
|
399
|
+
setFormData((prev) => ({
|
|
400
|
+
...prev,
|
|
401
|
+
...content,
|
|
402
|
+
}))
|
|
403
|
+
}}
|
|
389
404
|
/>
|
|
390
405
|
</div>
|
|
391
406
|
</div>
|
|
@@ -25,15 +25,18 @@ import {
|
|
|
25
25
|
TableHeader,
|
|
26
26
|
TableRow,
|
|
27
27
|
} from "@/components/ui/table"
|
|
28
|
-
import { getBuildStatus, PackageBuild, StatusIcon } from "."
|
|
28
|
+
import { getBuildStatus, MOCK_DEPLOYMENTS, PackageBuild, StatusIcon } from "."
|
|
29
29
|
import { formatTimeAgo } from "@/lib/utils/formatTimeAgo"
|
|
30
|
+
import { Package } from "fake-snippets-api/lib/db/schema"
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
export const BuildsList = ({
|
|
33
|
+
pkg,
|
|
34
|
+
onSelectBuild,
|
|
35
|
+
}: {
|
|
36
|
+
pkg: Package
|
|
33
37
|
onSelectBuild?: (build: PackageBuild) => void
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const BuildsList = ({ builds, onSelectBuild }: BuildsListProps) => {
|
|
38
|
+
}) => {
|
|
39
|
+
const builds = MOCK_DEPLOYMENTS
|
|
37
40
|
return (
|
|
38
41
|
<div className="space-y-6">
|
|
39
42
|
<div className="flex items-center justify-between">
|
|
@@ -41,10 +44,6 @@ export const BuildsList = ({ builds, onSelectBuild }: BuildsListProps) => {
|
|
|
41
44
|
<h2 className="text-2xl font-bold text-gray-900">Builds</h2>
|
|
42
45
|
<p className="text-gray-600">Manage and monitor your builds</p>
|
|
43
46
|
</div>
|
|
44
|
-
<Button className="flex items-center gap-2">
|
|
45
|
-
<Plus className="w-4 h-4" />
|
|
46
|
-
Create Build
|
|
47
|
-
</Button>
|
|
48
47
|
</div>
|
|
49
48
|
|
|
50
49
|
<Card>
|
|
@@ -139,11 +138,15 @@ export const BuildsList = ({ builds, onSelectBuild }: BuildsListProps) => {
|
|
|
139
138
|
</Button>
|
|
140
139
|
</DropdownMenuTrigger>
|
|
141
140
|
<DropdownMenuContent align="end">
|
|
142
|
-
<DropdownMenuItem
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
<DropdownMenuItem
|
|
142
|
+
onClick={() => onSelectBuild?.(build)}
|
|
143
|
+
>
|
|
144
|
+
View Details
|
|
145
|
+
</DropdownMenuItem>
|
|
146
|
+
<DropdownMenuItem
|
|
147
|
+
onClick={() => onSelectBuild?.(build)}
|
|
148
|
+
>
|
|
149
|
+
View Logs
|
|
147
150
|
</DropdownMenuItem>
|
|
148
151
|
</DropdownMenuContent>
|
|
149
152
|
</DropdownMenu>
|
|
@@ -201,7 +204,7 @@ export const BuildsList = ({ builds, onSelectBuild }: BuildsListProps) => {
|
|
|
201
204
|
<CardContent className="p-6">
|
|
202
205
|
<div className="flex items-center gap-3">
|
|
203
206
|
<div className="p-2 bg-blue-100 rounded-lg">
|
|
204
|
-
<Loader2 className="w-5 h-5 text-blue-600" />
|
|
207
|
+
<Loader2 className="w-5 h-5 text-blue-600 animate-spin" />
|
|
205
208
|
</div>
|
|
206
209
|
<div>
|
|
207
210
|
<p className="text-sm text-gray-600">Building</p>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useState } from "react"
|
|
2
2
|
import { Card, CardContent, CardHeader } from "@/components/ui/card"
|
|
3
3
|
import { Badge } from "@/components/ui/badge"
|
|
4
4
|
import { Button } from "@/components/ui/button"
|
|
@@ -6,19 +6,56 @@ import { GitBranch, Rocket, Github } from "lucide-react"
|
|
|
6
6
|
import { cn } from "@/lib/utils"
|
|
7
7
|
import { PrefetchPageLink } from "../PrefetchPageLink"
|
|
8
8
|
import { formatTimeAgo } from "@/lib/utils/formatTimeAgo"
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getBuildStatus,
|
|
11
|
+
getLatestBuildForPackage,
|
|
12
|
+
MOCK_DEPLOYMENTS,
|
|
13
|
+
PackageBuild,
|
|
14
|
+
StatusIcon,
|
|
15
|
+
} from "."
|
|
16
|
+
import { Package } from "fake-snippets-api/lib/db/schema"
|
|
10
17
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
export const ConnectedPackageCardSkeleton = () => {
|
|
19
|
+
return (
|
|
20
|
+
<Card className="animate-pulse">
|
|
21
|
+
<CardHeader className="pb-3">
|
|
22
|
+
<div className="flex items-start justify-between">
|
|
23
|
+
<div className="flex items-center gap-2 flex-1">
|
|
24
|
+
<div className="w-4 h-4 bg-gray-200 rounded" />
|
|
25
|
+
<div className="space-y-2 flex-1">
|
|
26
|
+
<div className="flex items-center gap-2">
|
|
27
|
+
<div className="w-12 h-4 bg-gray-200 rounded" />
|
|
28
|
+
<div className="w-16 h-3 bg-gray-200 rounded" />
|
|
29
|
+
</div>
|
|
30
|
+
<div className="w-20 h-3 bg-gray-200 rounded" />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</CardHeader>
|
|
35
|
+
<CardContent className="pt-0 space-y-3">
|
|
36
|
+
<div className="w-full h-4 bg-gray-200 rounded" />
|
|
37
|
+
<div className="flex gap-2">
|
|
38
|
+
<div className="w-16 h-3 bg-gray-200 rounded" />
|
|
39
|
+
<div className="w-20 h-3 bg-gray-200 rounded" />
|
|
40
|
+
</div>
|
|
41
|
+
<div className="flex gap-2 pt-2">
|
|
42
|
+
<div className="flex-1 h-8 bg-gray-200 rounded" />
|
|
43
|
+
<div className="flex-1 h-8 bg-gray-200 rounded" />
|
|
44
|
+
</div>
|
|
45
|
+
</CardContent>
|
|
46
|
+
</Card>
|
|
47
|
+
)
|
|
14
48
|
}
|
|
15
49
|
|
|
16
|
-
export const
|
|
17
|
-
|
|
50
|
+
export const ConnectedPackageCard = ({
|
|
51
|
+
pkg,
|
|
18
52
|
className,
|
|
19
|
-
}:
|
|
20
|
-
|
|
21
|
-
|
|
53
|
+
}: {
|
|
54
|
+
pkg: Package
|
|
55
|
+
className?: string
|
|
56
|
+
}) => {
|
|
57
|
+
const latestBuildInfo: PackageBuild = getLatestBuildForPackage(pkg)
|
|
58
|
+
const { status, label } = getBuildStatus(latestBuildInfo)
|
|
22
59
|
return (
|
|
23
60
|
<Card
|
|
24
61
|
className={cn(
|
|
@@ -64,27 +101,27 @@ export const ConnectedRepoCard = ({
|
|
|
64
101
|
<div className="flex items-center gap-2 mb-4">
|
|
65
102
|
<Github className="w-4 h-4 text-gray-600" />
|
|
66
103
|
<a
|
|
67
|
-
href={`https://github.com/${
|
|
104
|
+
href={`https://github.com/${pkg.github_repo_full_name}`}
|
|
68
105
|
className="text-sm font-medium text-gray-700 hover:text-blue-600 transition-colors"
|
|
69
106
|
>
|
|
70
|
-
{
|
|
107
|
+
{pkg.github_repo_full_name}
|
|
71
108
|
</a>
|
|
72
109
|
</div>
|
|
73
110
|
|
|
74
|
-
{
|
|
111
|
+
{latestBuildInfo.commit_message && (
|
|
75
112
|
<div className="mb-6 flex-1">
|
|
76
113
|
<h4
|
|
77
|
-
title={
|
|
114
|
+
title={latestBuildInfo.commit_message}
|
|
78
115
|
className="text-sm font-medium truncate text-gray-900 mb-2"
|
|
79
116
|
>
|
|
80
|
-
{
|
|
117
|
+
{latestBuildInfo.commit_message}
|
|
81
118
|
</h4>
|
|
82
119
|
<div className="flex items-center gap-2 text-xs text-gray-500">
|
|
83
|
-
<span>{formatTimeAgo(
|
|
120
|
+
<span>{formatTimeAgo(latestBuildInfo.created_at)} on</span>
|
|
84
121
|
<div className="flex items-center gap-1">
|
|
85
122
|
<GitBranch className="w-3 h-3" />
|
|
86
123
|
<span className="bg-blue-100 text-blue-800 px-2 py-0.5 rounded-full font-medium">
|
|
87
|
-
{
|
|
124
|
+
{latestBuildInfo.branch_name || "main"}
|
|
88
125
|
</span>
|
|
89
126
|
</div>
|
|
90
127
|
</div>
|
|
@@ -94,7 +131,7 @@ export const ConnectedRepoCard = ({
|
|
|
94
131
|
<div className="flex gap-2 w-full mt-auto">
|
|
95
132
|
<PrefetchPageLink
|
|
96
133
|
className="w-full"
|
|
97
|
-
href={`/build/${
|
|
134
|
+
href={`/build/${latestBuildInfo.package_build_id}`}
|
|
98
135
|
>
|
|
99
136
|
<Button
|
|
100
137
|
size="sm"
|
|
@@ -103,10 +140,10 @@ export const ConnectedRepoCard = ({
|
|
|
103
140
|
View
|
|
104
141
|
</Button>
|
|
105
142
|
</PrefetchPageLink>
|
|
106
|
-
{
|
|
143
|
+
{latestBuildInfo.preview_url && status === "success" && (
|
|
107
144
|
<PrefetchPageLink
|
|
108
145
|
className="w-full"
|
|
109
|
-
href={`/build/${
|
|
146
|
+
href={`/build/${latestBuildInfo.package_build_id}/preview`}
|
|
110
147
|
>
|
|
111
148
|
<Button size="sm" variant="outline" className="px-4 py-2 w-full">
|
|
112
149
|
Preview
|
|
@@ -118,53 +155,12 @@ export const ConnectedRepoCard = ({
|
|
|
118
155
|
)
|
|
119
156
|
}
|
|
120
157
|
|
|
121
|
-
export const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
}
|
|
158
|
+
export const ConnectedPackagesList = ({
|
|
159
|
+
packages,
|
|
160
|
+
}: { packages: Package[] }) => {
|
|
161
|
+
const [pkgs, setpkgs] = useState(MOCK_DEPLOYMENTS)
|
|
166
162
|
|
|
167
|
-
if (
|
|
163
|
+
if (pkgs.length === 0) {
|
|
168
164
|
return (
|
|
169
165
|
<div className="flex flex-col items-center justify-center py-20 text-black">
|
|
170
166
|
<Rocket className="w-12 h-12 mb-4 text-black" />
|
|
@@ -182,8 +178,8 @@ export const ConnectedReposCards = ({ user }: { user: string }) => {
|
|
|
182
178
|
return (
|
|
183
179
|
<div className="space-y-4">
|
|
184
180
|
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
|
185
|
-
{
|
|
186
|
-
<
|
|
181
|
+
{packages.map((pkg) => (
|
|
182
|
+
<ConnectedPackageCard key={pkg.package_id} pkg={pkg} />
|
|
187
183
|
))}
|
|
188
184
|
</div>
|
|
189
185
|
</div>
|