MCPcopy Create free account
hub / github.com/atomicdata-dev/atomic-data-browser / FileInner

Function FileInner

data-browser/src/views/FilePage.tsx:25–44  ·  view source on GitHub ↗
({ resource }: ResourcePageProps)

Source from the content-addressed store, hash-verified

23
24/** A preview + download button for a file */
25export function FileInner({ resource }: ResourcePageProps) {
26 function handleDownload() {
27 window.open(downloadUrl);
28 }
29
30 const [downloadUrl] = useString(resource, properties.file.downloadUrl);
31 const [bytes] = useNumber(resource, properties.file.filesize);
32
33 const fileSizeString = bytes ? ` (${niceBytes(bytes)})` : '';
34
35 return (
36 <div>
37 <ValueForm resource={resource} propertyURL={properties.description} />
38 <Button onClick={handleDownload}>Download{fileSizeString}</Button>
39 <div>
40 <FilePreview resource={resource} />
41 </div>
42 </div>
43 );
44}
45
46function FilePreview({ resource }: ResourcePageProps) {
47 const [url] = useString(resource, properties.file.downloadUrl);

Callers

nothing calls this directly

Calls 3

useStringFunction · 0.90
useNumberFunction · 0.90
niceBytesFunction · 0.85

Tested by

no test coverage detected