diff --git a/client/src/components/Widgets/VaaActivity7Day.jsx b/client/src/components/Widgets/VaaActivity7Day.jsx
index d33b667..afbe219 100644
--- a/client/src/components/Widgets/VaaActivity7Day.jsx
+++ b/client/src/components/Widgets/VaaActivity7Day.jsx
@@ -1,11 +1,18 @@
import { useMemo } from 'react';
import { Box, Flex, Spinner, Text } from '@chakra-ui/react';
import Plot from 'react-plotly.js';
-import VdapApi from '../../hooks/useVdapApi.js'; // Adjust path as needed
+import VdapApi from '../../hooks/useVdapApi.js';
+import { useColorMode } from "@/components/ui/color-mode.jsx";
+
+// Import central color dictionary
+import { rawWidgetColors } from '../../theme.js'; // Adjust path if needed
export default function VaaActivity7Day({ settings, widgetID }) {
- console.log("3. Chart received settings:", settings);
- // Plotly expects 'linear' for normal axes
+ const { colorMode } = useColorMode();
+
+ // 2. Assign the active palette based on the current mode
+ const plotColors = colorMode === 'dark' ? rawWidgetColors.dark : rawWidgetColors.light;
+
const plotYAxisType = settings?.yAxisScale === 'symlog' ? 'symlog' : 'linear';
// Clean, single-line data fetching
@@ -17,10 +24,8 @@ export default function VaaActivity7Day({ settings, widgetID }) {
// Array of distinct Plotly shapes
const Symbolway = [
- 'circle', 'square', 'diamond',
- 'triangle-up', 'triangle-down',
- 'star', 'hexagram', 'pentagon',
- 'hexagon', 'octagon', 'cross', 'x'
+ 'circle', 'square', 'diamond', 'triangle-up', 'triangle-down',
+ 'star', 'hexagram', 'pentagon', 'hexagon', 'octagon', 'cross', 'x'
];
const sortedData = [...apiData].sort((a, b) => b.obs_fl - a.obs_fl);
@@ -43,7 +48,7 @@ export default function VaaActivity7Day({ settings, widgetID }) {
mode: 'markers',
marker: {
size: 7,
- line: { width: 0.5, color: 'var(--chakra-colors-textInverted)' },
+ line: { width: 0.5, color: plotColors.text },
symbol: Symbolway[index % Symbolway.length],
},
// Replicating the clean Observable tooltip
@@ -52,35 +57,35 @@ export default function VaaActivity7Day({ settings, widgetID }) {
'Date: %{x|%b %d %Y %H:%M}
' +
'Flight Level: %{y}'
}));
- }, [apiData]);
+ }, [apiData, plotColors]);
// 2. Build the Layout (Styling and Grid)
const layout = useMemo(() => {
return {
autosize: true,
- paper_bgcolor: 'transparent', // Let Chakra UI background show through
+ paper_bgcolor: 'transparent',
plot_bgcolor: 'transparent',
- font: { color: 'var(--chakra-colors-widgetTextMuted)' },
+ font: { color: plotColors.muted },
margin: { t: 40, r: 20, l: 20, b: 20 },
xaxis: {
title: {
text: 'Date (UTC)',
- font: { color: 'var(--chakra-colors-text)', size: 12 }
+ font: { color: plotColors.text, size: 12 }
},
type: 'date',
tickformat: '%b %d
%Y %H:%M',
- gridcolor: 'var(--chakra-colors-glassSeperator)',
- zerolinecolor: 'var(--chakra-colors-glassSeperator)',
+ gridcolor: plotColors.grid,
+ zerolinecolor: plotColors.grid,
automargin: true,
},
yaxis: {
title: {
text: 'Flight Level',
- font: { color: 'var(--chakra-colors-text)', size: 12 }
+ font: { color: plotColors.text, size: 12 }
},
type: plotYAxisType,
- gridcolor: 'var(--chakra-colors-glassSeperator)',
- zerolinecolor: 'var(--chakra-colors-text)',
+ gridcolor: plotColors.grid,
+ zerolinecolor: plotColors.text,
automargin: true,
},
hovermode: 'closest',
@@ -93,11 +98,11 @@ export default function VaaActivity7Day({ settings, widgetID }) {
y0: 0,
y1: 0,
yref: 'y',
- line: { color: 'var(--chakra-colors-text)', width: 1 }
+ line: { color: plotColors.text, width: 1 }
}
],
};
- }, [apiData, plotYAxisType]);
+ }, [plotYAxisType, plotColors]);
if (isLoading) return (
@@ -120,7 +125,7 @@ export default function VaaActivity7Day({ settings, widgetID }) {
return (