@tscircuit/fake-snippets 0.0.109 → 0.0.111
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/.github/workflows/bun-formatcheck.yml +2 -2
- package/.github/workflows/bun-pver-release.yml +3 -3
- package/.github/workflows/bun-test.yml +1 -1
- package/.github/workflows/bun-typecheck.yml +2 -2
- package/.github/workflows/update-snapshots.yml +1 -1
- package/README.md +4 -0
- package/api/generated-index.js +37 -3
- package/biome.json +2 -1
- package/bun-tests/fake-snippets-api/fixtures/get-test-server.ts +32 -3
- package/bun-tests/fake-snippets-api/fixtures/preload.ts +18 -0
- package/bun-tests/fake-snippets-api/routes/orgs/add_member.test.ts +26 -0
- package/bun-tests/fake-snippets-api/routes/orgs/create.test.ts +37 -0
- package/bun-tests/fake-snippets-api/routes/orgs/get.test.ts +52 -0
- package/bun-tests/fake-snippets-api/routes/orgs/list.test.ts +17 -0
- package/bun-tests/fake-snippets-api/routes/orgs/list_members.test.ts +23 -0
- package/bun-tests/fake-snippets-api/routes/orgs/remove_member.test.ts +81 -0
- package/bun-tests/fake-snippets-api/routes/orgs/update.test.ts +151 -0
- package/bun-tests/fake-snippets-api/routes/package_builds/get.test.ts +1 -1
- package/bun-tests/fake-snippets-api/routes/package_files/create.test.ts +15 -13
- package/bun-tests/fake-snippets-api/routes/package_files/create_or_update.test.ts +26 -24
- package/bun-tests/fake-snippets-api/routes/package_files/delete.test.ts +9 -9
- package/bun-tests/fake-snippets-api/routes/package_files/download.test.ts +4 -4
- package/bun-tests/fake-snippets-api/routes/package_files/get.test.ts +38 -28
- package/bun-tests/fake-snippets-api/routes/package_files/list.test.ts +23 -15
- package/bun-tests/fake-snippets-api/routes/package_releases/create.test.ts +33 -0
- package/bun-tests/fake-snippets-api/routes/package_releases/get.test.ts +4 -4
- package/bun-tests/fake-snippets-api/routes/package_releases/get_image_generation_fields.test.ts +38 -0
- package/bun-tests/fake-snippets-api/routes/packages/create.test.ts +19 -0
- package/bun-tests/fake-snippets-api/routes/packages/fork.test.ts +3 -4
- package/bun-tests/fake-snippets-api/routes/packages/get.test.ts +30 -0
- package/bun-tests/fake-snippets-api/routes/packages/images.test.ts +4 -2
- package/bun-tests/fake-snippets-api/routes/packages/list-1.test.ts +34 -0
- package/bun.lock +361 -453
- package/bunfig.toml +2 -1
- package/dist/bundle.js +1313 -639
- package/dist/index.d.ts +313 -6
- package/dist/index.js +328 -24
- package/dist/schema.d.ts +290 -1
- package/dist/schema.js +54 -1
- package/fake-snippets-api/lib/db/autoload-dev-packages.ts +31 -20
- package/fake-snippets-api/lib/db/db-client.ts +219 -4
- package/fake-snippets-api/lib/db/schema.ts +63 -1
- package/fake-snippets-api/lib/db/seed.ts +100 -0
- package/fake-snippets-api/lib/middleware/with-session-auth.ts +60 -8
- package/fake-snippets-api/lib/package_file/get-package-file-id-from-file-descriptor.ts +2 -2
- package/fake-snippets-api/lib/public-mapping/public-map-org.ts +33 -0
- package/fake-snippets-api/lib/public-mapping/public-map-package-build.ts +10 -0
- package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +17 -0
- package/fake-snippets-api/routes/api/orgs/add_member.ts +52 -0
- package/fake-snippets-api/routes/api/orgs/create.ts +48 -0
- package/fake-snippets-api/routes/api/orgs/get.ts +39 -0
- package/fake-snippets-api/routes/api/orgs/list.ts +31 -0
- package/fake-snippets-api/routes/api/orgs/list_members.ts +60 -0
- package/fake-snippets-api/routes/api/orgs/remove_member.ts +46 -0
- package/fake-snippets-api/routes/api/orgs/update.ts +118 -0
- package/fake-snippets-api/routes/api/package_files/get.ts +3 -6
- package/fake-snippets-api/routes/api/package_files/list.ts +7 -4
- package/fake-snippets-api/routes/api/packages/create.ts +57 -10
- package/fake-snippets-api/routes/api/packages/get.ts +23 -0
- package/fake-snippets-api/routes/api/packages/images/[owner_github_username]/[unscoped_name]/[view_format].ts +13 -11
- package/fake-snippets-api/routes/api/packages/list.ts +29 -2
- package/fake-snippets-api/routes/api/packages/update_ai_description.ts +37 -0
- package/package.json +25 -19
- package/renovate.json +1 -1
- package/scripts/generate-sitemap.ts +1 -1
- package/src/App.tsx +27 -8
- package/src/ContextProviders.tsx +25 -2
- package/src/components/CircuitJsonImportDialog.tsx +1 -1
- package/src/components/CmdKMenu.tsx +281 -247
- package/src/components/DownloadButtonAndMenu.tsx +17 -5
- package/src/components/FileSidebar.tsx +11 -17
- package/src/components/Footer.tsx +8 -9
- package/src/components/Header.tsx +19 -32
- package/src/components/Header2.tsx +16 -32
- package/src/components/HeaderDropdown.tsx +13 -8
- package/src/components/HeaderLogin.tsx +43 -15
- package/src/components/NotFound.tsx +5 -5
- package/src/components/PackageBreadcrumb.tsx +6 -12
- package/src/components/PackageSearchResults.tsx +1 -1
- package/src/components/PrefetchPageLink.tsx +7 -1
- package/src/components/ProfileRouter.tsx +32 -0
- package/src/components/SearchComponent.tsx +12 -8
- package/src/components/SentryNotFoundReporter.tsx +44 -0
- package/src/components/UserCard.tsx +80 -0
- package/src/components/ViewPackagePage/components/build-status.tsx +1 -1
- package/src/components/ViewPackagePage/components/important-files-view.tsx +105 -34
- package/src/components/ViewPackagePage/components/main-content-header.tsx +10 -6
- package/src/components/ViewPackagePage/components/main-content-view-selector.tsx +1 -1
- package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +54 -19
- package/src/components/ViewPackagePage/components/package-header.tsx +25 -33
- package/src/components/ViewPackagePage/components/preview-image-squares.tsx +11 -18
- package/src/components/ViewPackagePage/components/repo-page-content.tsx +12 -5
- package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +16 -10
- package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +11 -11
- package/src/components/ViewPackagePage/components/tab-views/pcb-view.tsx +1 -2
- package/src/components/ViewPackagePage/components/tab-views/schematic-view.tsx +2 -1
- package/src/components/dialogs/GitHubRepositorySelector.tsx +56 -49
- package/src/components/dialogs/edit-package-details-dialog.tsx +5 -6
- package/src/components/dialogs/import-component-dialog.tsx +16 -9
- package/src/components/dialogs/import-package-dialog.tsx +3 -2
- package/src/components/dialogs/new-package-save-prompt-dialog.tsx +190 -0
- package/src/components/organization/OrganizationCard.tsx +206 -0
- package/src/components/organization/OrganizationCardSkeleton.tsx +55 -0
- package/src/components/organization/OrganizationHeader.tsx +154 -0
- package/src/components/organization/OrganizationMembers.tsx +146 -0
- package/src/components/package-port/CodeAndPreview.tsx +15 -12
- package/src/components/package-port/CodeEditor.tsx +4 -30
- package/src/components/package-port/CodeEditorHeader.tsx +123 -61
- package/src/components/package-port/EditorNav.tsx +32 -49
- package/src/components/preview/ConnectedPackagesList.tsx +8 -8
- package/src/components/preview/ConnectedRepoOverview.tsx +102 -2
- package/src/components/preview/PackageReleasesDashboard.tsx +23 -11
- package/src/components/ui/tree-view.tsx +6 -3
- package/src/hooks/use-add-org-member-mutation.ts +51 -0
- package/src/hooks/use-create-org-mutation.ts +38 -0
- package/src/hooks/use-create-package-mutation.ts +3 -0
- package/src/hooks/use-current-package-release.ts +4 -3
- package/src/hooks/use-download-zip.ts +2 -2
- package/src/hooks/use-global-store.ts +6 -4
- package/src/hooks/use-hydration.ts +30 -0
- package/src/hooks/use-jlcpcb-component-import.tsx +164 -0
- package/src/hooks/use-list-org-members.ts +27 -0
- package/src/hooks/use-list-user-orgs.ts +25 -0
- package/src/hooks/use-org-by-github-handle.ts +26 -0
- package/src/hooks/use-org.ts +24 -0
- package/src/hooks/use-organization.ts +42 -0
- package/src/hooks/use-package-as-snippet.ts +4 -2
- package/src/hooks/use-package-builds.ts +6 -2
- package/src/hooks/use-package-files.ts +5 -3
- package/src/hooks/use-package-release-by-id-or-version.ts +29 -20
- package/src/hooks/use-package-release-images.ts +105 -0
- package/src/hooks/use-package-release.ts +2 -2
- package/src/hooks/use-package-stars.ts +80 -4
- package/src/hooks/use-preview-images.ts +6 -3
- package/src/hooks/use-remove-org-member-mutation.ts +32 -0
- package/src/hooks/use-update-ai-description-mutation.ts +42 -0
- package/src/hooks/use-update-org-mutation.ts +41 -0
- package/src/hooks/use-warn-user-on-page-change.ts +71 -4
- package/src/hooks/useFileManagement.ts +51 -22
- package/src/hooks/useOptimizedPackageFilesLoader.ts +11 -24
- package/src/hooks/usePackageFilesLoader.ts +2 -2
- package/src/hooks/useUpdatePackageFilesMutation.ts +13 -1
- package/src/lib/download-fns/download-gltf-from-circuit-json.ts +1 -1
- package/src/lib/download-fns/download-kicad-files.ts +22 -11
- package/src/lib/download-fns/download-step.ts +12 -0
- package/src/lib/normalize-svg-for-tile.ts +50 -0
- package/src/lib/posthog.ts +11 -9
- package/src/lib/react-query-api-failure-tracking.ts +148 -0
- package/src/lib/sentry.ts +14 -0
- package/src/lib/templates/blank-circuit-board-template.ts +0 -4
- package/src/lib/ts-lib-cache.ts +122 -7
- package/src/lib/utils/checkIfManualEditsImported.ts +4 -4
- package/src/lib/utils/findTargetFile.ts +45 -10
- package/src/lib/utils/isComponentExported.ts +2 -1
- package/src/main.tsx +2 -1
- package/src/pages/create-organization.tsx +169 -0
- package/src/pages/dashboard.tsx +38 -6
- package/src/pages/datasheet.tsx +1 -1
- package/src/pages/datasheets.tsx +3 -3
- package/src/pages/editor.tsx +4 -6
- package/src/pages/landing.tsx +6 -6
- package/src/pages/latest.tsx +3 -0
- package/src/pages/organization-profile.tsx +199 -0
- package/src/pages/organization-settings.tsx +569 -0
- package/src/pages/package-editor.tsx +21 -21
- package/src/pages/preview-release.tsx +75 -145
- package/src/pages/quickstart.tsx +159 -123
- package/src/pages/release-detail.tsx +119 -31
- package/src/pages/search.tsx +197 -57
- package/src/pages/settings-redirect.tsx +44 -0
- package/src/pages/trending.tsx +29 -20
- package/src/pages/user-profile.tsx +58 -7
- package/src/pages/user-settings.tsx +161 -0
- package/src/pages/view-package.tsx +30 -16
- package/vite.config.ts +9 -0
- package/fake-snippets-api/routes/api/autocomplete/create_autocomplete.ts +0 -133
- package/src/components/JLCPCBImportDialog.tsx +0 -280
- package/src/components/PackageBuildsPage/LogContent.tsx +0 -72
- package/src/components/PackageBuildsPage/PackageBuildDetailsPage.tsx +0 -113
- package/src/components/PackageBuildsPage/build-preview-content.tsx +0 -56
- package/src/components/PackageBuildsPage/collapsible-section.tsx +0 -63
- package/src/components/PackageBuildsPage/package-build-details-panel.tsx +0 -166
- package/src/components/PackageBuildsPage/package-build-header.tsx +0 -79
- package/src/components/PageSearchComponent.tsx +0 -148
- package/src/pages/package-builds.tsx +0 -33
|
@@ -2,19 +2,16 @@ import { useEffect, useState } from "react"
|
|
|
2
2
|
import { useParams } from "wouter"
|
|
3
3
|
import { Loader2, ChevronLeft, ChevronRight } from "lucide-react"
|
|
4
4
|
import Header from "@/components/Header"
|
|
5
|
-
import { SuspenseRunFrame } from "@/components/SuspenseRunFrame"
|
|
6
|
-
import { TreeView } from "@/components/ui/tree-view"
|
|
7
|
-
import { transformFilesToTreeData } from "@/lib/utils/transformFilesToTreeData"
|
|
8
5
|
import { cn } from "@/lib/utils"
|
|
9
|
-
import {
|
|
6
|
+
import { Link } from "wouter"
|
|
10
7
|
import NotFoundPage from "./404"
|
|
11
8
|
import { getBuildStatus } from "@/components/preview"
|
|
12
9
|
import { usePackageReleaseById } from "@/hooks/use-package-release"
|
|
13
|
-
import { usePackageFilesLoader } from "@/hooks/usePackageFilesLoader"
|
|
14
10
|
import { usePackageBuild } from "@/hooks/use-package-builds"
|
|
15
11
|
import { PackageBuild } from "fake-snippets-api/lib/db/schema"
|
|
16
12
|
import { usePackageByName } from "@/hooks/use-package-by-package-name"
|
|
17
|
-
import {
|
|
13
|
+
import { RunFrameStaticBuildViewer } from "@tscircuit/runframe/runner"
|
|
14
|
+
import { useApiBaseUrl } from "@/hooks/use-packages-base-api-url"
|
|
18
15
|
|
|
19
16
|
const StatusPill = ({ status }: { status: string }) => {
|
|
20
17
|
const color =
|
|
@@ -28,6 +25,17 @@ const StatusPill = ({ status }: { status: string }) => {
|
|
|
28
25
|
return <span className={cn("inline-block w-2 h-2 rounded-full", color)} />
|
|
29
26
|
}
|
|
30
27
|
|
|
28
|
+
const fetchCircuitJson = async (fileRef: {
|
|
29
|
+
filePath: string
|
|
30
|
+
fileStaticAssetUrl: string
|
|
31
|
+
}): Promise<object> => {
|
|
32
|
+
const res = await fetch(String(fileRef.fileStaticAssetUrl))
|
|
33
|
+
const resJson = await res.json()
|
|
34
|
+
const circuitJson = JSON.parse(resJson.package_file.content_text)
|
|
35
|
+
console.log(circuitJson)
|
|
36
|
+
return circuitJson
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
export default function PreviewBuildPage() {
|
|
32
40
|
const params = useParams<{
|
|
33
41
|
packageReleaseId: string
|
|
@@ -39,9 +47,8 @@ export default function PreviewBuildPage() {
|
|
|
39
47
|
const packageName = params?.packageName || null
|
|
40
48
|
|
|
41
49
|
const [sidebarCollapsed, setSidebarCollapsed] = useState(true)
|
|
42
|
-
const [selectedFile, setSelectedFile] = useState<string | null>(null)
|
|
43
|
-
const [selectedItemId, setSelectedItemId] = useState<string>("")
|
|
44
50
|
|
|
51
|
+
const apiUrl = useApiBaseUrl()
|
|
45
52
|
const { data: packageRelease, isLoading: isLoadingRelease } =
|
|
46
53
|
usePackageReleaseById(packageReleaseId)
|
|
47
54
|
const { data: pkg, isLoading: isLoadingPackage } = usePackageByName(
|
|
@@ -50,21 +57,8 @@ export default function PreviewBuildPage() {
|
|
|
50
57
|
const { data: build, isLoading: isLoadingBuild } = usePackageBuild(
|
|
51
58
|
packageRelease?.latest_package_build_id || null,
|
|
52
59
|
)
|
|
53
|
-
const { data: buildFiles = [], isLoading: isLoadingFiles } =
|
|
54
|
-
usePackageFilesLoader(pkg)
|
|
55
|
-
|
|
56
|
-
const buildFsMap = Object.fromEntries(
|
|
57
|
-
buildFiles.map((f) => [f.path, f.content]),
|
|
58
|
-
)
|
|
59
60
|
|
|
60
|
-
const
|
|
61
|
-
const mainComponentPath = targetFile?.path ?? null
|
|
62
|
-
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (!selectedFile && mainComponentPath) {
|
|
65
|
-
setSelectedFile(mainComponentPath)
|
|
66
|
-
}
|
|
67
|
-
}, [mainComponentPath, selectedFile])
|
|
61
|
+
const isLoading = isLoadingRelease || isLoadingPackage || isLoadingBuild
|
|
68
62
|
|
|
69
63
|
if (!packageReleaseId) {
|
|
70
64
|
return <NotFoundPage heading="Package Release Not Found" />
|
|
@@ -73,29 +67,8 @@ export default function PreviewBuildPage() {
|
|
|
73
67
|
if (!packageRelease && !isLoadingRelease) {
|
|
74
68
|
return <NotFoundPage heading="Package Release Not Found" />
|
|
75
69
|
}
|
|
76
|
-
const isLoading =
|
|
77
|
-
isLoadingRelease || isLoadingPackage || isLoadingFiles || isLoadingBuild
|
|
78
|
-
|
|
79
|
-
if (!build && !isLoading) {
|
|
80
|
-
return <NotFoundPage heading="Package Build Not Found" />
|
|
81
|
-
}
|
|
82
|
-
|
|
83
70
|
const { status } = getBuildStatus(build as PackageBuild)
|
|
84
71
|
|
|
85
|
-
const treeData = transformFilesToTreeData({
|
|
86
|
-
files: buildFsMap,
|
|
87
|
-
currentFile: selectedFile ?? mainComponentPath,
|
|
88
|
-
renamingFile: null,
|
|
89
|
-
handleRenameFile: () => ({ fileRenamed: false }),
|
|
90
|
-
handleDeleteFile: () => ({ fileDeleted: false }),
|
|
91
|
-
setRenamingFile: () => {},
|
|
92
|
-
onFileSelect: setSelectedFile,
|
|
93
|
-
onFolderSelect: () => {},
|
|
94
|
-
canModifyFiles: false,
|
|
95
|
-
setErrorMessage: () => {},
|
|
96
|
-
setSelectedFolderForCreation: () => {},
|
|
97
|
-
})
|
|
98
|
-
|
|
99
72
|
return (
|
|
100
73
|
<>
|
|
101
74
|
<Header />
|
|
@@ -119,103 +92,66 @@ export default function PreviewBuildPage() {
|
|
|
119
92
|
</button>
|
|
120
93
|
|
|
121
94
|
{!sidebarCollapsed && (
|
|
122
|
-
|
|
123
|
-
<div className="
|
|
124
|
-
<div className="
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
</div>
|
|
95
|
+
<div className="p-4">
|
|
96
|
+
<div className="space-y-3">
|
|
97
|
+
<div className="flex items-center justify-between">
|
|
98
|
+
<h2 className="text-lg font-semibold text-gray-900">
|
|
99
|
+
Deployment
|
|
100
|
+
</h2>
|
|
101
|
+
<StatusPill status={status} />
|
|
102
|
+
</div>
|
|
131
103
|
|
|
132
|
-
|
|
104
|
+
<div className="space-y-2">
|
|
105
|
+
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2">
|
|
106
|
+
<span className="text-xs text-gray-500 uppercase tracking-wide">
|
|
107
|
+
ID
|
|
108
|
+
</span>
|
|
109
|
+
<Link
|
|
110
|
+
href={`/${pkg?.name}/releases/${build?.package_release_id}`}
|
|
111
|
+
title={build?.package_build_id}
|
|
112
|
+
className="font-mono text-sm truncate text-gray-900 bg-gray-100 w-full px-2 py-1 rounded"
|
|
113
|
+
>
|
|
114
|
+
{build?.package_build_id}
|
|
115
|
+
</Link>
|
|
116
|
+
</div>
|
|
117
|
+
{packageRelease?.commit_message && (
|
|
133
118
|
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2">
|
|
134
119
|
<span className="text-xs text-gray-500 uppercase tracking-wide">
|
|
135
|
-
|
|
120
|
+
Commit
|
|
136
121
|
</span>
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
122
|
+
<a
|
|
123
|
+
title={packageRelease?.commit_message}
|
|
124
|
+
target="_blank"
|
|
125
|
+
rel="noopener noreferrer"
|
|
126
|
+
href={`https://github.com/${pkg?.github_repo_full_name}/commit/${packageRelease?.commit_message}`}
|
|
127
|
+
className="font-mono text-xs text-gray-600 bg-gray-50 px-2 text-right py-1 rounded truncate"
|
|
141
128
|
>
|
|
142
|
-
{
|
|
143
|
-
</
|
|
129
|
+
{packageRelease?.commit_message}
|
|
130
|
+
</a>
|
|
144
131
|
</div>
|
|
145
|
-
|
|
146
|
-
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2">
|
|
147
|
-
<span className="text-xs text-gray-500 uppercase tracking-wide">
|
|
148
|
-
Commit
|
|
149
|
-
</span>
|
|
150
|
-
<a
|
|
151
|
-
title={packageRelease?.commit_message}
|
|
152
|
-
target="_blank"
|
|
153
|
-
rel="noopener noreferrer"
|
|
154
|
-
href={`https://github.com/${pkg?.github_repo_full_name}/commit/${packageRelease?.commit_message}`}
|
|
155
|
-
className="font-mono text-xs text-gray-600 bg-gray-50 px-2 text-right py-1 rounded truncate"
|
|
156
|
-
>
|
|
157
|
-
{packageRelease?.commit_message}
|
|
158
|
-
</a>
|
|
159
|
-
</div>
|
|
160
|
-
)}
|
|
132
|
+
)}
|
|
161
133
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
</div>
|
|
134
|
+
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2">
|
|
135
|
+
<span className="text-xs text-gray-500 uppercase tracking-wide">
|
|
136
|
+
Status
|
|
137
|
+
</span>
|
|
138
|
+
<span
|
|
139
|
+
className={`text-xs font-medium px-2 py-1 w-fit rounded-full capitalize ${
|
|
140
|
+
status === "success"
|
|
141
|
+
? "bg-emerald-100 text-emerald-800"
|
|
142
|
+
: status === "error"
|
|
143
|
+
? "bg-red-100 text-red-800"
|
|
144
|
+
: status === "building"
|
|
145
|
+
? "bg-blue-100 text-blue-800"
|
|
146
|
+
: "bg-gray-100 text-gray-800"
|
|
147
|
+
}`}
|
|
148
|
+
>
|
|
149
|
+
{status}
|
|
150
|
+
</span>
|
|
180
151
|
</div>
|
|
181
152
|
</div>
|
|
182
153
|
</div>
|
|
183
|
-
|
|
184
|
-
<div className="flex-1 overflow-hidden">
|
|
185
|
-
<div className="px-4 py-3 border-b border-gray-200">
|
|
186
|
-
<h3 className="text-sm font-semibold text-gray-900">
|
|
187
|
-
Files
|
|
188
|
-
</h3>
|
|
189
|
-
<p className="text-xs text-gray-500 mt-1">
|
|
190
|
-
{isLoadingFiles
|
|
191
|
-
? "Loading files..."
|
|
192
|
-
: `${treeData.length} file${treeData.length !== 1 ? "s" : ""}`}
|
|
193
|
-
</p>
|
|
194
|
-
</div>
|
|
195
|
-
<div className="px-2 py-2 overflow-y-auto select-none">
|
|
196
|
-
{isLoadingFiles ? (
|
|
197
|
-
<div className="flex items-center justify-center py-8">
|
|
198
|
-
<Loader2 className="w-4 h-4 animate-spin" />
|
|
199
|
-
<span className="ml-2 text-sm text-gray-500">
|
|
200
|
-
Loading files...
|
|
201
|
-
</span>
|
|
202
|
-
</div>
|
|
203
|
-
) : (
|
|
204
|
-
<TreeView
|
|
205
|
-
selectedItemId={selectedItemId || ""}
|
|
206
|
-
setSelectedItemId={(v) => setSelectedItemId(v || "")}
|
|
207
|
-
data={treeData}
|
|
208
|
-
className="w-full"
|
|
209
|
-
onSelectChange={(item) => {
|
|
210
|
-
if (item && !item.children) {
|
|
211
|
-
setSelectedFile(item.id)
|
|
212
|
-
}
|
|
213
|
-
}}
|
|
214
|
-
/>
|
|
215
|
-
)}
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
</>
|
|
154
|
+
</div>
|
|
219
155
|
)}
|
|
220
156
|
</aside>
|
|
221
157
|
|
|
@@ -228,12 +164,15 @@ export default function PreviewBuildPage() {
|
|
|
228
164
|
<p>Loading package contents...</p>
|
|
229
165
|
</div>
|
|
230
166
|
</div>
|
|
231
|
-
) : status === "success"
|
|
232
|
-
<
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
167
|
+
) : status === "success" ? (
|
|
168
|
+
<RunFrameStaticBuildViewer
|
|
169
|
+
files={[
|
|
170
|
+
{
|
|
171
|
+
filePath: "dist/circuit.json",
|
|
172
|
+
fileStaticAssetUrl: `${apiUrl}/package_files/get?file_path=dist/circuit.json&package_release_id=${build?.package_release_id}`,
|
|
173
|
+
},
|
|
174
|
+
]}
|
|
175
|
+
onFetchFile={fetchCircuitJson as any}
|
|
237
176
|
/>
|
|
238
177
|
) : (
|
|
239
178
|
<div className="flex-1 flex items-center justify-center">
|
|
@@ -248,15 +187,6 @@ export default function PreviewBuildPage() {
|
|
|
248
187
|
Build Failed
|
|
249
188
|
</p>
|
|
250
189
|
</div>
|
|
251
|
-
) : buildFiles.length === 0 ? (
|
|
252
|
-
<div className="text-center">
|
|
253
|
-
<p className="text-gray-600 font-medium mb-2">
|
|
254
|
-
No files found
|
|
255
|
-
</p>
|
|
256
|
-
<p className="text-sm text-gray-500">
|
|
257
|
-
This package release doesn't have any files to preview.
|
|
258
|
-
</p>
|
|
259
|
-
</div>
|
|
260
190
|
) : (
|
|
261
191
|
<div className="text-center p-4">
|
|
262
192
|
<p className="text-gray-600 font-medium mb-2">
|