pcbjam/web/standalone/src/components/VersionBadge.tsx
Gergő Törcsvári 39cb04b127
feat(standalone): demo follow-ups — waitlist, analytics, move-to-local, file tree, load progress
- Waitlist signup form on the home page (between Projects and Tools),
  cross-posting to the landing site's /api/waitlist (CORS + OPTIONS added there,
  gated by WAITLIST_ALLOWED_ORIGINS).
- Version badge gains a pcbjam.com landing-page link (VITE_LANDING_URL).
- Optional Plausible analytics from VITE_PLAUSIBLE_DOMAIN (off by default);
  wired into build-demo + both deploy workflows via vars.PLAUSIBLE_DOMAIN.
- Opening a read-only gallery project auto-"moves to local": it forks into a
  writable browser-local project at the same slug, shadowing the gallery row.
- Project + local-folder views use the same iconed tool launcher (ToolGrid)
  and a navigable directory FileTree instead of a flat file list.
- Boot overlay shows real wasm download progress (Module.instantiateWasm +
  streaming byte counter) and a "taking too long" state after 60s.
- Home Libraries section lists the active libs source (the read-only R2/CDN
  set in the demo) with a name filter; useLibs now reads libsSourceConfig.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TPJYx4urFVhdMjEmYfMCMD
2026-06-27 07:59:09 +02:00

59 lines
2 KiB
TypeScript

import { ExternalLink, Github } from "lucide-react";
import { APP_GIT_SHA, APP_TAG, LANDING_URL, REPO_URL } from "@/lib/config";
/**
* Small bottom-right overlay showing this build's version + a link to the
* source. The standalone is GPLv3, so the tag links to the exact commit
* (corresponding-source pointer — the repo commit pins the kicad + wxwidgets
* submodule revisions) when known, else the tag's release page, else the repo
* root. Mounted app-wide (App.tsx) so it shows on the home page AND inside the
* loaded editor. `fixed` keeps it viewport-anchored on every route; z-20 sits
* under the editor's boot overlay (z-30) so it's hidden until the tool is up.
*/
export function VersionBadge() {
const tag = APP_TAG ?? "dev";
const versionUrl = APP_GIT_SHA
? `${REPO_URL}/commit/${APP_GIT_SHA}`
: APP_TAG
? `${REPO_URL}/releases/tag/${APP_TAG}`
: REPO_URL;
const versionTitle = APP_GIT_SHA
? `commit ${APP_GIT_SHA.slice(0, 12)} — GPL corresponding source`
: APP_TAG
? `release ${APP_TAG}`
: "source repository";
return (
<div className="fixed bottom-3 right-3 z-20 flex items-center gap-2 rounded bg-black/70 px-2.5 py-1 font-mono text-[11px] text-white/80 shadow">
<a
href={versionUrl}
target="_blank"
rel="noreferrer"
title={versionTitle}
className="hover:text-white"
>
pcbjam {tag}
</a>
<span className="text-white/30">·</span>
<a
href={REPO_URL}
target="_blank"
rel="noreferrer"
title="Source on GitHub"
className="inline-flex items-center gap-1 hover:text-white"
>
<Github size={12} /> source
</a>
<span className="text-white/30">·</span>
<a
href={LANDING_URL}
target="_blank"
rel="noreferrer"
title="PCBJam — product page"
className="inline-flex items-center gap-1 hover:text-white"
>
pcbjam.com <ExternalLink size={11} />
</a>
</div>
);
}