@tscircuit/fake-snippets 0.0.102 → 0.0.103

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.
@@ -18,7 +18,7 @@ export default withRouteSpec({
18
18
  .optional(),
19
19
  description: z.string().optional(),
20
20
  website: z.string().optional(),
21
- github_repo_full_name: z.string().optional(),
21
+ github_repo_full_name: z.string().nullable().optional(),
22
22
  is_private: z.boolean().optional(),
23
23
  is_unlisted: z.boolean().optional(),
24
24
  default_view: z.enum(["files", "3d", "pcb", "schematic"]).optional(),
@@ -84,7 +84,9 @@ export default withRouteSpec({
84
84
  unscoped_name: name ?? existingPackage.unscoped_name,
85
85
  website: website ?? existingPackage.website,
86
86
  github_repo_full_name:
87
- github_repo_full_name ?? existingPackage.github_repo_full_name,
87
+ github_repo_full_name === null
88
+ ? null
89
+ : (github_repo_full_name ?? existingPackage.github_repo_full_name),
88
90
  is_private: is_private ?? existingPackage.is_private,
89
91
  is_public:
90
92
  is_private !== undefined ? !is_private : existingPackage.is_public,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/fake-snippets",
3
- "version": "0.0.102",
3
+ "version": "0.0.103",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +1,5 @@
1
1
  import { Badge } from "@/components/ui/badge"
2
- import { GitFork, Star, Settings, LinkIcon } from "lucide-react"
2
+ import { GitFork, Star, Settings, LinkIcon, Github } from "lucide-react"
3
3
  import { Skeleton } from "@/components/ui/skeleton"
4
4
  import { useCurrentPackageInfo } from "@/hooks/use-current-package-info"
5
5
  import { usePackageReleaseById } from "@/hooks/use-package-release"
@@ -10,6 +10,7 @@ import { useState, useEffect, useMemo } from "react"
10
10
  import { usePackageFile } from "@/hooks/use-package-files"
11
11
  import { getLicenseFromLicenseContent } from "@/lib/getLicenseFromLicenseContent"
12
12
  import { PackageInfo } from "@/lib/types"
13
+
13
14
  interface SidebarAboutSectionProps {
14
15
  packageInfo?: PackageInfo
15
16
  isLoading?: boolean
@@ -163,6 +164,16 @@ export default function SidebarAboutSection({
163
164
  <GitFork className="h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]" />
164
165
  <span>{(packageInfo as any)?.fork_count ?? "0"} forks</span>
165
166
  </div>
167
+ {packageInfo?.github_repo_full_name && (
168
+ <a
169
+ target="_blank"
170
+ href={`https://github.com/${packageInfo.github_repo_full_name}`}
171
+ className="flex items-center hover:underline hover:underline-offset-2 cursor-pointer hover:decoration-gray-500"
172
+ >
173
+ <Github className="h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]" />
174
+ <span>{packageInfo?.github_repo_full_name.split("/")[1]}</span>
175
+ </a>
176
+ )}
166
177
  </div>
167
178
  </div>
168
179
 
@@ -5,6 +5,12 @@ import { usePackageReleaseById } from "@/hooks/use-package-release"
5
5
  import { timeAgo } from "@/lib/utils/timeAgo"
6
6
  import { BuildStatus, BuildStep } from "./build-status"
7
7
  import type { PackageRelease } from "fake-snippets-api/lib/db/schema"
8
+ import {
9
+ getBuildStatus,
10
+ getLatestBuildFromPackageRelease,
11
+ StatusIcon,
12
+ } from "@/components/preview"
13
+ import { PrefetchPageLink } from "@/components/PrefetchPageLink"
8
14
 
9
15
  function getTranspilationStatus(
10
16
  pr?: PackageRelease | null,
@@ -68,6 +74,8 @@ export default function SidebarReleasesSection() {
68
74
  )
69
75
  }
70
76
 
77
+ const latestBuild = getLatestBuildFromPackageRelease(packageRelease)
78
+ const { status, label } = getBuildStatus(latestBuild)
71
79
  return (
72
80
  <div className="mb-6">
73
81
  <h2 className="text-lg font-semibold mb-2">Releases</h2>
@@ -89,6 +97,15 @@ export default function SidebarReleasesSection() {
89
97
  packageReleaseId={packageRelease.package_release_id}
90
98
  />
91
99
  ))}
100
+ {latestBuild && (
101
+ <PrefetchPageLink
102
+ href={`/build/${latestBuild.package_build_id}`}
103
+ className="flex items-center gap-2 text-sm text-gray-500 dark:text-[#8b949e]"
104
+ >
105
+ <StatusIcon status={status} />
106
+ <span>Package preview {label}</span>
107
+ </PrefetchPageLink>
108
+ )}
92
109
  </div>
93
110
  {/* <a href="#" className="text-blue-600 dark:text-[#58a6ff] hover:underline text-sm">
94
111
  Push a new release
@@ -1,4 +1,4 @@
1
- import { useState } from "react"
1
+ import { useRef } from "react"
2
2
  import {
3
3
  Select,
4
4
  SelectContent,
@@ -11,27 +11,32 @@ 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
- value?: string
18
- onValueChange?: (value: string) => void
18
+ selectedRepository?: string
19
+ setSelectedRepository?: (value: string | null) => void
19
20
  disabled?: boolean
20
21
  open?: boolean
22
+ addFormContent?: (data: {
23
+ enablePrPreview?: boolean
24
+ privateBuild?: boolean
25
+ }) => void
26
+ formData?: any
21
27
  }
22
28
 
23
29
  export const GitHubRepositorySelector = ({
24
- value,
25
- onValueChange,
30
+ selectedRepository,
31
+ setSelectedRepository,
26
32
  disabled = false,
27
33
  open = false,
34
+ addFormContent,
35
+ formData,
28
36
  }: GitHubRepositorySelectorProps) => {
29
37
  const axios = useAxios()
30
38
  const apiBaseUrl = useApiBaseUrl()
31
- const [selectedRepository, setSelectedRepository] = useState<string>(
32
- value || "",
33
- )
34
-
39
+ const initialValue = useRef(selectedRepository).current
35
40
  // Fetch available repositories
36
41
  const { data: repositoriesData, error: repositoriesError } = useQuery(
37
42
  ["github-repositories"],
@@ -52,72 +57,127 @@ export const GitHubRepositorySelector = ({
52
57
  const handleValueChange = (newValue: string) => {
53
58
  if (newValue === "connect-more") {
54
59
  handleConnectMoreRepos()
60
+ } else if (newValue === "unlink//repo") {
61
+ setSelectedRepository?.("unlink//repo")
55
62
  } else {
56
- setSelectedRepository(newValue)
57
- onValueChange?.(newValue)
63
+ setSelectedRepository?.(newValue)
58
64
  }
59
65
  }
60
66
 
61
67
  return (
62
- <div className="space-y-1">
63
- <Label htmlFor="repository">GitHub Repository</Label>
64
- {(repositoriesError as any)?.response?.status === 400 &&
65
- (repositoriesError as any)?.response?.data?.error_code ===
66
- "github_not_connected" ? (
67
- <div className="space-y-2">
68
- <div className="text-sm text-muted-foreground">
69
- Connect your GitHub account to link this package to a repository.
68
+ <>
69
+ <div className="space-y-1 mb-3">
70
+ <Label htmlFor="repository">GitHub Repository</Label>
71
+ {(repositoriesError as any)?.response?.status === 400 &&
72
+ (repositoriesError as any)?.response?.data?.error_code ===
73
+ "github_not_connected" ? (
74
+ <div className="space-y-2">
75
+ <div className="text-sm text-muted-foreground">
76
+ Connect your GitHub account to link this package to a repository.
77
+ </div>
78
+ <Button
79
+ type="button"
80
+ variant="outline"
81
+ onClick={handleConnectMoreRepos}
82
+ className="w-full"
83
+ disabled={disabled}
84
+ >
85
+ <svg
86
+ className="w-4 h-4 mr-2"
87
+ viewBox="0 0 24 24"
88
+ fill="currentColor"
89
+ >
90
+ <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" />
91
+ </svg>
92
+ Connect GitHub Account
93
+ </Button>
70
94
  </div>
71
- <Button
72
- type="button"
73
- variant="outline"
74
- onClick={handleConnectMoreRepos}
75
- className="w-full"
76
- disabled={disabled}
77
- >
78
- <svg
79
- className="w-4 h-4 mr-2"
80
- viewBox="0 0 24 24"
81
- fill="currentColor"
95
+ ) : (
96
+ <div className="space-y-2">
97
+ <Select
98
+ value={selectedRepository}
99
+ onValueChange={handleValueChange}
100
+ disabled={disabled}
82
101
  >
83
- <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" />
84
- </svg>
85
- Connect GitHub Account
86
- </Button>
87
- </div>
88
- ) : (
89
- <div className="space-y-2">
90
- <Select
91
- value={selectedRepository}
92
- onValueChange={handleValueChange}
93
- disabled={disabled}
94
- >
95
- <SelectTrigger className="w-full">
96
- <SelectValue placeholder="Select a repository" />
97
- </SelectTrigger>
98
- <SelectContent className="!z-[999]">
99
- {repositoriesData?.repos?.map((repo: any) => (
100
- <SelectItem key={repo.full_name} value={repo.full_name}>
101
- <div className="flex items-center space-x-2">
102
- <span>{repo.unscoped_name}</span>
103
- {repo.private && (
104
- <span className="text-xs text-muted-foreground">
105
- (private)
106
- </span>
107
- )}
102
+ <SelectTrigger className="w-full">
103
+ <SelectValue placeholder="Select a repository" />
104
+ </SelectTrigger>
105
+ <SelectContent className="!z-[999]">
106
+ {repositoriesData?.repos?.map((repo: any) => (
107
+ <SelectItem key={repo.full_name} value={repo.full_name}>
108
+ <div className="flex items-center space-x-2">
109
+ <span>{repo.unscoped_name}</span>
110
+ {repo.private && (
111
+ <span className="text-xs text-muted-foreground">
112
+ (private)
113
+ </span>
114
+ )}
115
+ </div>
116
+ </SelectItem>
117
+ ))}
118
+ <SelectItem value="connect-more">
119
+ <div className="flex items-center space-x-2 text-blue-600">
120
+ <Plus className="w-3 h-3" />
121
+ <span>Connect More Repos</span>
108
122
  </div>
109
123
  </SelectItem>
110
- ))}
111
- <SelectItem value="connect-more">
112
- <div className="flex items-center space-x-2 text-blue-600">
113
- <Plus className="w-3 h-3" />
114
- <span>Connect More Repos</span>
115
- </div>
116
- </SelectItem>
117
- </SelectContent>
118
- </Select>
124
+ {Boolean(initialValue) && (
125
+ <SelectItem value="unlink//repo">
126
+ <div className="flex items-center space-x-2 text-red-600">
127
+ <Minus className="w-3 h-3" />
128
+ <span>Unlink Repo</span>
129
+ </div>
130
+ </SelectItem>
131
+ )}
132
+ </SelectContent>
133
+ </Select>
134
+ </div>
135
+ )}
136
+ </div>
137
+
138
+ {initialValue && selectedRepository !== "unlink//repo" && (
139
+ <div className="space-y-4 mt-4 p-4 border rounded-lg bg-gray-50">
140
+ <h4 className="text-sm font-medium text-gray-900">
141
+ Repository Settings
142
+ </h4>
143
+
144
+ <div className="flex items-center justify-between">
145
+ <div className="space-y-0.5">
146
+ <Label className="text-sm font-medium">Private Build</Label>
147
+ <p className="text-xs text-gray-500">
148
+ Keep build previews private
149
+ </p>
150
+ </div>
151
+ <Switch
152
+ checked={formData?.privateBuild}
153
+ onCheckedChange={(checked) =>
154
+ addFormContent?.({
155
+ privateBuild: checked,
156
+ })
157
+ }
158
+ disabled={disabled}
159
+ />
160
+ </div>
161
+
162
+ <div className="flex items-center justify-between">
163
+ <div className="space-y-0.5">
164
+ <Label className="text-sm font-medium">Enable PR Preview</Label>
165
+ <p className="text-xs text-gray-500">
166
+ Generate preview builds for pull requests
167
+ </p>
168
+ </div>
169
+ <Switch
170
+ checked={formData?.enablePrPreview}
171
+ onCheckedChange={(checked) =>
172
+ addFormContent?.({
173
+ enablePrPreview: checked,
174
+ })
175
+ }
176
+ disabled={disabled}
177
+ />
178
+ </div>
119
179
  </div>
120
180
  )}
121
- </div>
181
+ </>
122
182
  )
123
183
  }
@@ -117,7 +117,10 @@ export const EditPackageDetailsDialog = ({
117
117
  website: formData.website.trim(),
118
118
  is_private: formData.visibility == "private",
119
119
  default_view: formData.defaultView,
120
- github_repo_full_name: formData.githubRepoFullName,
120
+ github_repo_full_name:
121
+ formData.githubRepoFullName === "unlink//repo"
122
+ ? null
123
+ : formData.githubRepoFullName,
121
124
  ...(formData.unscopedPackageName !== unscopedPackageName && {
122
125
  name: formData.unscopedPackageName.trim(),
123
126
  }),
@@ -377,8 +380,8 @@ export const EditPackageDetailsDialog = ({
377
380
  </div>
378
381
  <div className="space-y-1">
379
382
  <GitHubRepositorySelector
380
- value={formData.githubRepoFullName || ""}
381
- onValueChange={(value) =>
383
+ selectedRepository={formData.githubRepoFullName || ""}
384
+ setSelectedRepository={(value) =>
382
385
  setFormData((prev) => ({
383
386
  ...prev,
384
387
  githubRepoFullName: value,
@@ -386,6 +389,13 @@ export const EditPackageDetailsDialog = ({
386
389
  }
387
390
  disabled={updatePackageDetailsMutation.isLoading}
388
391
  open={open}
392
+ formData={formData}
393
+ addFormContent={(content) => {
394
+ setFormData((prev) => ({
395
+ ...prev,
396
+ ...content,
397
+ }))
398
+ }}
389
399
  />
390
400
  </div>
391
401
  </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
- interface BuildsListProps {
32
- builds: PackageBuild[]
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>View Details</DropdownMenuItem>
143
- <DropdownMenuItem>View Logs</DropdownMenuItem>
144
- <DropdownMenuItem>Redeploy</DropdownMenuItem>
145
- <DropdownMenuItem className="text-red-600">
146
- Cancel
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 React, { useState } from "react"
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 { getBuildStatus, MOCK_DEPLOYMENTS, PackageBuild, StatusIcon } from "."
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
- interface ConnectedRepoCardProps {
12
- ConnectedRepo: PackageBuild
13
- className?: string
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 ConnectedRepoCard = ({
17
- ConnectedRepo,
50
+ export const ConnectedPackageCard = ({
51
+ pkg,
18
52
  className,
19
- }: ConnectedRepoCardProps) => {
20
- const { status, label } = getBuildStatus(ConnectedRepo)
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/${ConnectedRepo.commit_author}/tsc-deploy`}
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
- {ConnectedRepo.commit_author}/tsc-deploy
107
+ {pkg.github_repo_full_name}
71
108
  </a>
72
109
  </div>
73
110
 
74
- {ConnectedRepo.commit_message && (
111
+ {latestBuildInfo.commit_message && (
75
112
  <div className="mb-6 flex-1">
76
113
  <h4
77
- title={ConnectedRepo.commit_message}
114
+ title={latestBuildInfo.commit_message}
78
115
  className="text-sm font-medium truncate text-gray-900 mb-2"
79
116
  >
80
- {ConnectedRepo.commit_message}
117
+ {latestBuildInfo.commit_message}
81
118
  </h4>
82
119
  <div className="flex items-center gap-2 text-xs text-gray-500">
83
- <span>{formatTimeAgo(ConnectedRepo.created_at)} on</span>
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
- {ConnectedRepo.branch_name || "main"}
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/${ConnectedRepo.package_build_id}`}
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
- {ConnectedRepo.preview_url && status === "success" && (
143
+ {latestBuildInfo.preview_url && status === "success" && (
107
144
  <PrefetchPageLink
108
145
  className="w-full"
109
- href={`/build/${ConnectedRepo.package_build_id}/preview`}
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 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
- }
158
+ export const ConnectedPackagesList = ({
159
+ packages,
160
+ }: { packages: Package[] }) => {
161
+ const [pkgs, setpkgs] = useState(MOCK_DEPLOYMENTS)
166
162
 
167
- if (ConnectedRepos.length === 0) {
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
- {ConnectedRepos.map((repo) => (
186
- <ConnectedRepoCard key={repo.package_build_id} ConnectedRepo={repo} />
181
+ {packages.map((pkg) => (
182
+ <ConnectedPackageCard key={pkg.package_id} pkg={pkg} />
187
183
  ))}
188
184
  </div>
189
185
  </div>