Skip to content

Commit

Permalink
dashboard improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ritch committed Jul 29, 2024
1 parent 2358d83 commit 830c789
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ export default function DashboardView(props: ViewPropsType) {
justifyContent: "space-between",
alignItems: "center",
}));
const [showGrid, setShowGrid] = useState(false);
const toggleGrid = useCallback(() => setShowGrid(!showGrid), [showGrid]);

if (!propertiesAsArray.length) {
if (!allow_addition) {
Expand All @@ -151,15 +153,11 @@ export default function DashboardView(props: ViewPropsType) {
...gridLayout,
{ i: "add-item", x: 0, y: ROWS, w: COLS, h: 1, static: true },
];

return (
<Box
{...getComponentProps(props, "container")}
sx={{ position: "relative", marginLeft: -0.5 }}
>
<Box
{...getProps(props, "grid", baseGridProps)}
sx={{ position: "relative" }}
>
<Box>
{!showGrid && <Button onClick={toggleGrid}>Toggle Grid</Button>}
{showGrid && (
<GridLayout
onLayoutChange={handleLayoutChange}
layout={finalLayout}
Expand All @@ -183,6 +181,7 @@ export default function DashboardView(props: ViewPropsType) {
sx: { padding: 0.25, position: "relative" },
key: id,
};

return (
<Box
key={id}
Expand Down Expand Up @@ -222,7 +221,7 @@ export default function DashboardView(props: ViewPropsType) {
);
})}
</GridLayout>
</Box>
)}
{allow_addition && <AddItemButton key="add-item" onAddItem={onAddItem} />}
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ export default function PlotlyView(props) {

const mergedLayout = merge({}, layoutDefaults, layout);
const mergedConfig = merge({}, configDefaults, config);
const mergedData = mergeData(data, dataDefaults);
const mergedData = mergeData(data || schema?.view?.data, dataDefaults);

console.log(mergedData);

return (
<Box
Expand Down

0 comments on commit 830c789

Please sign in to comment.