@tscircuit/fake-snippets 0.0.99 → 0.0.100
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 +11 -4
- 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/ViewPackagePage/components/important-files-view.tsx +294 -167
- 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/hooks/use-create-package-mutation.ts +1 -1
- package/src/hooks/useFileManagement.ts +1 -5
- package/src/lib/utils/package-utils.ts +0 -3
|
@@ -186,6 +186,7 @@ export const EditPackageDetailsDialog = ({
|
|
|
186
186
|
"packageFile",
|
|
187
187
|
{ package_release_id: packageReleaseId },
|
|
188
188
|
])
|
|
189
|
+
qc.invalidateQueries(["packageFiles", packageReleaseId])
|
|
189
190
|
toast({
|
|
190
191
|
title: "Package details updated",
|
|
191
192
|
description: "Successfully updated package details",
|
|
@@ -376,7 +377,7 @@ export const EditPackageDetailsDialog = ({
|
|
|
376
377
|
className="mt-2 rounded-md"
|
|
377
378
|
onToggle={(e) => setDangerOpen(e.currentTarget.open)}
|
|
378
379
|
>
|
|
379
|
-
<summary className="cursor-pointer p-2 font-medium text-sm text-black list-none flex justify-between items-center">
|
|
380
|
+
<summary className="select-none cursor-pointer p-2 font-medium text-sm text-black list-none flex justify-between items-center">
|
|
380
381
|
Danger Zone
|
|
381
382
|
<ChevronDown
|
|
382
383
|
className={`w-4 h-4 mr-1 transition-transform ${dangerOpen ? "rotate-180" : ""}`}
|
|
@@ -405,7 +406,7 @@ export const EditPackageDetailsDialog = ({
|
|
|
405
406
|
</div>
|
|
406
407
|
|
|
407
408
|
<DialogFooter className="mt-auto">
|
|
408
|
-
<div className="lg:px-2 flex flex-col sm:flex-row justify-end gap-2">
|
|
409
|
+
<div className="lg:px-2 select-none flex flex-col sm:flex-row justify-end gap-2">
|
|
409
410
|
<Button
|
|
410
411
|
variant="outline"
|
|
411
412
|
onClick={() => onOpenChange(false)}
|
|
@@ -172,7 +172,7 @@ export function CodeAndPreview({ pkg, projectUrl }: Props) {
|
|
|
172
172
|
|
|
173
173
|
if (urlParams.package_id && (!pkg || isLoading)) {
|
|
174
174
|
return (
|
|
175
|
-
<div className="flex items-center justify-center h-[
|
|
175
|
+
<div className="flex items-center justify-center h-[80vh]">
|
|
176
176
|
<div className="flex flex-col items-center justify-center">
|
|
177
177
|
<div className="text-lg text-gray-500 mb-4">Loading</div>
|
|
178
178
|
<Loader2 className="w-16 h-16 animate-spin text-gray-400" />
|
|
@@ -205,7 +205,7 @@ export const CodeEditor = ({
|
|
|
205
205
|
projectName: "my-project",
|
|
206
206
|
typescript: tsModule,
|
|
207
207
|
logger: console,
|
|
208
|
-
fetcher: async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
208
|
+
fetcher: (async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
209
209
|
const registryPrefixes = [
|
|
210
210
|
"https://data.jsdelivr.com/v1/package/resolve/npm/@tsci/",
|
|
211
211
|
"https://data.jsdelivr.com/v1/package/npm/@tsci/",
|
|
@@ -231,7 +231,7 @@ export const CodeEditor = ({
|
|
|
231
231
|
)
|
|
232
232
|
}
|
|
233
233
|
return fetch(input, init)
|
|
234
|
-
},
|
|
234
|
+
}) as typeof fetch,
|
|
235
235
|
delegate: {
|
|
236
236
|
started: () => {
|
|
237
237
|
const manualEditsTypeDeclaration = `
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState, useCallback, useRef } from "react"
|
|
2
2
|
import { isValidFileName } from "@/lib/utils/isValidFileName"
|
|
3
3
|
import { PackageFile } from "@/types/package"
|
|
4
|
-
import {
|
|
5
|
-
DEFAULT_CODE,
|
|
6
|
-
generateRandomPackageName,
|
|
7
|
-
} from "@/lib/utils/package-utils"
|
|
4
|
+
import { DEFAULT_CODE } from "@/lib/utils/package-utils"
|
|
8
5
|
import { Package } from "fake-snippets-api/lib/db/schema"
|
|
9
6
|
import { usePackageFiles } from "./use-package-files"
|
|
10
7
|
import { decodeUrlHashToText } from "@/lib/decodeUrlHashToText"
|
|
@@ -318,7 +315,6 @@ export function useFileManagement({
|
|
|
318
315
|
}
|
|
319
316
|
|
|
320
317
|
await createPackageMutation.mutateAsync({
|
|
321
|
-
name: `${loggedInUser?.github_username}/${generateRandomPackageName()}`,
|
|
322
318
|
is_private: isPrivate,
|
|
323
319
|
})
|
|
324
320
|
}
|