Update widgets and added settings

This commit is contained in:
2026-07-10 14:56:11 -07:00
parent c69ac2ba42
commit df8bcd376e
6 changed files with 105 additions and 13 deletions
@@ -0,0 +1,37 @@
import { Box, Text, Switch } from "@chakra-ui/react";
import { useDashboardStore } from "../../../store/useDashboardStore.jsx";
export default function VaaActivitySettings({ widgetId, currentSettings }) {
const updateSettings = useDashboardStore(state => state.updateWidgetSettings);
// 1. Convert the saved string into a boolean for the toggle UI
const isSymlog = currentSettings?.yAxisScale === 'symlog';
const handleToggle = (details) => {
// 2. Chakra v3 passes { checked: boolean } in the details object.
// Convert it back to the string Plotly expects.
console.log("1. Toggle Clicked! Raw details from Chakra:", details);
const newScale = details.checked ? 'symlog' : 'normal';
updateSettings(widgetId, { yAxisScale: newScale });
};
return (
<Box>
<Text fontWeight="bold" mb={3} fontSize="sm">Y-Axis Settings</Text>
<Switch.Root
checked={isSymlog}
onCheckedChange={handleToggle}
colorPalette="blue"
>
<Switch.HiddenInput />
<Switch.Control>
<Switch.Thumb />
</Switch.Control>
<Switch.Label>Use Symlog Scale</Switch.Label>
</Switch.Root>
</Box>
);
}