Spaces:
Runtime error
Runtime error
Download frontend/src/components/ReportBody.tsx from firebird-technologies/NoteStack-Test: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/firebird-technologies/NoteStack-Test/resolve/main/frontend/src/components/ReportBody.tsx
- Command line
-
hf download hf://spaces/firebird-technologies/NoteStack-Test/frontend/src/components/ReportBody.tsx
-
curl -L -o ReportBody.tsx https://huggingface.co/spaces/firebird-technologies/NoteStack-Test/resolve/main/frontend/src/components/ReportBody.tsx
1.15 kB
| import { useState } from "react"; | |
| import { Link } from "react-router-dom"; | |
| import type { Artifact } from "../api/types"; | |
| import { ShareDialog } from "./ShareDialog"; | |
| /** What a finished report shows in a card: its format and size, and a way in or out to share it. */ | |
| export function ReportBody({ artifact }: { artifact: Artifact }) { | |
| const [sharing, setSharing] = useState(false); | |
| const c = artifact.content; | |
| const blocks = (c.blocks ?? []) as { type: string }[]; | |
| const visuals = blocks.filter((b) => b.type !== "prose").length; | |
| return ( | |
| <div className="artifact-body"> | |
| <p className="muted"> | |
| {c.format === "interactive" ? "Interactive" : "Document"} · {blocks.length} sections | |
| {visuals > 0 ? ` · ${visuals} visual${visuals === 1 ? "" : "s"}` : ""} | |
| </p> | |
| <div className="row"> | |
| <Link className="btn btn-small" to={`/app/reports/${artifact.id}`}>Open report</Link> | |
| <button type="button" className="btn btn-small" onClick={() => setSharing(true)}>Share</button> | |
| </div> | |
| {sharing && <ShareDialog artifactId={artifact.id} onClose={() => setSharing(false)} />} | |
| </div> | |
| ); | |
| } | |