@tscircuit/fake-snippets 0.0.118 → 0.0.120

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.
Files changed (31) hide show
  1. package/bun-tests/fake-snippets-api/routes/bug_reports/create.test.ts +37 -0
  2. package/bun-tests/fake-snippets-api/routes/bug_reports/upload_file.test.ts +89 -0
  3. package/bun-tests/fake-snippets-api/routes/packages/get.test.ts +3 -0
  4. package/bun.lock +2 -2
  5. package/dist/bundle.js +778 -508
  6. package/dist/index.d.ts +161 -6
  7. package/dist/index.js +102 -3
  8. package/dist/schema.d.ts +225 -7
  9. package/dist/schema.js +38 -3
  10. package/fake-snippets-api/lib/db/db-client.ts +98 -0
  11. package/fake-snippets-api/lib/db/schema.ts +37 -0
  12. package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +6 -0
  13. package/fake-snippets-api/lib/public-mapping/public-map-package.ts +9 -0
  14. package/fake-snippets-api/routes/api/bug_reports/create.ts +43 -0
  15. package/fake-snippets-api/routes/api/bug_reports/upload_file.ts +113 -0
  16. package/package.json +2 -2
  17. package/src/components/Header.tsx +16 -0
  18. package/src/components/PackageCard.tsx +7 -4
  19. package/src/components/PackageSearchResults.tsx +1 -7
  20. package/src/components/SearchComponent.tsx +64 -53
  21. package/src/components/TrendingPackagesCarousel.tsx +16 -23
  22. package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +3 -2
  23. package/src/components/ViewPackagePage/components/preview-image-squares.tsx +6 -3
  24. package/src/hooks/use-preview-images.ts +22 -17
  25. package/src/hooks/useUpdatePackageFilesMutation.ts +8 -0
  26. package/src/lib/utils/getPackagePreviewImageUrl.ts +15 -0
  27. package/src/pages/dashboard.tsx +0 -1
  28. package/src/pages/editor.tsx +12 -9
  29. package/src/pages/organization-profile.tsx +0 -1
  30. package/src/pages/package-editor.tsx +13 -9
  31. package/src/pages/user-profile.tsx +0 -1
@@ -8,6 +8,11 @@ export const EditorPage = () => {
8
8
  const { packageInfo: pkg, error } = useCurrentPackageInfo()
9
9
 
10
10
  const projectUrl = pkg ? `https://tscircuit.com/${pkg.name}` : undefined
11
+ const previewImageUrl =
12
+ pkg?.latest_pcb_preview_image_url ??
13
+ pkg?.latest_sch_preview_image_url ??
14
+ pkg?.latest_cad_preview_image_url ??
15
+ undefined
11
16
 
12
17
  return (
13
18
  <div className="overflow-x-hidden">
@@ -21,15 +26,13 @@ export const EditorPage = () => {
21
26
  property="og:title"
22
27
  content={`${pkg.unscoped_name} - tscircuit`}
23
28
  />
24
- <meta
25
- property="og:image"
26
- content={`https://api.tscircuit.com/packages/images/${pkg.owner_github_username}/${pkg.unscoped_name}/pcb.png?fs_sha=${pkg.latest_package_release_fs_sha}`}
27
- />
28
- <meta name="twitter:card" content="summary_large_image" />
29
- <meta
30
- name="twitter:image"
31
- content={`https://api.tscircuit.com/packages/images/${pkg.owner_github_username}/${pkg.unscoped_name}/pcb.png?fs_sha=${pkg.latest_package_release_fs_sha}`}
32
- />
29
+ {previewImageUrl && (
30
+ <>
31
+ <meta property="og:image" content={previewImageUrl} />
32
+ <meta name="twitter:card" content="summary_large_image" />
33
+ <meta name="twitter:image" content={previewImageUrl} />
34
+ </>
35
+ )}
33
36
  </>
34
37
  )}
35
38
  </Helmet>
@@ -150,7 +150,6 @@ export const OrganizationProfilePageContent = ({
150
150
  <PackageCard
151
151
  key={pkg.package_id}
152
152
  pkg={pkg}
153
- baseUrl={baseUrl}
154
153
  showOwner={false}
155
154
  isCurrentUserPackage={isCurrentUserOrganization}
156
155
  />
@@ -12,6 +12,12 @@ export const EditorPage = () => {
12
12
  /^[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}$/,
13
13
  )
14
14
 
15
+ const previewImageUrl =
16
+ pkg?.latest_pcb_preview_image_url ??
17
+ pkg?.latest_sch_preview_image_url ??
18
+ pkg?.latest_cad_preview_image_url ??
19
+ undefined
20
+
15
21
  return (
16
22
  <div className="flex flex-col h-screen overflow-x-hidden">
17
23
  <Helmet>
@@ -22,15 +28,13 @@ export const EditorPage = () => {
22
28
  property="og:title"
23
29
  content={`${pkg.unscoped_name} - tscircuit`}
24
30
  />
25
- <meta
26
- property="og:image"
27
- content={`https://api.tscircuit.com/packages/images/${pkg.owner_github_username}/${pkg.unscoped_name}/pcb.png?fs_sha=${pkg.latest_package_release_fs_sha}`}
28
- />
29
- <meta name="twitter:card" content="summary_large_image" />
30
- <meta
31
- name="twitter:image"
32
- content={`https://api.tscircuit.com/packages/images/${pkg.owner_github_username}/${pkg.unscoped_name}/pcb.png?fs_sha=${pkg.latest_package_release_fs_sha}`}
33
- />
31
+ {previewImageUrl && (
32
+ <>
33
+ <meta property="og:image" content={previewImageUrl} />
34
+ <meta name="twitter:card" content="summary_large_image" />
35
+ <meta name="twitter:image" content={previewImageUrl} />
36
+ </>
37
+ )}
34
38
  </>
35
39
  )}
36
40
  </Helmet>
@@ -281,7 +281,6 @@ export const UserProfilePage = () => {
281
281
  <PackageCard
282
282
  key={pkg.package_id}
283
283
  pkg={pkg}
284
- baseUrl={baseUrl}
285
284
  showOwner={activeTab === "starred"}
286
285
  isCurrentUserPackage={
287
286
  isCurrentUserProfile && activeTab === "all"