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

Function TableView

src/ui-react-inspector/TablesView.tsx:51–110  ·  view source on GitHub ↗
({
  tableId,
  store,
  storeId,
  s,
}: TableProps & {readonly storeId?: Id} & StoreProp)

Source from the content-addressed store, hash-verified

49);
50
51const TableView = ({
52 tableId,
53 store,
54 storeId,
55 s,
56}: TableProps & {readonly storeId?: Id} & StoreProp) => {
57 const uniqueId = getUniqueId('t', storeId, tableId);
58 const [cellId, descending, offset] = jsonParse(
59 (useCell(STATE_TABLE, uniqueId, SORT_CELL, s) as string) ?? '[]',
60 );
61 const handleChange = useSetCellCallback(
62 STATE_TABLE,
63 uniqueId,
64 SORT_CELL,
65 jsonStringWithMap,
66 [],
67 s,
68 );
69 const [editable, handleEditable] = useEditable(uniqueId, s);
70 const CellComponent = editable ? EditableCellViewWithActions : CellView;
71 return (
72 <Details
73 uniqueId={uniqueId}
74 title={TABLE + ': ' + tableId}
75 editable={editable}
76 handleEditable={handleEditable}
77 s={s}
78 >
79 <SortedTableInHtmlTable
80 tableId={tableId}
81 store={store}
82 cellId={cellId}
83 descending={descending}
84 offset={offset}
85 limit={10}
86 paginator={true}
87 sortOnClick={true}
88 onChange={handleChange}
89 editable={editable}
90 extraCellsAfter={editable ? rowActions : []}
91 customCells={objNew(
92 arrayMap(useTableCellIds(tableId, store), (cellId) => [
93 cellId,
94 {label: cellId, component: CellComponent},
95 ]),
96 )}
97 />
98 {editable ? (
99 <div className="actions">
100 <div>
101 <TableActions1 tableId={tableId} store={store} />
102 </div>
103 <div>
104 <TableActions2 tableId={tableId} store={store} />
105 </div>
106 </div>
107 ) : null}
108 </Details>

Callers

nothing calls this directly

Calls 7

getUniqueIdFunction · 0.90
useCellFunction · 0.90
useSetCellCallbackFunction · 0.90
useEditableFunction · 0.90
objNewFunction · 0.90
arrayMapFunction · 0.90
useTableCellIdsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…