WIP 5
This commit is contained in:
parent
b8c6e893ff
commit
b09cc82544
167 changed files with 2196 additions and 1302 deletions
21
packages/leafcutter-ui/components/LiveDataViewer.tsx
Normal file
21
packages/leafcutter-ui/components/LiveDataViewer.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use client";
|
||||
|
||||
import { FC, useEffect, useState } from "react";
|
||||
import { useLeafcutterContext } from "./LeafcutterProvider";
|
||||
import { RawDataViewer } from "./RawDataViewer";
|
||||
import { searchVisualizationsAction } from "../actions/visualizations";
|
||||
|
||||
export const LiveDataViewer: FC = () => {
|
||||
const { query, setFoundCount, datasource } = useLeafcutterContext();
|
||||
const [rows, setRows] = useState<any[]>([]);
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const result = await searchVisualizationsAction(datasource, query);
|
||||
setRows(result);
|
||||
setFoundCount(result?.length ?? 0);
|
||||
};
|
||||
fetchData();
|
||||
}, [query, setFoundCount, datasource]);
|
||||
|
||||
return <RawDataViewer rows={rows} height={350} />;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue