@tscircuit/fake-snippets 0.0.107 → 0.0.109
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 +82 -22
- package/biome.json +7 -1
- package/bun-tests/fake-snippets-api/routes/package_builds/get.test.ts +0 -15
- package/bun-tests/fake-snippets-api/routes/package_builds/list.test.ts +0 -12
- package/bun.lock +62 -19
- package/dist/bundle.js +25 -24
- package/dist/index.d.ts +26 -15
- package/dist/index.js +19 -18
- package/dist/schema.d.ts +32 -24
- package/dist/schema.js +7 -6
- package/fake-snippets-api/lib/db/db-client.ts +10 -1
- package/fake-snippets-api/lib/db/schema.ts +4 -3
- package/fake-snippets-api/lib/db/seed.ts +6 -9
- package/fake-snippets-api/lib/public-mapping/public-map-package-build.ts +0 -3
- package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +3 -0
- package/package.json +7 -8
- package/src/App.tsx +12 -11
- package/src/components/DownloadButtonAndMenu.tsx +133 -35
- package/src/components/FileSidebar.tsx +45 -193
- package/src/components/Footer.tsx +0 -1
- package/src/components/HeaderLogin.tsx +1 -1
- package/src/components/HiddenFilesDropdown.tsx +0 -2
- package/src/components/PackageBreadcrumb.tsx +1 -1
- package/src/components/PackageBuildsPage/PackageBuildDetailsPage.tsx +0 -2
- package/src/components/PackageBuildsPage/build-preview-content.tsx +34 -5
- package/src/components/PackageCard.tsx +0 -1
- package/src/components/ViewPackagePage/components/ShikiCodeViewer.tsx +20 -11
- package/src/components/ViewPackagePage/components/important-files-view.tsx +75 -59
- package/src/components/ViewPackagePage/components/main-content-header.tsx +4 -4
- package/src/components/ViewPackagePage/components/main-content-view-selector.tsx +0 -1
- package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +1 -2
- package/src/components/ViewPackagePage/components/package-header.tsx +14 -17
- package/src/components/ViewPackagePage/components/preview-image-squares.tsx +0 -1
- package/src/components/ViewPackagePage/components/repo-page-content.tsx +21 -20
- package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +18 -2
- package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +1 -1
- package/src/components/ViewPackagePage/components/sidebar.tsx +0 -2
- package/src/components/ViewPackagePage/components/tab-views/files-view.tsx +18 -17
- package/src/components/ViewPackagePage/components/theme-toggle.tsx +0 -2
- package/src/components/ViewPackagePage/hooks/use-toast.tsx +0 -1
- package/src/components/package-port/CodeAndPreview.tsx +23 -40
- package/src/components/package-port/CodeEditor.tsx +24 -1
- package/src/components/package-port/CodeEditorHeader.tsx +5 -2
- package/src/components/preview/BuildsList.tsx +20 -9
- package/src/components/preview/ConnectedPackagesList.tsx +73 -60
- package/src/components/preview/ConnectedRepoOverview.tsx +160 -154
- package/src/components/preview/PackageReleasesDashboard.tsx +41 -30
- package/src/components/preview/index.tsx +16 -153
- package/src/hooks/use-current-package-id.ts +5 -30
- package/src/hooks/use-current-package-info.ts +29 -5
- package/src/hooks/use-global-store.ts +1 -1
- package/src/hooks/useFileManagement.ts +153 -34
- package/src/hooks/useOptimizedPackageFilesLoader.ts +149 -0
- package/src/hooks/useUpdatePackageFilesMutation.ts +2 -0
- package/src/index.css +24 -0
- package/src/lib/download-fns/download-circuit-png.ts +11 -3
- package/src/lib/download-fns/download-gltf-from-circuit-json.ts +44 -0
- package/src/lib/utils/isComponentExported.ts +9 -0
- package/src/lib/utils/transformFilesToTreeData.tsx +195 -0
- package/src/pages/404.tsx +3 -5
- package/src/pages/authorize.tsx +0 -2
- package/src/pages/landing.tsx +0 -1
- package/src/pages/preview-release.tsx +279 -0
- package/src/pages/release-builds.tsx +0 -8
- package/src/pages/release-detail.tsx +17 -15
- package/src/pages/releases.tsx +5 -1
- package/src/pages/view-package.tsx +14 -13
- package/src/components/Footer2.tsx +0 -100
- package/src/components/ShippingInformationForm.tsx +0 -423
- package/src/components/StaticViewSnippetHeader.tsx +0 -70
- package/src/components/ViewPackagePage/components/file-explorer.tsx +0 -67
- package/src/components/ViewPackagePage/components/readme-view.tsx +0 -58
- package/src/components/ViewPackagePage/components/repo-header-button.tsx +0 -36
- package/src/components/ViewPackagePage/components/repo-header.tsx +0 -4
- package/src/components/ViewPackagePage/components/sidebar-contributors-section.tsx +0 -31
- package/src/components/ViewSnippetHeader.tsx +0 -181
- package/src/components/ui/input-otp.tsx +0 -69
- package/src/hooks/use-snippets-base-api-url.ts +0 -3
- package/src/pages/preview-build.tsx +0 -380
- package/src/pages/settings.tsx +0 -25
|
@@ -19,16 +19,17 @@ import {
|
|
|
19
19
|
} from "@/components/ui/table"
|
|
20
20
|
import { getBuildStatus, StatusIcon } from "."
|
|
21
21
|
import { formatTimeAgo } from "@/lib/utils/formatTimeAgo"
|
|
22
|
-
import { Package } from "fake-snippets-api/lib/db/schema"
|
|
22
|
+
import { Package, PackageBuild } from "fake-snippets-api/lib/db/schema"
|
|
23
23
|
import { usePackageReleasesByPackageId } from "@/hooks/use-package-release"
|
|
24
24
|
import { useQueries } from "react-query"
|
|
25
25
|
import { useAxios } from "@/hooks/use-axios"
|
|
26
|
+
import { useLocation } from "wouter"
|
|
26
27
|
|
|
27
28
|
export const BuildsList = ({ pkg }: { pkg: Package }) => {
|
|
28
29
|
const { data: releases, isLoading: isLoadingReleases } =
|
|
29
30
|
usePackageReleasesByPackageId(pkg.package_id)
|
|
30
31
|
const axios = useAxios()
|
|
31
|
-
|
|
32
|
+
const [, setLocation] = useLocation()
|
|
32
33
|
// Get the latest build for each release to show status
|
|
33
34
|
const latestBuildQueries = useQueries(
|
|
34
35
|
(releases || [])
|
|
@@ -52,7 +53,8 @@ export const BuildsList = ({ pkg }: { pkg: Package }) => {
|
|
|
52
53
|
isLoadingReleases || latestBuildQueries.some((q) => q.isLoading)
|
|
53
54
|
|
|
54
55
|
// Create a map of release ID to latest build for easy access
|
|
55
|
-
const latestBuildsMap = new Map()
|
|
56
|
+
const latestBuildsMap = new Map<string, PackageBuild>()
|
|
57
|
+
|
|
56
58
|
latestBuildQueries.forEach((query, index) => {
|
|
57
59
|
if (query.data && releases?.[index]) {
|
|
58
60
|
latestBuildsMap.set(releases[index].package_release_id, query.data)
|
|
@@ -110,15 +112,15 @@ export const BuildsList = ({ pkg }: { pkg: Package }) => {
|
|
|
110
112
|
const latestBuild = latestBuildsMap.get(
|
|
111
113
|
release.package_release_id,
|
|
112
114
|
)
|
|
113
|
-
const { status, label } = latestBuild
|
|
114
|
-
? getBuildStatus(latestBuild)
|
|
115
|
-
: { status: "unknown", label: "No builds" }
|
|
115
|
+
const { status, label } = getBuildStatus(latestBuild)
|
|
116
116
|
return (
|
|
117
117
|
<TableRow
|
|
118
118
|
key={release.package_release_id}
|
|
119
119
|
className="cursor-pointer hover:bg-gray-50 no-scrollbar"
|
|
120
120
|
onClick={() => {
|
|
121
|
-
|
|
121
|
+
setLocation(
|
|
122
|
+
`/${pkg.name}/releases/${release.package_release_id}`,
|
|
123
|
+
)
|
|
122
124
|
}}
|
|
123
125
|
>
|
|
124
126
|
<TableCell>
|
|
@@ -196,14 +198,23 @@ export const BuildsList = ({ pkg }: { pkg: Package }) => {
|
|
|
196
198
|
<DropdownMenuContent align="end">
|
|
197
199
|
<DropdownMenuItem
|
|
198
200
|
onClick={() => {
|
|
199
|
-
window.location.href = `/${pkg.name}/
|
|
201
|
+
window.location.href = `/${pkg.name}/releases/${release.package_release_id}`
|
|
200
202
|
}}
|
|
201
203
|
>
|
|
202
204
|
View Release
|
|
203
205
|
</DropdownMenuItem>
|
|
206
|
+
{status !== "error" && (
|
|
207
|
+
<DropdownMenuItem>
|
|
208
|
+
<a
|
|
209
|
+
href={`/${pkg.name}/releases/${latestBuild?.package_release_id}/preview`}
|
|
210
|
+
>
|
|
211
|
+
Preview Release
|
|
212
|
+
</a>
|
|
213
|
+
</DropdownMenuItem>
|
|
214
|
+
)}
|
|
204
215
|
<DropdownMenuItem
|
|
205
216
|
onClick={() => {
|
|
206
|
-
window.location.href = `/${pkg.name}/
|
|
217
|
+
window.location.href = `/${pkg.name}/releases/${release.package_release_id}/builds`
|
|
207
218
|
}}
|
|
208
219
|
>
|
|
209
220
|
View All Builds
|
|
@@ -1,49 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Card, CardContent, CardHeader } from "@/components/ui/card"
|
|
1
|
+
import { Card } from "@/components/ui/card"
|
|
3
2
|
import { Badge } from "@/components/ui/badge"
|
|
4
3
|
import { Button } from "@/components/ui/button"
|
|
5
4
|
import { GitBranch, Rocket, Github } from "lucide-react"
|
|
6
5
|
import { cn } from "@/lib/utils"
|
|
7
6
|
import { PrefetchPageLink } from "../PrefetchPageLink"
|
|
8
7
|
import { formatTimeAgo } from "@/lib/utils/formatTimeAgo"
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
getLatestBuildForPackage,
|
|
12
|
-
MOCK_PACKAGE_BUILDS,
|
|
13
|
-
StatusIcon,
|
|
14
|
-
} from "."
|
|
15
|
-
import { Package, PackageBuild } from "fake-snippets-api/lib/db/schema"
|
|
8
|
+
import { getBuildStatus, StatusIcon } from "."
|
|
9
|
+
import { Package } from "fake-snippets-api/lib/db/schema"
|
|
16
10
|
import { usePackageBuild } from "@/hooks/use-package-builds"
|
|
17
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useLatestPackageRelease,
|
|
13
|
+
usePackageReleaseById,
|
|
14
|
+
} from "@/hooks/use-package-release"
|
|
18
15
|
|
|
19
16
|
export const ConnectedPackageCardSkeleton = () => {
|
|
20
17
|
return (
|
|
21
|
-
<Card
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
<Card
|
|
19
|
+
className={cn(
|
|
20
|
+
"group relative overflow-hidden",
|
|
21
|
+
"border border-gray-200",
|
|
22
|
+
"hover:border-gray-300",
|
|
23
|
+
"bg-white shadow-none",
|
|
24
|
+
"p-6",
|
|
25
|
+
"flex flex-col",
|
|
26
|
+
"min-h-[200px]",
|
|
27
|
+
"animate-pulse",
|
|
28
|
+
)}
|
|
29
|
+
>
|
|
30
|
+
<div className="flex items-start justify-between mb-4">
|
|
31
|
+
<div className="flex items-center gap-3">
|
|
32
|
+
<div className="h-6 w-32 bg-gray-200 rounded" />
|
|
34
33
|
</div>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<div className="w-16 h-3 bg-gray-200 rounded" />
|
|
40
|
-
<div className="w-20 h-3 bg-gray-200 rounded" />
|
|
34
|
+
|
|
35
|
+
<div className="flex items-center justify-center gap-2">
|
|
36
|
+
<div className="w-16 h-5 bg-gray-200 rounded-full" />
|
|
37
|
+
<div className="w-4 h-4 bg-gray-200 rounded-full" />
|
|
41
38
|
</div>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div className="flex items-center gap-2 mb-4">
|
|
42
|
+
<div className="w-4 h-4 bg-gray-200 rounded" />
|
|
43
|
+
<div className="w-48 h-5 bg-gray-200 rounded" />
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div className="mb-6 flex-1">
|
|
47
|
+
<div className="h-5 w-3/4 bg-gray-200 rounded mb-2" />
|
|
48
|
+
<div className="flex items-center gap-2">
|
|
49
|
+
<div className="w-32 h-4 bg-gray-200 rounded" />
|
|
50
|
+
<div className="flex items-center gap-1">
|
|
51
|
+
<div className="w-3 h-3 bg-gray-200 rounded" />
|
|
52
|
+
<div className="w-16 h-4 bg-gray-200 rounded-full" />
|
|
53
|
+
</div>
|
|
45
54
|
</div>
|
|
46
|
-
</
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div className="flex gap-2 w-full mt-auto">
|
|
58
|
+
<div className="w-full h-9 bg-gray-200 rounded" />
|
|
59
|
+
<div className="w-full h-9 bg-gray-200 rounded" />
|
|
60
|
+
</div>
|
|
47
61
|
</Card>
|
|
48
62
|
)
|
|
49
63
|
}
|
|
@@ -75,6 +89,10 @@ export const ConnectedPackageCard = ({
|
|
|
75
89
|
pkg.package_id,
|
|
76
90
|
)
|
|
77
91
|
|
|
92
|
+
const { data: packageRelease } = usePackageReleaseById(
|
|
93
|
+
latestBuildInfo?.package_release_id,
|
|
94
|
+
)
|
|
95
|
+
|
|
78
96
|
if (isLoading && !latestBuildInfo) {
|
|
79
97
|
return <ConnectedPackageCardSkeleton />
|
|
80
98
|
}
|
|
@@ -89,7 +107,7 @@ export const ConnectedPackageCard = ({
|
|
|
89
107
|
"group relative overflow-hidden",
|
|
90
108
|
"border border-gray-200",
|
|
91
109
|
"hover:border-gray-300",
|
|
92
|
-
"bg-white",
|
|
110
|
+
"bg-white shadow-none",
|
|
93
111
|
"p-6",
|
|
94
112
|
"flex flex-col",
|
|
95
113
|
"min-h-[200px]",
|
|
@@ -135,46 +153,41 @@ export const ConnectedPackageCard = ({
|
|
|
135
153
|
</a>
|
|
136
154
|
</div>
|
|
137
155
|
|
|
138
|
-
|
|
139
|
-
|
|
156
|
+
<div className="mb-6 flex-1">
|
|
157
|
+
{packageRelease?.commit_message && (
|
|
140
158
|
<h4
|
|
141
|
-
title={
|
|
159
|
+
title={packageRelease.commit_message}
|
|
142
160
|
className="text-sm font-medium truncate text-gray-900 mb-2"
|
|
143
161
|
>
|
|
144
|
-
{
|
|
162
|
+
{packageRelease.commit_message}
|
|
145
163
|
</h4>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
</
|
|
164
|
+
)}
|
|
165
|
+
<div className="flex items-center gap-2 text-xs text-gray-500">
|
|
166
|
+
<span>{formatTimeAgo(String(latestBuildInfo?.created_at))} on</span>
|
|
167
|
+
<div className="flex items-center gap-1">
|
|
168
|
+
<GitBranch className="w-3 h-3" />
|
|
169
|
+
<span className="bg-blue-100 text-blue-800 px-2 py-0.5 rounded-full font-medium">
|
|
170
|
+
{packageRelease?.branch_name || "main"}
|
|
171
|
+
</span>
|
|
154
172
|
</div>
|
|
155
173
|
</div>
|
|
156
|
-
|
|
174
|
+
</div>
|
|
157
175
|
|
|
158
176
|
<div className="flex gap-2 w-full mt-auto">
|
|
159
|
-
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
177
|
+
<PrefetchPageLink className="w-full" href={`/${pkg.name}/releases`}>
|
|
178
|
+
<Button
|
|
179
|
+
size="sm"
|
|
180
|
+
className="bg-blue-600 w-full hover:bg-blue-700 text-white px-4 py-2"
|
|
163
181
|
>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
>
|
|
168
|
-
View
|
|
169
|
-
</Button>
|
|
170
|
-
</PrefetchPageLink>
|
|
171
|
-
)}
|
|
182
|
+
View
|
|
183
|
+
</Button>
|
|
184
|
+
</PrefetchPageLink>
|
|
172
185
|
{latestBuildInfo?.preview_url &&
|
|
173
186
|
latestBuildInfo?.package_build_id &&
|
|
174
187
|
status === "success" && (
|
|
175
188
|
<PrefetchPageLink
|
|
176
189
|
className="w-full"
|
|
177
|
-
href={
|
|
190
|
+
href={`/${pkg.name}/releases/${latestBuildInfo.package_release_id}/preview`}
|
|
178
191
|
>
|
|
179
192
|
<Button size="sm" variant="outline" className="px-4 py-2 w-full">
|
|
180
193
|
Preview
|