diff --git a/generator/frontend/src/App.tsx b/generator/frontend/src/App.tsx index 3a057ee..6958c35 100644 --- a/generator/frontend/src/App.tsx +++ b/generator/frontend/src/App.tsx @@ -52,7 +52,6 @@ export default function App() { const [username, setUsername] = useState('') const [settings, setSettings] = useState({ ...DEFAULT_SETTINGS }) const [widgetData, setWidgetData] = useState(null) - const [isDemo, setIsDemo] = useState(false) const [fetchDone, setFetchDone] = useState(false) const [fetchError, setFetchError] = useState(null) // Final SVG produced by POST /api//generate. Rendered on the Result @@ -81,7 +80,6 @@ export default function App() { setFetchError(null) // Show demo data immediately so Workshop is interactive while the worker builds. setWidgetData(DEMO_WIDGET_DATA) - setIsDemo(true) const poll = async () => { if (aborted.current) return @@ -93,7 +91,6 @@ export default function App() { if (r.status === 200 && status === 'ready' && body.data) { setWidgetData(body.data) - setIsDemo(false) setFetchDone(true) return } @@ -186,7 +183,6 @@ export default function App() { onBack={handleBack} fetchDone={fetchDone} fetchError={fetchError} - isDemo={isDemo} widgetData={widgetData} /> )} diff --git a/generator/frontend/src/screens/ResultScreen.tsx b/generator/frontend/src/screens/ResultScreen.tsx index a9d0afe..25025c1 100644 --- a/generator/frontend/src/screens/ResultScreen.tsx +++ b/generator/frontend/src/screens/ResultScreen.tsx @@ -1,5 +1,5 @@ import DOMPurify from 'dompurify' -import { useMemo } from 'react' +import { useMemo, useState } from 'react' function sanitizeSvg(raw: string): string { return DOMPurify.sanitize(raw, { @@ -19,12 +19,23 @@ type Props = { export function ResultScreen({ username, generating, generatedSvg, generateError, onBack }: Props) { const safeSvg = useMemo(() => (generatedSvg ? sanitizeSvg(generatedSvg) : ''), [generatedSvg]) + const [copied, setCopied] = useState(false) const embedUrl = `${window.location.origin}/api/${encodeURIComponent(username)}` const embedSnippet = `![${username}](${embedUrl})` + const copy = async () => { + try { + await navigator.clipboard.writeText(embedSnippet) + setCopied(true) + setTimeout(() => setCopied(false), 1500) + } catch { + /* ignore */ + } + } + return (
-
+
-
-

+
+

Your Widget

{generating && ( -
-
+
+

Generating with real data…

)} {!generating && generateError && ( -
-

{generateError}

+
+

{generateError}

)} {!generating && !generateError && safeSvg && ( <> -

Rendered from live data

-
+

Rendered from live GitHub data

+
+ {/* + Force the inline SVG to scale up to the card width. The + composite is authored at 380px wide — without this the + preview looked tiny on wide screens. + */} +
+
+
-

Embed in your README:

-
{embedSnippet}
+
+

Embed in your README

+ +
+
+                {embedSnippet}
+              
+

+ GitHub requires HTTPS for README images — serve this behind a TLS + reverse proxy or Cloudflare Tunnel if the page is on http://. +

)} diff --git a/generator/frontend/src/screens/WorkshopScreen.tsx b/generator/frontend/src/screens/WorkshopScreen.tsx index 91c6a2c..f83eff3 100644 --- a/generator/frontend/src/screens/WorkshopScreen.tsx +++ b/generator/frontend/src/screens/WorkshopScreen.tsx @@ -86,7 +86,6 @@ type Props = { onBack: () => void fetchDone: boolean fetchError: string | null - isDemo: boolean widgetData: WidgetData | null } @@ -98,7 +97,6 @@ export function WorkshopScreen({ onBack, fetchDone, fetchError, - isDemo, widgetData, }: Props) { const [expandedWidget, setExpandedWidget] = useState(null) @@ -177,30 +175,13 @@ export function WorkshopScreen({ Back -
{username}
-
- {fetchError ? ( - <> -
- {fetchError} - - ) : isDemo ? ( - <> -
- Building your widget — showing demo - - ) : fetchDone ? ( - <> -
- Data ready - - ) : ( - <> -
- Fetching data... - - )} -
+
{username}
+ {fetchError && ( +
+
+ {fetchError} +
+ )} {/* Theme */}