@tscircuit/fake-snippets 0.0.99 → 0.0.101
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/bun.lock +302 -808
- package/dist/bundle.js +466 -414
- package/dist/index.d.ts +4 -2
- package/dist/index.js +25 -0
- package/fake-snippets-api/lib/db/db-client.ts +32 -0
- package/fake-snippets-api/routes/api/accounts/search.ts +20 -0
- package/fake-snippets-api/routes/api/packages/create.ts +14 -3
- package/package.json +7 -5
- package/src/App.tsx +58 -2
- package/src/components/CircuitJsonImportDialog.tsx +10 -5
- package/src/components/CmdKMenu.tsx +154 -19
- package/src/components/Header2.tsx +106 -25
- package/src/components/PackageBuildsPage/package-build-header.tsx +19 -15
- package/src/components/ViewPackagePage/components/important-files-view.tsx +304 -172
- package/src/components/ViewPackagePage/components/main-content-header.tsx +2 -2
- package/src/components/ViewPackagePage/components/repo-page-content.tsx +9 -0
- package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +10 -3
- package/src/components/ViewPackagePage/components/sidebar.tsx +3 -1
- package/src/components/dialogs/edit-package-details-dialog.tsx +3 -2
- package/src/components/package-port/CodeAndPreview.tsx +1 -1
- package/src/components/package-port/CodeEditor.tsx +2 -2
- package/src/components/package-port/CodeEditorHeader.tsx +20 -16
- package/src/hooks/use-create-package-mutation.ts +1 -1
- package/src/hooks/useFileManagement.ts +1 -5
- package/src/lib/utils/package-utils.ts +0 -3
- package/src/pages/landing.tsx +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button } from "@/components/ui/button"
|
|
2
|
-
import { CircuitBoard, Search } from "lucide-react"
|
|
2
|
+
import { CircuitBoard, Search, Menu, X } from "lucide-react"
|
|
3
3
|
import { Link } from "wouter"
|
|
4
4
|
import { PrefetchPageLink } from "./PrefetchPageLink"
|
|
5
5
|
import { HeaderLogin } from "./HeaderLogin"
|
|
@@ -53,10 +53,12 @@ const SearchButtonComponent = () => {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export const Header2 = () => {
|
|
56
|
+
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
|
|
56
57
|
const isLoggedIn = useGlobalStore((state) => Boolean(state.session))
|
|
58
|
+
|
|
57
59
|
return (
|
|
58
60
|
<>
|
|
59
|
-
<header className="sticky top-0 z-50 w-full border-b bg-
|
|
61
|
+
<header className="sticky top-0 z-50 w-full border-b bg-white md:bg-white/80 md:backdrop-blur supports-[backdrop-filter]:md:bg-white/60">
|
|
60
62
|
<div className="container mx-auto flex h-16 items-center justify-between px-2 md:px-6">
|
|
61
63
|
<PrefetchPageLink
|
|
62
64
|
href="/"
|
|
@@ -65,23 +67,17 @@ export const Header2 = () => {
|
|
|
65
67
|
<CircuitBoard className="h-6 w-6" />
|
|
66
68
|
<span className="text-lg font-bold">tscircuit</span>
|
|
67
69
|
</PrefetchPageLink>
|
|
68
|
-
|
|
70
|
+
|
|
71
|
+
{/* Desktop Navigation */}
|
|
72
|
+
<nav className="hidden md:flex gap-6">
|
|
69
73
|
{isLoggedIn && (
|
|
70
|
-
<
|
|
74
|
+
<PrefetchPageLink
|
|
71
75
|
className="text-sm font-medium hover:underline underline-offset-4"
|
|
72
76
|
href="/dashboard"
|
|
73
77
|
>
|
|
74
78
|
Dashboard
|
|
75
|
-
</
|
|
79
|
+
</PrefetchPageLink>
|
|
76
80
|
)}
|
|
77
|
-
</nav>
|
|
78
|
-
<nav className="hidden md:flex gap-6">
|
|
79
|
-
<PrefetchPageLink
|
|
80
|
-
className="text-sm font-medium hover:underline underline-offset-4"
|
|
81
|
-
href="/dashboard"
|
|
82
|
-
>
|
|
83
|
-
Dashboard
|
|
84
|
-
</PrefetchPageLink>
|
|
85
81
|
<PrefetchPageLink
|
|
86
82
|
className="text-sm font-medium hover:underline underline-offset-4"
|
|
87
83
|
href="/quickstart"
|
|
@@ -94,12 +90,6 @@ export const Header2 = () => {
|
|
|
94
90
|
>
|
|
95
91
|
Datasheets
|
|
96
92
|
</PrefetchPageLink>
|
|
97
|
-
{/* <a
|
|
98
|
-
className="text-sm font-medium hover:underline underline-offset-4"
|
|
99
|
-
href="https://github.com/tscircuit/tscircuit"
|
|
100
|
-
>
|
|
101
|
-
Github
|
|
102
|
-
</a> */}
|
|
103
93
|
<a
|
|
104
94
|
className="text-sm font-medium hover:underline underline-offset-4"
|
|
105
95
|
href="https://docs.tscircuit.com"
|
|
@@ -119,16 +109,107 @@ export const Header2 = () => {
|
|
|
119
109
|
Contact
|
|
120
110
|
</a>
|
|
121
111
|
</nav>
|
|
122
|
-
|
|
112
|
+
|
|
113
|
+
{/* Desktop Right Side */}
|
|
114
|
+
<div className="hidden md:flex items-center gap-4">
|
|
123
115
|
<SearchButtonComponent />
|
|
124
|
-
{isLoggedIn &&
|
|
125
|
-
<div className="hidden sm:block">
|
|
126
|
-
<HeaderDropdown />
|
|
127
|
-
</div>
|
|
128
|
-
)}
|
|
116
|
+
{isLoggedIn && <HeaderDropdown />}
|
|
129
117
|
<HeaderLogin />
|
|
130
118
|
</div>
|
|
119
|
+
|
|
120
|
+
{/* Mobile Right Side */}
|
|
121
|
+
<div className="flex md:hidden items-center gap-2">
|
|
122
|
+
<Button
|
|
123
|
+
variant="ghost"
|
|
124
|
+
size="icon"
|
|
125
|
+
onClick={() => (window.location.href = "/search")}
|
|
126
|
+
className="h-8 w-8"
|
|
127
|
+
aria-label="Go to search"
|
|
128
|
+
>
|
|
129
|
+
<Search className="size-4" />
|
|
130
|
+
</Button>
|
|
131
|
+
{isLoggedIn ? (
|
|
132
|
+
<HeaderLogin />
|
|
133
|
+
) : (
|
|
134
|
+
<PrefetchPageLink href="/quickstart">
|
|
135
|
+
<Button size="sm" className="text-xs px-3 py-1">
|
|
136
|
+
Get Started
|
|
137
|
+
</Button>
|
|
138
|
+
</PrefetchPageLink>
|
|
139
|
+
)}
|
|
140
|
+
<button
|
|
141
|
+
className="p-2"
|
|
142
|
+
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
|
|
143
|
+
aria-label={mobileMenuOpen ? "Close menu" : "Open menu"}
|
|
144
|
+
>
|
|
145
|
+
{mobileMenuOpen ? <X size={20} /> : <Menu size={20} />}
|
|
146
|
+
</button>
|
|
147
|
+
</div>
|
|
131
148
|
</div>
|
|
149
|
+
|
|
150
|
+
{/* Mobile Menu */}
|
|
151
|
+
{mobileMenuOpen && (
|
|
152
|
+
<div className="md:hidden border-t bg-white ">
|
|
153
|
+
<div className="container mx-auto px-4 py-3">
|
|
154
|
+
<nav className="mb-4">
|
|
155
|
+
<div className="flex flex-col items-center gap-1">
|
|
156
|
+
{isLoggedIn && (
|
|
157
|
+
<PrefetchPageLink
|
|
158
|
+
className="text-sm font-medium hover:underline underline-offset-4 py-2 w-full text-center"
|
|
159
|
+
href="/dashboard"
|
|
160
|
+
onClick={() => setMobileMenuOpen(false)}
|
|
161
|
+
>
|
|
162
|
+
Dashboard
|
|
163
|
+
</PrefetchPageLink>
|
|
164
|
+
)}
|
|
165
|
+
<PrefetchPageLink
|
|
166
|
+
className="text-sm font-medium hover:underline underline-offset-4 py-2 w-full text-center"
|
|
167
|
+
href="/quickstart"
|
|
168
|
+
onClick={() => setMobileMenuOpen(false)}
|
|
169
|
+
>
|
|
170
|
+
Editor
|
|
171
|
+
</PrefetchPageLink>
|
|
172
|
+
<PrefetchPageLink
|
|
173
|
+
className="text-sm font-medium hover:underline underline-offset-4 py-2 w-full text-center"
|
|
174
|
+
href="/datasheets"
|
|
175
|
+
onClick={() => setMobileMenuOpen(false)}
|
|
176
|
+
>
|
|
177
|
+
Datasheets
|
|
178
|
+
</PrefetchPageLink>
|
|
179
|
+
<a
|
|
180
|
+
className="text-sm font-medium hover:underline underline-offset-4 py-2 w-full text-center"
|
|
181
|
+
href="https://docs.tscircuit.com"
|
|
182
|
+
>
|
|
183
|
+
Docs
|
|
184
|
+
</a>
|
|
185
|
+
<a
|
|
186
|
+
className="text-sm font-medium hover:underline underline-offset-4 py-2 w-full text-center"
|
|
187
|
+
href="https://tscircuit.com/join"
|
|
188
|
+
>
|
|
189
|
+
Discord
|
|
190
|
+
</a>
|
|
191
|
+
<a
|
|
192
|
+
className="text-sm font-medium hover:underline underline-offset-4 py-2 w-full text-center"
|
|
193
|
+
href="mailto:hello@tscircuit.com"
|
|
194
|
+
>
|
|
195
|
+
Contact
|
|
196
|
+
</a>
|
|
197
|
+
</div>
|
|
198
|
+
</nav>
|
|
199
|
+
<div className="flex flex-col items-center gap-4 pt-4 border-t border-gray-200">
|
|
200
|
+
{isLoggedIn ? (
|
|
201
|
+
<div className="w-full flex justify-center">
|
|
202
|
+
<HeaderDropdown />
|
|
203
|
+
</div>
|
|
204
|
+
) : (
|
|
205
|
+
<div className="w-full flex justify-center">
|
|
206
|
+
<HeaderLogin />
|
|
207
|
+
</div>
|
|
208
|
+
)}
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
)}
|
|
132
213
|
</header>
|
|
133
214
|
<CmdKMenu />
|
|
134
215
|
<Analytics />
|
|
@@ -4,9 +4,11 @@ import { useRebuildPackageReleaseMutation } from "@/hooks/use-rebuild-package-re
|
|
|
4
4
|
import { Github, RefreshCw } from "lucide-react"
|
|
5
5
|
import { useParams } from "wouter"
|
|
6
6
|
import { DownloadButtonAndMenu } from "../DownloadButtonAndMenu"
|
|
7
|
+
import { useGlobalStore } from "@/hooks/use-global-store"
|
|
7
8
|
|
|
8
9
|
export function PackageBuildHeader() {
|
|
9
10
|
const { author, packageName } = useParams()
|
|
11
|
+
const session = useGlobalStore((s) => s.session)
|
|
10
12
|
const { packageRelease } = useCurrentPackageRelease({
|
|
11
13
|
include_logs: true,
|
|
12
14
|
})
|
|
@@ -44,21 +46,23 @@ export function PackageBuildHeader() {
|
|
|
44
46
|
<span className="xs:hidden">Report</span>
|
|
45
47
|
</a>
|
|
46
48
|
</Button>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
{session?.github_username == author && (
|
|
50
|
+
<Button
|
|
51
|
+
variant="outline"
|
|
52
|
+
size="sm"
|
|
53
|
+
className="border-gray-300 bg-white hover:bg-gray-50 text-xs sm:text-sm"
|
|
54
|
+
disabled={isLoading || !packageRelease}
|
|
55
|
+
onClick={() =>
|
|
56
|
+
packageRelease &&
|
|
57
|
+
rebuildPackage({
|
|
58
|
+
package_release_id: packageRelease.package_release_id,
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
>
|
|
62
|
+
<RefreshCw className="w-3 h-3 sm:w-4 sm:h-4 mr-1 sm:mr-2" />
|
|
63
|
+
{isLoading ? "Rebuilding..." : "Rebuild"}
|
|
64
|
+
</Button>
|
|
65
|
+
)}
|
|
62
66
|
<DownloadButtonAndMenu unscopedName={packageName} author={author} />
|
|
63
67
|
</div>
|
|
64
68
|
</div>
|