@tscircuit/fake-snippets 0.0.108 → 0.0.110
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 +31 -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 +99 -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 +389 -450
- package/bunfig.toml +2 -1
- package/dist/bundle.js +1255 -625
- package/dist/index.d.ts +296 -4
- package/dist/index.js +325 -24
- package/dist/schema.d.ts +282 -1
- package/dist/schema.js +54 -2
- package/fake-snippets-api/lib/db/autoload-dev-packages.ts +31 -20
- package/fake-snippets-api/lib/db/db-client.ts +214 -3
- package/fake-snippets-api/lib/db/schema.ts +62 -0
- package/fake-snippets-api/lib/db/seed.ts +100 -0
- package/fake-snippets-api/lib/middleware/with-session-auth.ts +1 -1
- 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 +32 -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 +46 -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 +67 -0
- package/fake-snippets-api/routes/api/orgs/remove_member.ts +46 -0
- package/fake-snippets-api/routes/api/orgs/update.ts +93 -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 +54 -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 +27 -24
- package/renovate.json +1 -1
- package/scripts/generate-sitemap.ts +1 -1
- package/src/App.tsx +29 -10
- 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 +133 -36
- package/src/components/FileSidebar.tsx +41 -50
- package/src/components/Footer.tsx +8 -10
- 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 +44 -16
- package/src/components/HiddenFilesDropdown.tsx +0 -2
- package/src/components/NotFound.tsx +5 -5
- package/src/components/PackageBreadcrumb.tsx +6 -12
- package/src/components/PackageCard.tsx +0 -1
- 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/UserCard.tsx +80 -0
- package/src/components/ViewPackagePage/components/ShikiCodeViewer.tsx +20 -11
- package/src/components/ViewPackagePage/components/build-status.tsx +1 -1
- package/src/components/ViewPackagePage/components/important-files-view.tsx +174 -87
- package/src/components/ViewPackagePage/components/main-content-header.tsx +8 -4
- package/src/components/ViewPackagePage/components/main-content-view-selector.tsx +1 -2
- package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +54 -20
- package/src/components/ViewPackagePage/components/package-header.tsx +26 -37
- package/src/components/ViewPackagePage/components/preview-image-squares.tsx +11 -19
- package/src/components/ViewPackagePage/components/repo-page-content.tsx +33 -25
- 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/sidebar.tsx +0 -2
- package/src/components/ViewPackagePage/components/tab-views/files-view.tsx +18 -17
- 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/ViewPackagePage/components/theme-toggle.tsx +0 -2
- package/src/components/ViewPackagePage/hooks/use-toast.tsx +0 -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 +204 -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 +32 -46
- package/src/components/package-port/CodeEditor.tsx +28 -31
- package/src/components/package-port/CodeEditorHeader.tsx +128 -63
- 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 +53 -36
- 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-id.ts +5 -30
- package/src/hooks/use-current-package-info.ts +29 -5
- 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-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 +183 -35
- package/src/hooks/useOptimizedPackageFilesLoader.ts +136 -0
- package/src/hooks/usePackageFilesLoader.ts +2 -2
- package/src/hooks/useUpdatePackageFilesMutation.ts +15 -1
- 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/download-fns/download-kicad-files.ts +12 -11
- 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 +10 -0
- package/src/main.tsx +2 -1
- package/src/pages/authorize.tsx +0 -2
- package/src/pages/create-organization.tsx +168 -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 -7
- package/src/pages/latest.tsx +3 -0
- package/src/pages/organization-profile.tsx +199 -0
- package/src/pages/organization-settings.tsx +566 -0
- package/src/pages/package-editor.tsx +21 -21
- package/src/pages/preview-release.tsx +76 -136
- package/src/pages/quickstart.tsx +159 -123
- package/src/pages/release-detail.tsx +119 -31
- package/src/pages/search.tsx +192 -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/view-package.tsx +21 -26
- package/vite.config.ts +9 -0
- package/fake-snippets-api/routes/api/autocomplete/create_autocomplete.ts +0 -133
- package/src/components/Footer2.tsx +0 -100
- package/src/components/JLCPCBImportDialog.tsx +0 -280
- package/src/components/PackageBuildsPage/LogContent.tsx +0 -72
- package/src/components/PackageBuildsPage/PackageBuildDetailsPage.tsx +0 -115
- package/src/components/PackageBuildsPage/build-preview-content.tsx +0 -27
- 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/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/pages/package-builds.tsx +0 -33
- package/src/pages/settings.tsx +0 -25
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { TypeBadge } from "@/components/TypeBadge"
|
|
2
|
-
import { Button } from "@/components/ui/button"
|
|
3
|
-
import { useAxios } from "@/hooks/use-axios"
|
|
4
|
-
import { useCurrentSnippet } from "@/hooks/use-current-snippet"
|
|
5
|
-
import { useGlobalStore } from "@/hooks/use-global-store"
|
|
6
|
-
import { toast, useToast } from "@/hooks/use-toast"
|
|
7
|
-
import { LockClosedIcon } from "@radix-ui/react-icons"
|
|
8
|
-
import { Snippet } from "fake-snippets-api/lib/db/schema"
|
|
9
|
-
import { ChevronLeft, Eye, GitFork, Star } from "lucide-react"
|
|
10
|
-
import { useEffect, useState } from "react"
|
|
11
|
-
import { useMutation, useQueryClient } from "react-query"
|
|
12
|
-
import { Link } from "wouter"
|
|
13
|
-
import { navigate } from "wouter/use-browser-location"
|
|
14
|
-
|
|
15
|
-
export default function ViewSnippetHeader() {
|
|
16
|
-
const { snippet } = useCurrentSnippet()
|
|
17
|
-
const axios = useAxios()
|
|
18
|
-
const qc = useQueryClient()
|
|
19
|
-
const session = useGlobalStore((s) => s.session)
|
|
20
|
-
const [isStarred, setIsStarred] = useState(snippet?.is_starred || false)
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
setIsStarred(snippet?.is_starred || false)
|
|
24
|
-
}, [snippet?.is_starred])
|
|
25
|
-
|
|
26
|
-
const useForkSnippetMutation = ({
|
|
27
|
-
snippet,
|
|
28
|
-
onSuccess,
|
|
29
|
-
}: {
|
|
30
|
-
snippet: Snippet
|
|
31
|
-
onSuccess?: (forkedSnippet: Snippet) => void
|
|
32
|
-
}) => {
|
|
33
|
-
const axios = useAxios()
|
|
34
|
-
const session = useGlobalStore((s) => s.session)
|
|
35
|
-
|
|
36
|
-
return useMutation(
|
|
37
|
-
["createForkSnippet"],
|
|
38
|
-
async () => {
|
|
39
|
-
if (!session) throw new Error("No session")
|
|
40
|
-
if (!snippet) throw new Error("No snippet to fork")
|
|
41
|
-
|
|
42
|
-
const { data } = await axios.post("/snippets/create", {
|
|
43
|
-
unscoped_name: snippet.unscoped_name,
|
|
44
|
-
snippet_type: snippet.snippet_type,
|
|
45
|
-
owner_name: session.github_username,
|
|
46
|
-
code: snippet.code,
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
if (!data.ok) {
|
|
50
|
-
throw new Error(
|
|
51
|
-
data.error || "Unknown error occurred while forking snippet.",
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return data.snippet
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
onSuccess: (forkedSnippet: Snippet) => {
|
|
59
|
-
toast({
|
|
60
|
-
title: `Forked snippet`,
|
|
61
|
-
description: `You have successfully forked the snippet. Redirecting...`,
|
|
62
|
-
})
|
|
63
|
-
onSuccess?.(forkedSnippet)
|
|
64
|
-
},
|
|
65
|
-
onError: (error: any) => {
|
|
66
|
-
const message =
|
|
67
|
-
error?.data?.error?.message ||
|
|
68
|
-
error.message ||
|
|
69
|
-
"Failed to fork snippet. Please try again."
|
|
70
|
-
if (message.includes("already forked")) {
|
|
71
|
-
toast({
|
|
72
|
-
title: "Snippet already exists",
|
|
73
|
-
description: message,
|
|
74
|
-
variant: "destructive",
|
|
75
|
-
})
|
|
76
|
-
} else {
|
|
77
|
-
toast({
|
|
78
|
-
title: "Error",
|
|
79
|
-
description: message,
|
|
80
|
-
variant: "destructive",
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
console.error("Error forking snippet:", error)
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const { mutate: forkSnippet, isLoading: isForking } = useForkSnippetMutation({
|
|
90
|
-
snippet: snippet!,
|
|
91
|
-
onSuccess: (forkedSnippet) => {
|
|
92
|
-
navigate("/editor?snippet_id=" + forkedSnippet.snippet_id)
|
|
93
|
-
},
|
|
94
|
-
})
|
|
95
|
-
const handleStarClick = async () => {
|
|
96
|
-
try {
|
|
97
|
-
if (isStarred) {
|
|
98
|
-
await axios.post("/snippets/remove_star", {
|
|
99
|
-
snippet_id: snippet!.snippet_id,
|
|
100
|
-
})
|
|
101
|
-
setIsStarred(false)
|
|
102
|
-
toast({
|
|
103
|
-
title: "Unstarred!",
|
|
104
|
-
description: "You've unstarred this snippet",
|
|
105
|
-
})
|
|
106
|
-
} else {
|
|
107
|
-
await axios.post("/snippets/add_star", {
|
|
108
|
-
snippet_id: snippet!.snippet_id,
|
|
109
|
-
})
|
|
110
|
-
setIsStarred(true)
|
|
111
|
-
toast({
|
|
112
|
-
title: "Starred!",
|
|
113
|
-
description: "You've starred this snippet",
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
qc.invalidateQueries(["snippets", snippet!.snippet_id])
|
|
117
|
-
} catch (error: any) {
|
|
118
|
-
toast({
|
|
119
|
-
title: "Error",
|
|
120
|
-
description: `Failed to ${isStarred ? "unstar" : "star"} snippet`,
|
|
121
|
-
variant: "destructive",
|
|
122
|
-
})
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<header className="bg-white border-b border-gray-200 py-4 px-6">
|
|
128
|
-
<div className="flex items-center justify-between">
|
|
129
|
-
<div className="flex items-center">
|
|
130
|
-
<h1 className="text-xl font-bold mr-2">
|
|
131
|
-
<Link href={`/${snippet?.owner_name}`} className="text-blue-600">
|
|
132
|
-
{snippet?.owner_name}
|
|
133
|
-
</Link>
|
|
134
|
-
<span className="px-1 text-gray-500">/</span>
|
|
135
|
-
<Link
|
|
136
|
-
className="text-blue-600"
|
|
137
|
-
href={`/${snippet?.owner_name}/${snippet?.unscoped_name}`}
|
|
138
|
-
>
|
|
139
|
-
{snippet?.unscoped_name}
|
|
140
|
-
</Link>
|
|
141
|
-
</h1>
|
|
142
|
-
{snippet?.snippet_type && <TypeBadge type={snippet.snippet_type} />}
|
|
143
|
-
{snippet?.is_private && (
|
|
144
|
-
<div className="relative group pl-2">
|
|
145
|
-
<LockClosedIcon className="h-4 w-4 text-gray-700" />
|
|
146
|
-
<span className="absolute bottom-full left-1/2 transform -translate-x-1/2 mb-1 hidden group-hover:block bg-black text-white text-xs rounded py-1 px-2">
|
|
147
|
-
private
|
|
148
|
-
</span>
|
|
149
|
-
</div>
|
|
150
|
-
)}
|
|
151
|
-
</div>
|
|
152
|
-
<div className="flex items-center space-x-2">
|
|
153
|
-
<Button variant="outline" size="sm" onClick={handleStarClick}>
|
|
154
|
-
<Star
|
|
155
|
-
className={`w-4 h-4 mr-2 ${isStarred ? "fill-yellow-500 text-yellow-500" : ""}`}
|
|
156
|
-
/>
|
|
157
|
-
{isStarred ? "Starred" : "Star"}
|
|
158
|
-
{snippet!.star_count > 0 && (
|
|
159
|
-
<span className="ml-1.5 bg-gray-100 text-gray-700 rounded-full px-1.5 py-0.5 text-xs font-medium">
|
|
160
|
-
{snippet!.star_count}
|
|
161
|
-
</span>
|
|
162
|
-
)}
|
|
163
|
-
</Button>
|
|
164
|
-
{/* <Button variant="outline" size="sm">
|
|
165
|
-
<Eye className="w-4 h-4 mr-2" />
|
|
166
|
-
Watch
|
|
167
|
-
</Button> */}
|
|
168
|
-
|
|
169
|
-
<Button variant="outline" size="sm" onClick={() => forkSnippet()}>
|
|
170
|
-
<GitFork className="w-4 h-4 mr-2" />
|
|
171
|
-
{snippet?.owner_name === session?.github_username ? "Save" : "Fork"}
|
|
172
|
-
</Button>
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
{/* <div className="mt-4 flex justify-end items-center text-sm text-gray-500">
|
|
176
|
-
<span className="mr-4">Last updated: 2 days ago</span>
|
|
177
|
-
<span>Version: 1.0.0</span>
|
|
178
|
-
</div> */}
|
|
179
|
-
</header>
|
|
180
|
-
)
|
|
181
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { DashIcon } from "@radix-ui/react-icons"
|
|
3
|
-
import { OTPInput, OTPInputContext } from "input-otp"
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils"
|
|
6
|
-
|
|
7
|
-
const InputOTP = React.forwardRef<
|
|
8
|
-
React.ElementRef<typeof OTPInput>,
|
|
9
|
-
React.ComponentPropsWithoutRef<typeof OTPInput>
|
|
10
|
-
>(({ className, containerClassName, ...props }, ref) => (
|
|
11
|
-
<OTPInput
|
|
12
|
-
ref={ref}
|
|
13
|
-
containerClassName={cn(
|
|
14
|
-
"flex items-center gap-2 has-[:disabled]:opacity-50",
|
|
15
|
-
containerClassName,
|
|
16
|
-
)}
|
|
17
|
-
className={cn("disabled:cursor-not-allowed", className)}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
))
|
|
21
|
-
InputOTP.displayName = "InputOTP"
|
|
22
|
-
|
|
23
|
-
const InputOTPGroup = React.forwardRef<
|
|
24
|
-
React.ElementRef<"div">,
|
|
25
|
-
React.ComponentPropsWithoutRef<"div">
|
|
26
|
-
>(({ className, ...props }, ref) => (
|
|
27
|
-
<div ref={ref} className={cn("flex items-center", className)} {...props} />
|
|
28
|
-
))
|
|
29
|
-
InputOTPGroup.displayName = "InputOTPGroup"
|
|
30
|
-
|
|
31
|
-
const InputOTPSlot = React.forwardRef<
|
|
32
|
-
React.ElementRef<"div">,
|
|
33
|
-
React.ComponentPropsWithoutRef<"div"> & { index: number }
|
|
34
|
-
>(({ index, className, ...props }, ref) => {
|
|
35
|
-
const inputOTPContext = React.useContext(OTPInputContext)
|
|
36
|
-
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<div
|
|
40
|
-
ref={ref}
|
|
41
|
-
className={cn(
|
|
42
|
-
"relative flex h-9 w-9 items-center justify-center border-y border-r border-slate-200 text-sm shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md dark:border-slate-800",
|
|
43
|
-
isActive && "z-10 ring-1 ring-slate-950 dark:ring-slate-300",
|
|
44
|
-
className,
|
|
45
|
-
)}
|
|
46
|
-
{...props}
|
|
47
|
-
>
|
|
48
|
-
{char}
|
|
49
|
-
{hasFakeCaret && (
|
|
50
|
-
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
51
|
-
<div className="h-4 w-px animate-caret-blink bg-slate-950 duration-1000 dark:bg-slate-50" />
|
|
52
|
-
</div>
|
|
53
|
-
)}
|
|
54
|
-
</div>
|
|
55
|
-
)
|
|
56
|
-
})
|
|
57
|
-
InputOTPSlot.displayName = "InputOTPSlot"
|
|
58
|
-
|
|
59
|
-
const InputOTPSeparator = React.forwardRef<
|
|
60
|
-
React.ElementRef<"div">,
|
|
61
|
-
React.ComponentPropsWithoutRef<"div">
|
|
62
|
-
>(({ ...props }, ref) => (
|
|
63
|
-
<div ref={ref} role="separator" {...props}>
|
|
64
|
-
<DashIcon />
|
|
65
|
-
</div>
|
|
66
|
-
))
|
|
67
|
-
InputOTPSeparator.displayName = "InputOTPSeparator"
|
|
68
|
-
|
|
69
|
-
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CodeAndPreview } from "@/components/package-port/CodeAndPreview"
|
|
2
|
-
import Footer from "@/components/Footer"
|
|
3
|
-
import Header from "@/components/Header"
|
|
4
|
-
import { usePackage } from "@/hooks/use-package"
|
|
5
|
-
import { Helmet } from "react-helmet-async"
|
|
6
|
-
import { useCurrentPackageId } from "@/hooks/use-current-package-id"
|
|
7
|
-
import { NotFound } from "@/components/NotFound"
|
|
8
|
-
import { ErrorOutline } from "@/components/ErrorOutline"
|
|
9
|
-
import { PackageBuildDetailsPage } from "@/components/PackageBuildsPage/PackageBuildDetailsPage"
|
|
10
|
-
|
|
11
|
-
export const EditorPage = () => {
|
|
12
|
-
const { packageId } = useCurrentPackageId()
|
|
13
|
-
const { data: pkg, error } = usePackage(packageId)
|
|
14
|
-
const uuid4RegExp = new RegExp(
|
|
15
|
-
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div className="overflow-x-hidden">
|
|
20
|
-
<Helmet>
|
|
21
|
-
<title>{pkg ? `${pkg.name} Package Builds` : "Package Builds"}</title>
|
|
22
|
-
{pkg && (
|
|
23
|
-
<>
|
|
24
|
-
<meta property="og:title" content={`${pkg.name} Package Builds`} />
|
|
25
|
-
</>
|
|
26
|
-
)}
|
|
27
|
-
</Helmet>
|
|
28
|
-
<Header />
|
|
29
|
-
<PackageBuildDetailsPage />
|
|
30
|
-
<Footer />
|
|
31
|
-
</div>
|
|
32
|
-
)
|
|
33
|
-
}
|
package/src/pages/settings.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import Header from "@/components/Header"
|
|
2
|
-
import Footer from "@/components/Footer"
|
|
3
|
-
import ShippingInformationForm from "@/components/ShippingInformationForm"
|
|
4
|
-
|
|
5
|
-
export const SettingsPage = () => {
|
|
6
|
-
return (
|
|
7
|
-
<div>
|
|
8
|
-
<Header />
|
|
9
|
-
<div className="container mx-auto px-4 py-8">
|
|
10
|
-
<h1 className="text-3xl font-bold mb-6">Settings</h1>
|
|
11
|
-
<div className="flex">
|
|
12
|
-
<div className="lg:w-1/2 sm:w-full pr-4">
|
|
13
|
-
<div className="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4">
|
|
14
|
-
<h2 className="text-2xl font-semibold mb-4">
|
|
15
|
-
Shipping Information
|
|
16
|
-
</h2>
|
|
17
|
-
<ShippingInformationForm />
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
<Footer />
|
|
23
|
-
</div>
|
|
24
|
-
)
|
|
25
|
-
}
|