MCPcopy
hub / github.com/tinyplex/tinybase / Details

Function Details

src/ui-react-inspector/Details.tsx:8–46  ·  view source on GitHub ↗
({
  uniqueId,
  title,
  editable,
  handleEditable,
  children,
  s,
}: {
  readonly uniqueId: Id;
  readonly title: ReactNode;
  readonly editable?: boolean;
  readonly handleEditable?: (event: SyntheticEvent<HTMLImageElement>) => void;
  readonly children: ReactNode;
} & StoreProp)

Source from the content-addressed store, hash-verified

6import {useCell, useSetCellCallback} from '../ui-react/index.ts';
7
8export const Details = ({
9 uniqueId,
10 title,
11 editable,
12 handleEditable,
13 children,
14 s,
15}: {
16 readonly uniqueId: Id;
17 readonly title: ReactNode;
18 readonly editable?: boolean;
19 readonly handleEditable?: (event: SyntheticEvent<HTMLImageElement>) => void;
20 readonly children: ReactNode;
21} & StoreProp) => {
22 const open = !!useCell(STATE_TABLE, uniqueId, OPEN_CELL, s);
23 const handleToggle = useSetCellCallback(
24 STATE_TABLE,
25 uniqueId,
26 OPEN_CELL,
27 (event: SyntheticEvent<HTMLDetailsElement>) => event[CURRENT_TARGET].open,
28 [],
29 s,
30 );
31 return (
32 <details open={open} onToggle={handleToggle}>
33 <summary>
34 <span>{title}</span>
35 {handleEditable ? (
36 <img
37 onClick={handleEditable}
38 className={editable ? 'done' : 'edit'}
39 title={editable ? 'Done editing' : 'Edit'}
40 />
41 ) : null}
42 </summary>
43 <div>{children}</div>
44 </details>
45 );
46};

Callers

nothing calls this directly

Calls 2

useCellFunction · 0.90
useSetCellCallbackFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…