Author SHA1 Message Date
chight b8aa67f64c Fix linux cares about case sensitivity. 2026-10-01 15:20:34 -07:00
chight 79f7e9661c Fix security, we check for broken API calls. 2026-10-01 15:18:08 -07:00
13 changed files with 690 additions and 505 deletions
+37 -38
View File
@@ -60,38 +60,38 @@ export default function AlertChanges({ settings, widgetID}) {
return sorted_entries;
}, [apiData, thisWidget]);
// Alert colors are now light/dark mode responsive
// list of alert colors used for coloring text below
const alertColors = {
Red: "alertRed",
Orange: "alertOrange",
Yellow: "alertYellow",
Green: "alertGreen",
Red: "red.400",
Orange: "orange.400",
Yellow: "yellow.400",
Green: "green.400",
};
if (isLoading) return (
<Flex w="100%" h="100%" align="center" justify="center" bg="transparent">
<Flex w="100%" h="100%" align="center" justify="center" borderRadius="lg" bg="gray.800">
<Spinner size="xl" color="blue.400" thickness="4px"/>
</Flex>
);
if (error) return (
<Flex w="100%" h="100%" align="center" justify="center" bg="transparent">
<Flex w="100%" h="100%" align="center" justify="center" borderRadius="lg" bg="gray.800">
<Text color="red.400">{error}</Text>
</Flex>
);
if (data.length === 0) return (
<Flex w="100%" h="100%" align="center" justify="center" bg="transparent">
<Text textAlign="center" color="widgetTextMuted">No flight level data available for the selected dates.</Text>
<Flex w="100%" h="100%" align="center" justify="center" borderRadius="lg" bg="gray.800">
<Text textAlign="center" color="gray.400">No flight level data available for the selected dates.</Text>
</Flex>
);
return (
// bg="transparent" to let the glass panel show through
<Box display="flex" flexDirection="column" gap={2} p={2} w="100%" h="100%" bg="transparent" overflowY="auto">
<Box display="flex" flexDirection="column" gap={2} p={2} w="100%" h="100%" borderRadius="lg" bg="gray.800" overflowY="auto">
{data.map((volcano, index) => {
if (thisWidget?.size === "large") return (
<Collapsible.Root key={index} w="100%">
{/* Using context to dynamically change the border radii of the triggers */}
<Collapsible.Context>
{(collapsible) => (
<>
@@ -102,58 +102,57 @@ export default function AlertChanges({ settings, widgetID}) {
p={1} pl={3} pr={3}
borderTopRadius="lg"
borderBottomRadius={collapsible.open ? "0" : "lg"}
bg="widgetItemBg"
bg="gray.600"
>
<Flex direction="column" w="100%" minW={0} textAlign="left">
<Text truncate color="text" fontWeight="medium">{volcano[0]}</Text>
<Text truncate fontSize="xs" color="widgetTextMuted">{volcano[1][0]?.alert_start_date_local}</Text>
<Flex direction="column" w="100%" minW={0} textAlign="left" color="gray.100">
<Text truncate >{volcano[0]}</Text> {/* volcano name */}
<Text truncate fontSize="xs" color="gray.300/90">{volcano[1][0]?.alert_start_date_local}</Text>
</Flex>
<Flex w="100%" minW={0} justify="right">
<Text truncate pl={2} pr={2} borderRadius="lg" bg="widgetBadgeBg" color="text" fontWeight="semibold">
{volcano[1][0]?.alert_level_name}
</Text>
<Text truncate pl={2} pr={2} borderRadius="lg" bg="gray.800/50" color="gray.100" fontWeight="semibold">{volcano[1][0]?.alert_level_name}</Text>
</Flex>
</Flex>
</Collapsible.Trigger>
<Collapsible.Content w="100%" p={3} borderBottomRadius="lg" bg="widgetItemExpandedBg">
<Collapsible.Content w="100%" p={3} borderBottomRadius="lg" bg="gray.700">
<Timeline.Root size="md" variant="subtle">
{volcano[1]?.map((object, index) => (
<Timeline.Item key={index} w="100%" h="100%">
<Timeline.Connector >
<Timeline.Indicator outline="none" bg="widgetBadgeBg" color="iconColor" size="lg">
{/*<Timeline.Separator borderWidth="1px" borderColor="gray.600"/>*/}
<Timeline.Indicator outline="none" bg="gray.200" color="gray.500" size="lg">
{object?.alert_scheme_domain === "terrestrial" && <Footprints size={15} />}
{object?.alert_scheme_domain === "aviation" && <Plane size={15} />}
{object?.alert_scheme_domain === "maritime" && <Sailboat size={15} />}
</Timeline.Indicator>
<Timeline.Indicator h="50%" outline="none" bg="widgetBadgeBg" color="iconColor" size="lg">
<Timeline.Indicator h="50%" outline="none" bg="gray.700" color="gray.100" size="lg">
{object?.change_type === "increase" ? <TrendingUp /> : <TrendingDown />}
</Timeline.Indicator>
</Timeline.Connector>
<Timeline.Content w="100%" h="100%">
{/*<Timeline.Title>{object?.volcano}</Timeline.Title>*/}
<Timeline.Description w="100%" h="100%" gap={1}>
<Flex direction="column" gap={1}>
<Text w="100%" h="100%" color="widgetTextMuted">{object?.alert_start_date_local}</Text>
<Text w="100%" h="100%" color="gray.200">{object?.alert_start_date_local}</Text>
<Text w="100%" h="100%"
color={alertColors[object?.alert_level_name] || "text"}
color={alertColors[object?.alert_level_name] || "gray.200"}
fontSize="md"
fontWeight="semibold"
>
{object?.alert_level_name}
</Text>
<Flex w="100%" h="20px" direction="row" justify="left" align="center">
<Text color="widgetTextMuted">Alert Scale: </Text>
<Text color="gray.300">Alert Scale: </Text>
{(Array.from({ length: Number(object?.alert_scheme_highest) - Number(object?.alert_scheme_lowest) + 1}, (v, i) => Number(object?.alert_scheme_lowest) + i))
.map((num) => (
<Center
key={num}
w="20px" h="100%"
color="text"
bg={num === Number(object?.alert_level_rank) ? "widgetBadgeBg" : "transparent"}
borderRadius={num === Number(object?.alert_level_rank) ? "xl" : "none"}
color="gray.300"
bg={num === Number(object?.alert_level_rank) ? "gray.300/20" : null} // alert level rank is a string for some reason
borderRadius={num === Number(object?.alert_level_rank) ? "xl" : null}
textAlign="center"
fontSize="sm"
fontWeight="bold"
fontWeight="semibold"
>
{num}
</Center>
@@ -182,30 +181,30 @@ export default function AlertChanges({ settings, widgetID}) {
justify="space-between" align="center"
p={1} pl={3} pr={3}
borderRadius="lg"
bg="widgetItemBg"
bg="gray.600"
>
<Flex direction="column" w="100%" minW={0} textAlign="left" color="text">
<Flex direction="column" w="100%" minW={0} textAlign="left" color="gray.100">
<Flex direction="row" w="100%" gap={2} align="center">
<Flex color="iconColor">
<Flex color="gray.300">
{domain[0] === "aviation" && <Plane size={15}/>}
{domain[0] === "terrestrial" && <Footprints size={15}/>}
{domain[0] === "maritime" && <Sailboat size={15}/>}
</Flex>
<Text truncate fontWeight="medium">{volcano[0] || ""}</Text>
<Text truncate>{volcano[0] || ""}</Text> {/* volcano name */}
</Flex>
<Text truncate w="100%" fontSize="xs" color="widgetTextMuted">{domain[1]?.[0]?.alert_start_date_local || ""}</Text>
<Text truncate w="100%" fontSize="xs" color="gray.300/90">{domain[1]?.[0]?.alert_start_date_local || ""}</Text>
</Flex>
<Flex direction="row" w="100%" minW={0} justify="right" gap={2} color="text">
<Flex w="25px" justify="right" color="iconColor">
<Flex direction="row" w="100%" minW={0} justify="right" gap={2} color="gray.200">
<Flex w="25px" justify="right">
{domain[1]?.[0]?.change_type === "increase" ? <TrendingUp/> : <TrendingDown/>}
</Flex>
<Text
truncate
pl={2} pr={2}
borderRadius="lg"
bg="widgetBadgeBg"
color={alertColors[domain[1]?.[0]?.alert_level_name] || "text"}
bg="gray.800/50"
color={alertColors[domain[1]?.[0]?.alert_level_name] || "gray.100"}
fontWeight="semibold"
>
{domain[1]?.[0]?.alert_level_name}
@@ -5,17 +5,13 @@ import Plot from 'react-plotly.js';
import VdapApi from '../../hooks/useVdapApi.js';
import useBuildUrl from "@/hooks/useBuildUrl.js";
// 1. Import your central color dictionary
import { rawWidgetColors } from '../../theme.js';
export default function ExplosionEvents({ settings, widgetID }) {
// Plotly expects 'linear' for normal axes
const plotYAxisType = settings?.yAxisScale === 'log' ? 'log' : 'linear';
// 🎨 Let's check color mode so we can make people happy with light and dark
const { colorMode } = useColorMode();
// Assign the active palette based on the current mode
const plotColors = colorMode === 'dark' ? rawWidgetColors.dark : rawWidgetColors.light;
const isDark = colorMode === 'dark';
// Generate url with input dates, default to 7 day range
const url = useBuildUrl('/api/v2/explosion_events', settings?.startDate, settings?.endDate);
@@ -57,46 +53,58 @@ export default function ExplosionEvents({ settings, widgetID }) {
mode: 'markers',
marker: {
size: 7,
line: { width: .5, color: plotColors.text },
line: { width: .5, color: 'rgba(255, 255, 255, 0.7)' },
symbol: Symbolway[index % Symbolway.length],
},
// Replicating the clean D3/Observable tooltip
hovertemplate:
`<b>${volcanoName}</b><br>` +
'Date (UTC): %{x|%b %d %Y %H:%M}<br>' +
'Number of Explosions: %{y}<extra></extra>'
`<b>${volcanoName}</b><br>` +
'Date (UTC): %{x|%b %d %Y %H:%M}<br>' +
'Number of Explosions: %{y}<extra></extra>'
}));
}, [apiData, plotColors]);
}, [apiData]);
// 2. Build the Layout (Styling and Grid)
const layout = useMemo(() => {
return {
autosize: true,
paper_bgcolor: 'transparent',
paper_bgcolor: 'transparent', // Let Chakra UI background show through
plot_bgcolor: 'transparent',
font: { color: plotColors.muted },
font: { color: '#d1d5db' }, // gray.300
margin: { t: 40, r: 20, l: 20, b: 20 },
// title: {
// text: '7 Day Consolidated Flight Levels',
// font: { size: 16, color: 'white' },
// x: 0.05
// },
xaxis: {
title: {
text: 'Date (UTC)',
font: { color: plotColors.text, size: 12 }
font: { color: 'white', size: 12 }
},
type: 'date',
tickformat: '%b %d<br>%Y',
gridcolor: plotColors.grid,
zerolinecolor: plotColors.grid,
tickformat: '%b %d<br>%Y', // D3 requested %b %d \n %Y formatting
gridcolor: '#4b5563',
zerolinecolor: '#4b5563',
automargin: true,
},
yaxis: {
title: {
text: 'Number of Explosions',
font: { color: plotColors.text, size: 12 }
font: { color: 'white', size: 12 }
},
type: plotYAxisType,
gridcolor: plotColors.grid,
zerolinecolor: plotColors.text,
gridcolor: '#4b5563',
zerolinecolor: '#ffffff',
automargin: true,
},
// legend: {
// orientation: 'h',
// y: -0.2,
// x: 0.5,
// xanchor: 'center'
// },
hovermode: 'closest',
shapes: [
{
@@ -107,40 +115,40 @@ export default function ExplosionEvents({ settings, widgetID }) {
y0: 0,
y1: 0,
yref: 'y',
line: { color: plotColors.text, width: 1 }
line: { color: 'white', width: 1 }
}
],
};
}, [plotYAxisType, plotColors]);
}, [apiData, plotYAxisType]);
if (isLoading) return (
<Flex w="100%" h="100%" bg="transparent" align="center" justify="center">
<Spinner size="xl" color="blue.400" thickness="4px" />
</Flex>
<Flex w="100%" h="100%" bg="gray.800" borderRadius="md" align="center" justify="center">
<Spinner size="xl" color="blue.400" thickness="4px" />
</Flex>
);
if (error) return (
<Flex w="100%" h="100%" bg="transparent" align="center" justify="center" p={4}>
<Text color="red.400">{error}</Text>
</Flex>
<Flex w="100%" h="100%" bg="gray.800" borderRadius="md" align="center" justify="center" p={4}>
<Text color="red.400">{error}</Text>
</Flex>
);
if (plotTraces.length === 0) return (
<Flex height="100%" width="100%" align="center" justify="center" bg="transparent">
<Text color="var(--chakra-colors-widgetTextMuted)">No data available for current filter.</Text>
</Flex>
<Flex height="100%" width="100%" align="center" justify="center" bg="gray.800" borderRadius="md">
<Text color="gray.400">No data available for current filter.</Text>
</Flex>
);
return (
<Box height="100%" width="100%" bg="transparent" overflow="hidden">
<Plot
key={`${plotYAxisType}-${colorMode}`}
data={plotTraces}
layout={layout}
useResizeHandler={true}
style={{ width: '100%', height: '100%' }}
config={{ responsive: true, displayModeBar: true, displaylogo: false }}
/>
</Box>
<Box height="100%" width="100%" bg="transparent" borderRadius="md" p={2} overflow="hidden">
<Plot
key={plotYAxisType}
data={plotTraces}
layout={layout}
useResizeHandler={true} // Essential for dashboard grid resizing!
style={{ width: '100%', height: '100%' }}
config={{ responsive: true, displayModeBar: true, displaylogo: false }}
/>
</Box>
);
}
+23 -25
View File
@@ -43,31 +43,30 @@ export default function IvansAlerts({ settings, widgetID }) {
}).join('\n\n');
navigator.clipboard.writeText(dataText)
.then(() => {
alert('Copied to clipboard!');
alert('Copied to clipboard!');
})
.catch((err => {
console.error('Failed to copy: ', err);
console.error('Failed to copy: ', err);
}));
updateSettings(widgetID, {copyToClipboard: false});
}
}, [settings, some_data, widgetID, updateSettings]);
// Cleaned hardcoded grays for transparent so glass shell shows through
if (isLoading) return (
<Flex w="100%" h="100%" align="center" justify="center" borderRadius="lg" bg="transparent">
<Flex w="100%" h="100%" align="center" justify="center" borderRadius="lg" bg="gray.800">
<Spinner size="xl" color="blue.400" thickness="4px"/>
</Flex>
);
if (error) return (
<Flex w="100%" h="100%" align="center" justify="center" borderRadius="lg" bg="transparent">
<Flex w="100%" h="100%" align="center" justify="center" borderRadius="lg" bg="gray.800">
<Text color="red.400">{error}</Text>
</Flex>
);
if (some_data.length === 0) return (
<Flex w="100%" h="100%" align="center" justify="center" borderRadius="lg" bg="transparent">
<Text textAlign="center" color="widgetTextMuted">No flight level data available for the selected dates.</Text>
<Flex w="100%" h="100%" align="center" justify="center" borderRadius="lg" bg="gray.800">
<Text textAlign="center" color="gray.400">No flight level data available for the selected dates.</Text>
</Flex>
);
@@ -79,7 +78,7 @@ export default function IvansAlerts({ settings, widgetID }) {
p={2} gap={2}
overflow="auto"
borderRadius="xl"
bg="transparent" // Let the global widgetRecipe glass shell show through
bg="gray.800"
>
{some_data.map((item, index) => {
if (thisWidget?.size === "large") return (
@@ -97,31 +96,31 @@ export default function IvansAlerts({ settings, widgetID }) {
gap={2}
borderTopRadius="lg"
borderBottomRadius={collapsible.open ? "0" : "lg"}
bg="widgetItemBg"
bg="gray.600"
>
<Flex direction="column" w="100%" minW={0} textAlign="left" color="text">
<Flex direction="column" w="100%" minW={0} textAlign="left" color="gray.100">
<Text truncate>{item.volcano_name}</Text>
<Text truncate fontSize="xs" color="widgetTextMuted">{item.send_time}</Text>
<Text truncate fontSize="xs" color="gray.300/90">{item.send_time}</Text>
</Flex>
<Flex w="100%" minW={0} justify="right">
<Text truncate pl={2} pr={2} borderRadius="lg" bg="widgetBadgeBg" color="text" fontWeight="semibold">{item.report_num}</Text>
<Text truncate pl={2} pr={2} borderRadius="lg" bg="gray.800/50" color="gray.100" fontWeight="semibold">{item.report_num}</Text>
</Flex>
</Flex>
</Collapsible.Trigger>
<Collapsible.Content w="100%" h="auto">
{/* This box needs to be at h="100%" for the pdf toolbar to appear */}
<Box w="100%" h="100%" p={1} borderBottomRadius="lg" bg="widgetItemExpandedBg">
<Flex direction="column" gap={2} bg="widgetItemBg" borderRadius="lg" p={2} align="end">
<Text w="100%" h="100%" fontSize="sm" color="text" textAlign="left" whiteSpace="pre-line">{item?.summary}</Text>
<Text w="fit" fontSize="sm" color="text" pl={1} pr={1} bg="widgetBadgeBg" borderRadius="md">Preparer: {item?.preparer}</Text>
<Box w="100%" h="100%" p={1} borderBottomRadius="lg" bg="gray.700/45">
<Flex direction="column" gap={2} bg="gray.800/75" borderRadius="lg" p={2} align="end">
<Text w="100%" h="100%" fontSize="sm" color="gray.100" textAlign="left" whiteSpace="pre-line">{item?.summary}</Text>
<Text w="fit" fontSize="sm" color="gray.200" pl={1} pr={1} bg="gray.700/50" borderRadius="md">Preparer: {item?.preparer}</Text>
</Flex>
{item?.files?.map((file, index) => {
return (
<Box w="100%" h="100%" key={index} p={1}>
<br />
<Flex mb={2} justify="space-between">
<Text pl={1} pr={1} bg="widgetBadgeBg" borderRadius="md" fontSize="xs" color="text">{file?.name}</Text>
<Box borderRadius="lg" bg="widgetBadgeBg" color="text" pl={1} pr={1} fontSize={13} asChild>
<Text pl={1} pr={1} bg="gray.600/50" borderRadius="md" fontSize="xs" color="gray.300">{file?.name}</Text>
<Box borderRadius="lg" bg="gray.700" color="gray.300" pl={1} pr={1} fontSize={13} asChild>
<a href={`${file?.url}#view=FitV&toolbar=1`} target="_blank" rel="noopener noreferrer">
Open
</a>
@@ -132,8 +131,8 @@ export default function IvansAlerts({ settings, widgetID }) {
type="application/pdf"
style={{ width: '100%', height: '100%', display: 'block' }}
>
<Flex w="100%" h="100%" p={4} color="widgetTextMuted">
<Text mb={2}>
<Flex w="100%" h="100%" p={4} color="gray.400">
<Text mb={2} color="fg.muted">
Your browser cannot display this PDF directly.
</Text>
<a href={file?.url} target="_blank">
@@ -152,20 +151,19 @@ export default function IvansAlerts({ settings, widgetID }) {
)
else if (thisWidget?.size === "small") return (
<Flex direction="row"
key={index} // Added missing map key
w="100%"
justify="space-between" align="center"
p={1} pl={3} pr={3}
gap={2}
borderRadius="lg"
bg="widgetItemBg"
bg="gray.600"
>
<Flex direction="column" w="100%" minW={0} textAlign="left" color="text">
<Flex direction="column" w="100%" minW={0} textAlign="left" color="gray.100">
<Text truncate>{item.volcano_name}</Text>
<Text truncate fontSize="xs" color="widgetTextMuted">{item.send_time}</Text>
<Text truncate fontSize="xs" color="gray.300/90">{item.send_time}</Text>
</Flex>
<Flex w="100%" minW={0} justify="right">
<Text truncate pl={2} pr={2} borderRadius="lg" bg="widgetBadgeBg" color="text" fontWeight="semibold">{item.report_num}</Text>
<Text truncate pl={2} pr={2} borderRadius="lg" bg="gray.800/50" color="gray.100" fontWeight="semibold">{item.report_num}</Text>
</Flex>
</Flex>
)
+34 -31
View File
@@ -1,18 +1,10 @@
import { useMemo } from 'react';
import { Box, Flex, Spinner, Text } from "@chakra-ui/react";
import { useColorMode } from "@/components/ui/color-mode.jsx";
import Plot from 'react-plotly.js';
import VdapApi from '../../hooks/useVdapApi.js';
import { useMemo } from 'react';
import Plot from 'react-plotly.js';
import {Box, Flex, Spinner, Text} from "@chakra-ui/react";
import useBuildUrl from "@/hooks/useBuildUrl.js";
// 1. Import your central color dictionary
import { rawWidgetColors } from '../../theme.js';
export default function PlumeEvents({ settings, widgetID}) {
const { colorMode } = useColorMode();
// 2. Assign the active palette based on the current mode
const plotColors = colorMode === 'dark' ? rawWidgetColors.dark : rawWidgetColors.light;
// Build url, defaults to 7 days past
const url = useBuildUrl('/api/v2/plume_events', settings?.startDate, settings?.endDate);
@@ -52,7 +44,7 @@ export default function PlumeEvents({ settings, widgetID}) {
mode: 'markers',
marker: {
size: 7,
line: { width: .5, color: plotColors.text },
line: { width: .5, color: 'rgba(255, 255, 255, 0.7)' },
symbol: Symbolway[index % Symbolway.length],
},
// Replicating the clean D3/Observable tooltip
@@ -61,77 +53,88 @@ export default function PlumeEvents({ settings, widgetID}) {
'Date (UTC): %{x|%b %d %Y %H:%M}<br>' +
'Plume Height (m): %{y}<extra></extra>'
}));
}, [apiData, plotColors]);
}, [apiData]);
const layout = useMemo(() => {
return {
autosize: true,
paper_bgcolor: 'transparent', // Let Chakra UI background show through
plot_bgcolor: 'transparent',
font: { color: plotColors.muted },
font: { color: '#d1d5db' }, // gray.300
margin: { t: 40, r: 20, l: 20, b: 20 },
// title: {
// text: '7 Day Consolidated Flight Levels',
// font: { size: 16, color: 'white' },
// x: 0.05
// },
xaxis: {
title: {
text: 'Date (UTC)',
font: { color: plotColors.text, size: 12 }
font: { color: 'white', size: 12 }
},
type: 'date',
tickformat: '%b %d<br>%Y',
gridcolor: plotColors.grid,
zerolinecolor: plotColors.grid,
tickformat: '%b %d<br>%Y', // D3 requested %b %d \n %Y formatting
gridcolor: '#4b5563',
zerolinecolor: '#4b5563',
automargin: true,
},
yaxis: {
title: {
text: 'Plume Height',
font: { color: plotColors.text, size: 12 }
font: { color: 'white', size: 12 }
},
type: 'linear',
gridcolor: plotColors.grid,
zerolinecolor: plotColors.text,
gridcolor: '#4b5563',
zerolinecolor: '#ffffff',
automargin: true,
},
// legend: {
// orientation: 'h',
// y: -0.2,
// x: 0.5,
// xanchor: 'center'
// },
hovermode: 'closest',
shapes: [
{
type: 'line',
x0: 0,
x1: 1,
xref: 'paper',
xref: 'paper', // Spans entire chart width
y0: 0,
y1: 0,
yref: 'y',
line: { color: plotColors.text, width: 1 }
line: { color: 'white', width: 1 }
}
],
};
}, [plotColors]);
}, []);
if (isLoading) return (
<Flex w="100%" h="100%" bg="transparent" align="center" justify="center">
<Flex w="100%" h="100%" bg="gray.800" borderRadius="md" align="center" justify="center">
<Spinner size="xl" color="blue.400" thickness="4px" />
</Flex>
);
if (error) return (
<Flex w="100%" h="100%" bg="transparent" align="center" justify="center" p={4}>
<Flex w="100%" h="100%" bg="gray.800" borderRadius="md" align="center" justify="center" p={4}>
<Text color="red.400">{error}</Text>
</Flex>
);
if (plotTraces.length === 0) return (
<Flex height="100%" width="100%" align="center" justify="center" bg="transparent">
<Text color="widgetTextMuted">No data available for current filter.</Text>
<Flex height="100%" width="100%" align="center" justify="center" bg="gray.800" borderRadius="md">
<Text color="gray.400">No data available for current filter.</Text>
</Flex>
);
return (
<Box height="100%" width="100%" bg="transparent" overflow="hidden">
<Box height="100%" width="100%" bg="transparent" borderRadius="md" p={2} overflow="hidden">
<Plot
key={colorMode}
data={plotTraces}
layout={layout}
useResizeHandler={true}
useResizeHandler={true} // Essential for dashboard grid resizing!
style={{ width: '100%', height: '100%' }}
config={{ responsive: true, displayModeBar: true, displaylogo: false }}
/>
+24 -23
View File
@@ -52,25 +52,25 @@ export default function RemoteSensing({ settings, widgetID }) {
}, [settings, data, widgetID, updateSettings]);
if (isLoading) return (
<Flex w="100%" h="100%" align="center" justify="center" bg="transparent">
<Flex w="100%" h="100%" align="center" justify="center" borderRadius="md" bg="gray.800">
<Spinner size="xl" color="blue.400" thickness="4px"/>
</Flex>
);
if (error) return (
<Flex w="100%" h="100%" align="center" justify="center" p={4} bg="transparent">
<Flex w="100%" h="100%" align="center" justify="center" p={4} borderRadius="md" bg="gray.800">
<Text color="red.400">{error}</Text>
</Flex>
);
if (data.length === 0) return (
<Flex height="100%" width="100%" align="center" justify="center" bg="transparent">
<Text color="widgetTextMuted">No Remote Sensing data available this week.</Text>
<Flex height="100%" width="100%" align="center" justify="center" bg="gray.800" borderRadius="md">
<Text color="gray.400">No Remote Sensing data available this week.</Text>
</Flex>
);
return (
<Flex direction="column" w="100%" h="100%" pos="relative" justify="top" align="center" p={2} gap={2} overflow="auto" bg="transparent">
<Flex direction="column" w="100%" h="100%" pos="relative" justify="top" align="center" p={2} gap={2} overflow="auto" borderRadius="xl" bg="gray.800">
{data.map((item, index) => {
if (thisWidget?.size === "large" || thisWidget?.size === "medium") return (
<Collapsible.Root key={index} w="100%">
@@ -80,14 +80,14 @@ export default function RemoteSensing({ settings, widgetID }) {
<>
<Collapsible.Trigger w="100%" overflow="hidden">
<Flex direction="row" w="100%" h="100%" justify="space-between" align="center" gap={2} p={1} pl={3} pr={3}
borderTopRadius="lg" borderBottomRadius={collapsible.open ? "0" : "lg"} bg="widgetItemBg"
borderTopRadius="lg" borderBottomRadius={collapsible.open ? "0" : "lg"} bg="gray.600"
>
<Flex direction="column" w="100%" minW={0} textAlign="left" color="text">
<Flex direction="column" w="100%" minW={0} textAlign="left" color="gray.100">
<Text truncate>{item?.volcano_name}</Text>
<Text truncate fontSize="xs" color="widgetTextMuted">{item?.country}</Text>
<Text truncate fontSize="xs" color="gray.300/90">{item?.country}</Text>
</Flex>
<Flex w="100%" minW={0} justify="right">
<Text truncate pl={2} pr={2} borderRadius="lg" bg="widgetBadgeBg" color="text" fontSize="sm" fontWeight="semibold">
<Text truncate pl={2} pr={2} borderRadius="lg" bg="gray.800/50" color="gray.100" fontSize="sm" fontWeight="semibold">
{item?.report_time}
</Text>
</Flex>
@@ -95,10 +95,10 @@ export default function RemoteSensing({ settings, widgetID }) {
</Collapsible.Trigger>
<Collapsible.Content w="100%" h="auto">
{/* This box needs to be at h="100%" for the pdf toolbar to appear */}
<Box w="100%" h="100%" p={1} borderBottomRadius="lg" bg="widgetItemExpandedBg">
<Flex direction="column" gap={2} bg="widgetItemBg" borderRadius="lg" p={2} align="end">
<Text w="100%" h="100%" fontSize="sm" color="text" textAlign="left" whiteSpace="pre-line">{item?.summary}</Text>
<Text w="fit" fontSize="sm" color="text" pl={1} pr={1} bg="widgetBadgeBg" borderRadius="md">Source: {item?.sender}</Text>
<Box w="100%" h="100%" p={1} borderBottomRadius="lg" bg="gray.700/45">
<Flex direction="column" gap={2} bg="gray.800/75" borderRadius="lg" p={2} align="end">
<Text w="100%" h="100%" fontSize="sm" color="gray.100" textAlign="left" whiteSpace="pre-line">{item?.summary}</Text>
<Text w="fit" fontSize="sm" color="gray.200" pl={1} pr={1} bg="gray.700/50" borderRadius="md">Source: {item?.sender}</Text>
</Flex>
{item?.files?.map((file, index) => {
@@ -107,15 +107,15 @@ export default function RemoteSensing({ settings, widgetID }) {
<Box w="100%" h="100%" key={index} p={1}>
<br />
<Flex dir="row" justify="space-between" align="center" mb={2}>
<Text pl={1} pr={1} bg="widgetBadgeBg" borderRadius="md" fontSize="xs" color="text">{file?.name}</Text>
<Text pl={1} pr={1} bg="widgetBadgeBg" borderRadius="md" fontSize="xs" color="widgetTextMuted">PDF</Text>
<Text pl={1} pr={1} bg="gray.600/50" borderRadius="md" fontSize="xs" color="gray.300">{file?.name}</Text>
<Text pl={1} pr={1} bg="gray.600/50" borderRadius="md" fontSize="xs" color="gray.300/90">PDF</Text>
</Flex>
<object
data={`${file?.url}#view=FitH&toolbar=1`}
type="application/pdf"
style={{width: '100%', height: '100%', display: 'block'}}
>
<Flex w="100%" h="100%" p={4} color="widgetTextMuted">
<Flex w="100%" h="100%" p={4} color="gray.400">
<Text mb={2} color="fg.muted">
Your browser cannot display this PDF directly.
</Text>
@@ -132,8 +132,8 @@ export default function RemoteSensing({ settings, widgetID }) {
<Box key={index} w="100%" h="100%" p={1}>
<br />
<Flex dir="row" justify="space-between" align="center" mb={2}>
<Text pl={1} pr={1} bg="widgetBadgeBg" borderRadius="md" fontSize="xs" color="text">{file?.name}</Text>
<Text pl={1} pr={1} bg="widgetBadgeBg" borderRadius="md" fontSize="xs" color="widgetTextMuted">PNG</Text>
<Text pl={1} pr={1} bg="gray.600/50" borderRadius="md" fontSize="xs" color="gray.300">{file?.name}</Text>
<Text pl={1} pr={1} bg="gray.600/50" borderRadius="md" fontSize="xs" color="gray.300/90">PNG</Text>
</Flex>
<a href={file?.url} target="_blank" rel="noopener noreferrer">
<img src={file?.url} alt={file?.name} />
@@ -146,7 +146,7 @@ export default function RemoteSensing({ settings, widgetID }) {
<>
<br />
<Flex key={index} dir="row" w="100%" h="100%" p={1} align="center" justify="space-between">
<Text pl={1} pr={1} bg="widgetBadgeBg" borderRadius="md" fontSize="xs" color="text">{file?.name}</Text>
<Text pl={1} pr={1} bg="gray.600/50" borderRadius="md" fontSize="xs" color="gray.300">{file?.name}</Text>
<Button asChild variant="surface" size="xxs" fontSize="xs" pl={2} pr={2}>
<a href={file?.url} target="_blank" rel="noopener noreferrer">Download</a>
</Button>
@@ -162,17 +162,17 @@ export default function RemoteSensing({ settings, widgetID }) {
</Collapsible.Root>
)
else if (thisWidget?.size === "small") return (
<Flex key={index} direction="row" w="100%" justify="space-between" align="center" gap={2} p={1} pl={3} pr={3} borderRadius="lg" bg="widgetItemBg">
<Flex direction="column" w="100%" minW={0} textAlign="left" color="text">
<Flex key={index} direction="row" w="100%" justify="space-between" align="center" gap={2} p={1} pl={3} pr={3} borderRadius="lg" bg="gray.600">
<Flex direction="column" w="100%" minW={0} textAlign="left" color="gray.100">
<Text truncate>{item?.volcano_name}</Text>
<Text truncate fontSize="xs" color="widgetTextMuted">{item?.country}</Text>
<Text truncate fontSize="xs" color="gray.300/90">{item?.country}</Text>
</Flex>
<Flex w="100%" minW={0} justify="right">
<Text
truncate
pl={2} pr={2}
borderRadius="lg"
bg="widgetBadgeBg" color="text"
bg="gray.800/50" color="gray.100"
fontSize="sm" fontWeight="semibold"
>
{item?.report_time}
@@ -185,6 +185,7 @@ export default function RemoteSensing({ settings, widgetID }) {
);
}
function ascTimeVolcanoSort(a, b) {
if (a.volcano_name < b.volcano_name) return -1
else if (a.volcano_name > b.volcano_name) return 1
+29 -26
View File
@@ -1,18 +1,10 @@
import VdapApi from '../../hooks/useVdapApi.js';
import { useMemo } from 'react';
import Plot from 'react-plotly.js';
import { Box, Flex, Spinner, Text } from "@chakra-ui/react";
import {Box, Flex, Spinner, Text} from "@chakra-ui/react";
import useBuildUrl from "@/hooks/useBuildUrl.js";
// 1. Import Chakra color mode and your central color dictionary
import { useColorMode } from "@/components/ui/color-mode.jsx";
import { rawWidgetColors } from '../../theme.js';
export default function SeismicEvents({ settings, widgetID}) {
const { colorMode } = useColorMode();
// 2. Assign the active palette based on the current mode
const plotColors = colorMode === 'dark' ? rawWidgetColors.dark : rawWidgetColors.light;
// build url, defaults to 7 days past
const url = useBuildUrl('/api/v2/seismic_events', settings?.startDate, settings?.endDate);
@@ -52,7 +44,7 @@ export default function SeismicEvents({ settings, widgetID}) {
mode: 'markers',
marker: {
size: 7,
line: { width: .5, color: plotColors.text },
line: { width: .5, color: 'rgba(255, 255, 255, 0.7)' },
symbol: Symbolway[index % Symbolway.length],
},
// Replicating the clean D3/Observable tooltip
@@ -61,36 +53,48 @@ export default function SeismicEvents({ settings, widgetID}) {
'Date (UTC): %{x|%b %d %Y %H:%M}<br>' +
'Number of Seismic Events: %{y}<extra></extra>'
}));
}, [apiData, plotColors]);
}, [apiData]);
const layout = useMemo(() => {
return {
autosize: true,
paper_bgcolor: 'transparent', // Let Chakra UI background show through
plot_bgcolor: 'transparent',
font: { color: plotColors.muted },
font: { color: '#d1d5db' }, // gray.300
margin: { t: 40, r: 20, l: 20, b: 20 },
// title: {
// text: '',
// font: { size: 16, color: 'white' },
// x: 0.05
// },
xaxis: {
title: {
text: 'Date (UTC)',
font: { color: plotColors.text, size: 12 }
font: { color: 'white', size: 12 }
},
type: 'date',
tickformat: '%b %d<br>%Y', // D3 requested %b %d \n %Y formatting
gridcolor: plotColors.grid,
zerolinecolor: plotColors.grid,
gridcolor: '#4b5563',
zerolinecolor: '#4b5563',
automargin: true,
},
yaxis: {
title: {
text: 'Seismic Count',
font: { color: plotColors.text, size: 12 }
font: { color: 'white', size: 12 }
},
type: 'linear',
gridcolor: plotColors.grid,
zerolinecolor: plotColors.text,
gridcolor: '#4b5563',
zerolinecolor: '#ffffff',
automargin: true,
},
// legend: {
// orientation: 'h',
// y: -0.2,
// x: 0.5,
// xanchor: 'center'
// },
hovermode: 'closest',
shapes: [
{
@@ -101,34 +105,33 @@ export default function SeismicEvents({ settings, widgetID}) {
y0: 0,
y1: 0,
yref: 'y',
line: { color: plotColors.text, width: 1 }
line: { color: 'white', width: 1 }
}
],
};
}, [plotColors]);
}, []);
if (isLoading) return (
<Flex w="100%" h="100%" bg="transparent" align="center" justify="center">
<Flex w="100%" h="100%" bg="gray.800" borderRadius="md" align="center" justify="center">
<Spinner size="xl" color="blue.400" thickness="4px" />
</Flex>
);
if (error) return (
<Flex w="100%" h="100%" bg="transparent" align="center" justify="center" p={4}>
<Flex w="100%" h="100%" bg="gray.800" borderRadius="md" align="center" justify="center" p={4}>
<Text color="red.400">{error}</Text>
</Flex>
);
if (plotTraces.length === 0) return (
<Flex height="100%" width="100%" align="center" justify="center" bg="transparent">
<Text color="var(--chakra-colors-widgetTextMuted)">No data available for current filter.</Text>
<Flex height="100%" width="100%" align="center" justify="center" bg="gray.800" borderRadius="md">
<Text color="gray.400">No data available for current filter.</Text>
</Flex>
);
return (
<Box height="100%" width="100%" bg="transparent" overflow="hidden">
<Box height="100%" width="100%" bg="transparent" borderRadius="md" p={2} overflow="hidden">
<Plot
key={colorMode}
data={plotTraces}
layout={layout}
useResizeHandler={true} // Essential for dashboard grid resizing!
@@ -1,18 +1,11 @@
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';
import { useColorMode } from "@/components/ui/color-mode.jsx";
// Import central color dictionary
import { rawWidgetColors } from '../../theme.js'; // Adjust path if needed
import VdapApi from '../../hooks/useVdapApi.js'; // Adjust path as needed
export default function VaaActivity7Day({ settings, widgetID }) {
const { colorMode } = useColorMode();
// 2. Assign the active palette based on the current mode
const plotColors = colorMode === 'dark' ? rawWidgetColors.dark : rawWidgetColors.light;
console.log("3. Chart received settings:", settings);
// Plotly expects 'linear' for normal axes
const plotYAxisType = settings?.yAxisScale === 'symlog' ? 'symlog' : 'linear';
// Clean, single-line data fetching
@@ -24,10 +17,13 @@ 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'
];
// Sort data descending by flight level (matching Observable behavior)
const sortedData = [...apiData].sort((a, b) => b.obs_fl - a.obs_fl);
// Efficiently group into Plotly traces by volcano
@@ -48,90 +44,102 @@ export default function VaaActivity7Day({ settings, widgetID }) {
mode: 'markers',
marker: {
size: 7,
line: { width: 0.5, color: plotColors.text },
line: { width: .5, color: 'rgba(255, 255, 255, 0.7)' },
symbol: Symbolway[index % Symbolway.length],
},
// Replicating the clean Observable tooltip
hovertemplate:
`<b>${volcanoName}</b><br>` +
'Date: %{x|%b %d %Y %H:%M}<br>' +
'Flight Level: %{y}<extra></extra>'
`<b>${volcanoName}</b><br>` +
'Date: %{x|%b %d %Y %H:%M}<br>' +
'Flight Level: %{y}<extra></extra>'
}));
}, [apiData, plotColors]);
}, [apiData]);
// 2. Build the Layout (Styling and Grid)
const layout = useMemo(() => {
return {
autosize: true,
paper_bgcolor: 'transparent',
paper_bgcolor: 'transparent', // Let Chakra UI background show through
plot_bgcolor: 'transparent',
font: { color: plotColors.muted },
font: { color: '#d1d5db' }, // gray.300
margin: { t: 40, r: 20, l: 20, b: 20 },
// title: {
// text: '7 Day Consolidated Flight Levels',
// font: { size: 16, color: 'white' },
// x: 0.05
// },
xaxis: {
title: {
text: 'Date (UTC)',
font: { color: plotColors.text, size: 12 }
font: { color: 'white', size: 12 }
},
type: 'date',
tickformat: '%b %d<br>%Y %H:%M',
gridcolor: plotColors.grid,
zerolinecolor: plotColors.grid,
tickformat: '%b %d<br>%Y %H:%M', // Multiline ticks from Observable
gridcolor: '#4b5563',
zerolinecolor: '#4b5563',
automargin: true,
},
yaxis: {
title: {
text: 'Flight Level',
font: { color: plotColors.text, size: 12 }
font: { color: 'white', size: 12 }
},
type: plotYAxisType,
gridcolor: plotColors.grid,
zerolinecolor: plotColors.text,
gridcolor: '#4b5563',
zerolinecolor: '#ffffff',
automargin: true,
},
// legend: {
// orientation: 'h',
// y: -0.2,
// x: 0.5,
// xanchor: 'center'
// },
hovermode: 'closest',
shapes: [
{
type: 'line',
x0: 0,
x1: 1,
xref: 'paper',
xref: 'paper', // Spans entire chart width
y0: 0,
y1: 0,
yref: 'y',
line: { color: plotColors.text, width: 1 }
line: { color: 'white', width: 1 }
}
],
};
}, [plotYAxisType, plotColors]);
}, [apiData, plotYAxisType]);
if (isLoading) return (
<Flex w="100%" h="100%" bg="transparent" align="center" justify="center">
<Spinner size="xl" color="blue.400" thickness="4px" />
</Flex>
<Flex w="100%" h="100%" bg="gray.800" borderRadius="md" align="center" justify="center">
<Spinner size="xl" color="blue.400" thickness="4px" />
</Flex>
);
if (error) return (
<Flex w="100%" h="100%" bg="transparent" align="center" justify="center" p={4}>
<Text color="red.400">{error}</Text>
</Flex>
<Flex w="100%" h="100%" bg="gray.800" borderRadius="md" align="center" justify="center" p={4}>
<Text color="red.400">{error}</Text>
</Flex>
);
if (plotTraces.length === 0) return (
<Flex height="100%" width="100%" align="center" justify="center" bg="transparent">
<Text color="widgetTextMuted">No flight level data available.</Text>
</Flex>
<Flex height="100%" width="100%" align="center" justify="center" bg="gray.800" borderRadius="md">
<Text color="gray.400">No flight level data available.</Text>
</Flex>
);
return (
<Box height="100%" width="100%" bg="transparent" overflow="hidden">
<Plot
key={`${plotYAxisType}-${colorMode}`}
data={plotTraces}
layout={layout}
useResizeHandler={true}
style={{ width: '100%', height: '100%' }}
config={{ responsive: true, displayModeBar: true, displaylogo: false }}
/>
</Box>
<Box height="100%" width="100%" bg="gray.800" borderRadius="md" p={2} overflow="hidden">
<Plot
key={plotYAxisType}
data={plotTraces}
layout={layout}
useResizeHandler={true} // Essential for dashboard grid resizing!
style={{ width: '100%', height: '100%' }}
config={{ responsive: true, displayModeBar: true, displaylogo: false }}
/>
</Box>
);
}
@@ -4,23 +4,21 @@ import {useDashboardStore} from "@/store/useDashboardStore.jsx";
export default function IvansAlertsSettings({ widgetId, currentSettings }) {
const updateSettings = useDashboardStore(state => state.updateWidgetSettings);
console.log("currentSettings:", currentSettings);
return (
<Flex flexDirection="column" justifyContent="space-between" align="center" gap={2} pb={2}>
<Flex flexDirection="column" justifyContent="space-between" gap={2} pb={2}>
{/* SLIDER DATE RANGE SELECTION */}
<Slider.Root
w="90%" h="100%"
width="80%" h="100%"
min={1} max={14}
defaultValue={[1]}
defaultValue={[7]}
step={1}
onValueChangeEnd={(e) => {
console.log("change end", e);
const day = new Date(Date.now() - (e.value[0])*86400000).toLocaleDateString('en-CA');
console.log("new start: ", day);
updateSettings(widgetId, {...currentSettings, startDate: day});
}}
>
<Slider.Label>{currentSettings?.startDate} to {currentSettings?.endDate}</Slider.Label>
<Slider.Label>{currentSettings?.endDate} to {currentSettings?.startDate}</Slider.Label>
<Slider.Control>
<Slider.Track>
<Slider.Range />
@@ -38,11 +38,9 @@ export function SettingsButton() {
const [canScrollRight, setCanScrollRight] = useState(false);
// Pull the glass container styles for the dropdown and modal
const popoverRecipe = useSlotRecipe({ key: "glassPopover" });
const popoverStyles = popoverRecipe();
const dialogRecipe = useSlotRecipe({ key: "glassDialog" });
const dialogStyles = dialogRecipe();
const panelRecipe = useSlotRecipe({key: "glassPanel"});
const panelStyles = panelRecipe({layout: "dropdown"});
const modalStyles = panelRecipe({layout: "popover"});
const [isLibraryOpen, setIsLibraryOpen] = useState(false);
@@ -132,7 +130,7 @@ export function SettingsButton() {
</Menu.Trigger>
<Menu.Positioner>
<Menu.Content css={popoverStyles.content} zIndex="dropdown" minW="200px">
<Menu.Content css={panelStyles.root} zIndex="dropdown" minW="200px">
<Menu.Item
onClick={enterEditMode}
cursor="pointer"
@@ -170,13 +168,12 @@ export function SettingsButton() {
{/* Soft blur can be added to the background behind the modal */}
{/*<Dialog.Backdrop bg="blackAlpha.100" backdropFilter="blur(2px)"/>*/}
<Dialog.Positioner>
<Dialog.Content css={dialogStyles.content}>
<Dialog.Header css={dialogStyles.header}>
<Dialog.Content css={modalStyles.root}>
<Dialog.Header>
<Dialog.Title>Widgets Shop</Dialog.Title>
</Dialog.Header>
<Dialog.Body css={dialogStyles.body}>
<Dialog.Body>
<Tabs.Root defaultValue={categories[0]} variant="unstyled">
{/* HORIZONTAL SCROLLABLE MENU OF WIDGET CATEGORIES */}
<Box>
@@ -249,6 +246,7 @@ export function SettingsButton() {
h="24px"
flexShrink={0}
borderRadius="full"
// bg={{base: "blue.50", _dark: "whiteAlpha.200"}}
fontWeight="black"
fontSize="xs"
bg='transparent'
+17 -17
View File
@@ -50,8 +50,8 @@ export const WIDGET_REGISTRY = {
name: "IVANS",
category: "Communications",
description: "Feed of recent IVANS reports and reviewer statuses.",
component: lazy(() => import('../components/Widgets/IvansAlerts.jsx')),
settingsComponent: lazy(() => import('../components/Widgets/settings/IvansAlertsSettings.jsx')),
component: lazy(() => import('../components/widgets/IvansAlerts.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/IvansAlertsSettings.jsx')),
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
@@ -72,8 +72,8 @@ export const WIDGET_REGISTRY = {
name: "Remote Sensing",
category: "Remote Sensing",
description: "Feed of recent remote sensing reports.",
component: lazy(() => import('../components/Widgets/RemoteSensing.jsx')),
settingsComponent: lazy(() => import('../components/Widgets/Settings/RemoteSensingSettings.jsx')),
component: lazy(() => import('../components/widgets/RemoteSensing.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/RemoteSensingSettings.jsx')),
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
@@ -94,8 +94,8 @@ export const WIDGET_REGISTRY = {
name: "Alert Level Changes",
category: "Daily Alerts",
description: "List of 7-day alert level changes with trend arrows.",
component: lazy(() => import('../components/Widgets/AlertChanges.jsx')),
settingsComponent: lazy(() => import('../components/Widgets/settings/AlertChangeSettings.jsx')),
component: lazy(() => import('../components/widgets/AlertChanges.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/AlertChangeSettings.jsx')),
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
@@ -111,7 +111,7 @@ export const WIDGET_REGISTRY = {
category: "Daily Volcanic Activity",
description: "List of explosion events over a specified time period.",
component: lazy(() => import('../components/Widgets/ExplosionEvents.jsx')),
component: lazy(() => import('../components/widgets/ExplosionEvents.jsx')),
// The specific settings UI for this widget
settingsComponent: lazy(() => import('../components/widgets/settings/ExplosionEventsSettings.jsx')),
@@ -131,8 +131,8 @@ export const WIDGET_REGISTRY = {
name: "Plume Events",
category: "Daily Volcanic Activity",
description: "Plot of explosion heights over a weeks time.",
component: lazy(() => import('../components/Widgets/PlumeEvents.jsx')),
settingsComponent: lazy(() => import('../components/Widgets/settings/PlumeEventsSettings.jsx')),
component: lazy(() => import('../components/widgets/PlumeEvents.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/PlumeEventsSettings.jsx')),
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
@@ -146,8 +146,8 @@ export const WIDGET_REGISTRY = {
name: "Seismic Events",
category: "Daily Volcanic Activity",
description: "Plot of number of seismic events over a weeks time.",
component: lazy(() => import('../components/Widgets/SeismicEvents.jsx')),
settingsComponent: lazy(() => import('../components/Widgets/settings/SeismicEventsSettings.jsx')),
component: lazy(() => import('../components/widgets/SeismicEvents.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/SeismicEventsSettings.jsx')),
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
@@ -161,7 +161,7 @@ export const WIDGET_REGISTRY = {
name: "Alert Level Changes Quad Plot",
category: "Computer Science",
description: "Percentage of TP, TN, FP, and FN changes in viable alert levels.",
component: lazy(() => import('../components/Widgets/LlmAlChangesQuadPlot.jsx')),
component: lazy(() => import('../components/widgets/LlmAlChangesQuadPlot.jsx')),
allowedSizes: {
medium: { w: 3, h: 12 }
}
@@ -171,8 +171,8 @@ export const WIDGET_REGISTRY = {
name: "Communication Coordinator Report",
category: "Daily Volcanic Activity",
description: "Generated Report",
component: lazy(() => import('../components/Widgets/CommCoorReport.jsx')),
settingsComponent: lazy(() => import('../components/Widgets/settings/CommCoorReportSettings.jsx')),
component: lazy(() => import('../components/widgets/CommCoorReport.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/CommCoorReportSettings.jsx')),
defaultSettings: {
copyToClipboard: false,
downloadReport: false,
@@ -188,8 +188,8 @@ export const WIDGET_REGISTRY = {
name: "VAA Polygon Projections Map",
category: "Maps",
description: "By selecting a volcano, the map will take you to it and show a polygon of the ash in 8, 12, and 18 hours",
component: lazy(() => import('../components/Widgets/VaaMap.jsx')),
settingsComponent: lazy(() => import('../components/Widgets/settings/VaaMapSettings.jsx')),
component: lazy(() => import('../components/widgets/VaaMap.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/VaaMapSettings.jsx')),
defaultSettings: {
position: [45.61142, -122.49630], // CVO's coordinates
startDate: getToday(),
@@ -209,7 +209,7 @@ export const WIDGET_REGISTRY = {
name: "Travel Gantt Chart",
category: "Communications",
description: "View upcoming travels in a gantt chart",
component: lazy(() => import('../components/Widgets/TravelGanttChart.jsx')),
component: lazy(() => import('../components/widgets/TravelGanttChart.jsx')),
allowedSizes: {
medium: { w: 6, h: 12 }
}
+17 -14
View File
@@ -29,14 +29,11 @@ export default function MyDashboard() {
const hasHydrated = useRef(false);
// 1. Pull the global slot recipes
const widgetRecipe = useSlotRecipe({ key: "widget" });
const popoverRecipe = useSlotRecipe({ key: "glassPopover" });
const recipe = useSlotRecipe({key: "glassPanel"});
const styles = recipe({ layout: "widget" });
const popoverStyles = recipe({ layout: "popover" });
// 2. Pass the editing state directly into the widget recipe!
const widgetStyles = widgetRecipe({ mode: isEditing ? "editing" : undefined });
const popoverStyles = popoverRecipe();
// 3. Populate widgets
// 2. Populate widgets
useEffect(() => {
if (user?.preferences?.dashboard_layout && !hasHydrated.current) {
const savedLayout = user.preferences.dashboard_layout;
@@ -58,7 +55,7 @@ export default function MyDashboard() {
isResizable: false // The magic lock! No resizing allowed globally.
}));
// 4. The component mapper
// 3. The component mapper
const renderWidget = (widget) => {
const registryEntry = WIDGET_REGISTRY[widget.type];
@@ -70,7 +67,7 @@ export default function MyDashboard() {
return (
<>
<Box css={widgetStyles.header}>
<Box css={styles.header}>
<Text>
{registryEntry.name}
</Text>
@@ -86,7 +83,7 @@ export default function MyDashboard() {
{/* NEW: The Positioner lifts the content out of the Flexbox flow */}
<Popover.Positioner zIndex={1}>
<Popover.Content css={popoverStyles.content}>
<Popover.Content css={popoverStyles.root}>
<Suspense fallback={<Spinner size="sm"/>}>
<SettingsUI
widgetId={widget.id}
@@ -99,7 +96,7 @@ export default function MyDashboard() {
)}
</Box>
<Box css={widgetStyles.body}>
<Box css={styles.body}>
<Component settings={widget.settings || {}} widgetID={widget.id || {}}/>
</Box>
</>
@@ -108,7 +105,7 @@ export default function MyDashboard() {
// Fallback if someone asks for a widget that doesn't exist
return (
<Flex css={widgetStyles.body} align="center" justify="center" direction="column">
<Flex css={styles.body} align="center" justify="center" direction="column">
<Text fontWeight="bold" color="red.400">Error</Text>
<Text fontSize="sm" color="gray.400">Widget '{widget.type}' not found.</Text>
</Flex>
@@ -132,7 +129,13 @@ export default function MyDashboard() {
{widgets.map(widget => (
<Box
key={widget.id}
css={widgetStyles.root}
css={styles.root}
// Grid-specific state overrides remain inline
boxShadow={isEditing ? "outline" : styles.root.boxShadow}
borderStyle={isEditing ? "dashed" : "solid"}
borderWidth={isEditing ? "2px" : "1px"}
borderColor={isEditing ? "orange.300" : styles.root.borderColor}
cursor={isEditing ? "grab" : "default"}
position="relative" // REQUIRED so the absolute button stays inside this box
>
{/* THE DELETE BUTTON */}
@@ -160,7 +163,7 @@ export default function MyDashboard() {
{/* SUSPENSE BOUNDARY wrapping the render function */}
<Suspense fallback={
<Flex css={widgetStyles.body} align="center" justify="center">
<Flex css={styles.body} align="center" justify="center">
<Spinner size="md" color="blue.400" thickness="3px"/>
</Flex>
}>
+5
View File
@@ -46,6 +46,11 @@ const useAuthStore = create((set) => ({
// Hit the new lightweight endpoint
const res = await api.get('session/');
// 🔨 Security Fix a broken API call, Verify we actually got a user object back, not HTML fallback text
if (typeof res.data === 'string' || !res.data.username) {
throw new Error("Received invalid data format instead of user session");
}
// Rehydrate the store with the user's info!
set({
isAuthenticated: true,
+387 -226
View File
@@ -1,25 +1,11 @@
import {defineSlotRecipe, createSystem, defaultConfig, defineConfig, defineRecipe} from "@chakra-ui/react";
// REUSABLE GLASS SURFACE
const glassSurface = {
bg: {base: "rgba(255, 255, 255, 0.4)", _dark: "rgba(255, 255, 255, 0.04)"},
backdropFilter: "blur(12px)",
WebkitBackdropFilter: "blur(12px)",
border: "1px solid",
borderColor: {base: "gray.200", _dark: "whiteAlpha.200"},
boxShadow: "sm",
};
/* ==========================================================================
RECIPES
========================================================================== */
// 1. Header
// CONSOLIDATED ✔
const headerRecipe = defineSlotRecipe({
slots: ["root", "search_bar", "user_info"],
base: {
root: {
bg: "transparent",
bg: "{transparent}",
color: "text",
width: "100%",
height: "100%",
@@ -34,7 +20,7 @@ const headerRecipe = defineSlotRecipe({
// input element in search bar component
"& input": {
width: "410px",
},
}
},
user_info: {
flexDirection: "row",
@@ -46,29 +32,21 @@ const headerRecipe = defineSlotRecipe({
// The Text component
"& p": {
fontWeight: "600",
fontSize: "md",
},
},
fontSize: "md" // equivalent to 16px
}
}
},
});
// 2. Sidebar
// CONSOLIDATED ✔
const sidebarRecipe = defineSlotRecipe({
slots: [
"root",
"logo",
"logo_text",
"footer",
"button_text",
"buttons",
"collapse_button",
"color_mode_button",
],
slots: ["root", "logo", "logo_text", "footer", "button_text", "buttons", "collapse_button", "color_mode_button"],
base: {
root: {
// 1. Semi-transparent backgrounds
bg: {
base: "linear-gradient(to bottom right, #97282880 20%, #EB7F3160 60%, #FCAD3840 100%)",
// base: "linear-gradient(to bottom right, #99000040 20%, #FF660040 60%, #EEEE0040 100%)", // this is too pale for light mode imo
base: "linear-gradient(to bottom right, #97282880 20%, #EB7F3160 60%, #FCAD3840 100%)", // colors from: https://colorhunt.co/palette/972828e45742eb7f31fcad38
_dark: "linear-gradient(to bottom right, #9900003C 20%, #FF66003C 60%, #FFC0003C 100%)"
},
@@ -84,6 +62,8 @@ const sidebarRecipe = defineSlotRecipe({
borderRight: "none",
borderRadius: "2xl",
// boxShadow: "0 4px 30px rgba(0, 0, 0, 0.1)",
// boxShadow: "-10px 4px 30px rgba(0, 0, 0, 0.1)",
width: "100%",
height: "calc(100% - 16px)",
margin: "8px",
@@ -112,18 +92,18 @@ const sidebarRecipe = defineSlotRecipe({
"& svg": {
transition: "stroke-width 0.4s ease",
flexShrink: "0",
flexShrink: "0"
},
_hover: {
bg: "rgba(255, 255, 255, 0.2)",
color: "{text}",
"& svg": {
strokeWidth: "3",
strokeWidth: "3"
},
"& span": {
fontWeight: "700",
},
}
},
fontSize: "l",
@@ -142,8 +122,12 @@ const sidebarRecipe = defineSlotRecipe({
_hover: {
bg: "{MainBackground}",
color: "{textInverted}",
"& svg": { strokeWidth: "2" },
"& span": { fontWeight: "500" },
"& svg": {
strokeWidth: "2" // Keeps the active icon at normal thickness on hover
},
"& span": {
fontWeight: "500",
}
},
// The Top Inverted Curve
@@ -172,7 +156,7 @@ const sidebarRecipe = defineSlotRecipe({
WebkitMaskImage: "radial-gradient(circle at bottom left, transparent 25px, black 25.5px)",
maskImage: "radial-gradient(circle at bottom left, transparent 25px, black 25.5px)",
pointerEvents: "none",
},
}
},
},
logo: {
@@ -213,8 +197,30 @@ const sidebarRecipe = defineSlotRecipe({
_hover: {
bg: "transparent",
},
},
},
}
}
// opened_theme_button: {
// width: "100%",
// align: "center",
// justifyContent: "right",
// mr: 6,
// // "& button": {
// // alignSelf: "center",
// // transition: "opacity 0.3s ease, visibility 0.3s ease, margin 0.3s ease",
// // _hover: {
// // bg: "transparent",
// // }
// // }
// },
// closed_theme_button: {
// // ml: 0.9,
// // "& button": {
// // transition: "opacity 0.3s ease, visibility 0.3s ease, margin 0.3s ease",
// // _hover: {
// // bg: "transparent",
// // }
// // }
// },
},
variants: {
state: {
@@ -244,7 +250,7 @@ const sidebarRecipe = defineSlotRecipe({
}
});
// 3. Dashboard Shell
// CONSOLIDATED ✔
const dashboardRecipe = defineRecipe({
base: {
height: "100vh",
@@ -259,7 +265,7 @@ const dashboardRecipe = defineRecipe({
}
});
// 4. Home Page Tabs
// CONSOLIDATED ✔
const homeRecipe = defineSlotRecipe({
slots: ["root", "header", "body"],
base: {
@@ -284,52 +290,305 @@ const homeRecipe = defineSlotRecipe({
"& > div": {
alignItems: "center",
gap: 2,
},
// icon in each tab button
"& svg": {
// TODO: bring over svg styling
}
}
},
body: {
flex: 1,
overflow: "auto",
},
}
},
});
})
// 5. Dashboard Widget Card
const widgetRecipe = defineSlotRecipe({
// const canvasRecipe = defineRecipe({
// base: {
// bg: "{transparent}",
// zIndex: "-1",
// color: "{text}"
// }
// });
// const widgetRecipe = defineSlotRecipe({
// slots: ["root", "header", "canvas"],
// base: {
// root: {
// flexDirection: "column",
// gap: "1",
// position: "relative",
// bg: "base100",
// borderRadius: "md",
// p: "1",
// paddingBottom: "2",
// border: "1px solid",
// borderColor: "{base300}",
// textAlign: "center",
// height: "100%",
// // position: "fixed"
// },
// header: {
// flexShrink: "0",
// bg: "{base300}",
// color: "{text}",
// cursor: "move",
// borderRadius: "sm",
// whiteSpace: "nowrap",
// textAlign: "left",
// pl: "2"
// },
// canvas: {
// flex: "1 1 auto",
// bg: "transparent",
// color: "{text}",
// cursor: "default",
// borderRadius: "md",
// overflow: "auto",
// }
// }
// });
// USED IN COMPONENTS:
// * Settings Button
// * My Dashboard
const glassPanelRecipe = defineSlotRecipe({
slots: ["root", "header", "body"],
// 🧊 THE GLASS MATH (Applies to everything)
base: {
root: {
display: "flex",
flexDirection: "column",
position: "relative",
...glassSurface,
width: "100%",
height: "100%",
borderRadius: "3xl",
overflow: "hidden",
},
header: {
display: "flex",
justifyContent: "space-between",
alignItems: "center",
px: 3,
pt: 2,
pb: 0,
"& > p": {
color: "titleColor",
fontWeight: "500",
fontSize: "16px",
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "clip",
},
"& > button": {
borderRadius: "xl",
_hover: {color: "white", bg: "gray.500"},
},
},
body: {flex: "1", overflow: "hidden", position: "relative", px: 1, pb: 1, pt: 0},
bg: {base: "rgba(255, 255, 255, 0.4)", _dark: "rgba(255, 255, 255, 0.04)"},
backdropFilter: "blur(12px)",
WebkitBackdropFilter: "blur(12px)",
border: "1px solid",
borderColor: {base: "gray.200", _dark: "whiteAlpha.200"},
boxShadow: "sm",
}
},
// 📏 THE LAYOUTS (Applies selectively)
variants: {
layout: {
widget: {
root: {
width: "100%",
height: "100%",
borderRadius: "3xl",
},
header: {
display: "flex",
justifyContent: "space-between",
alignItems: "center",
px: 3,
pt: 2,
pb: 0,
"& > p": {
color: "titleColor",
fontWeight: "500",
fontSize: "16px",
// the following three specifications are equivalent to Chakra's 'truncate' prop
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "clip",
},
"& > button": {
borderRadius: "xl",
_hover: {
color: "white",
bg: "gray.500",
},
}
},
body: {
flex: "1",
overflow: "hidden",
position: "relative",
px: 1,
pb: 1,
pt: 0
}
},
dropdown: {
root: {
borderRadius: "xl",
p: 1
}
// (Header and body slots are ignored here because dropdowns don't use them)
},
popover: {
root: {
borderRadius: "2xl",
p: 0,
boxShadow: "xl",
minW: "240px",
maxW: "60%",
minH: "80%",
overflow: "hidden",
// OVERRIDES: Make the background 85-90% opaque instead of 40%
bg: {
base: "rgba(255, 255, 255, 0.75)",
_dark: "rgba(20, 22, 25, 0.8)"
},
// OVERRIDES: Increase the blur just to smooth out any stubborn gridlines
backdropFilter: "blur(15px)",
WebkitBackdropFilter: "blur(15px)",
// IMPORTANT: everything below is specific to the widget menu found in the settingsButton component
// dialog header
"& > div.chakra-dialog__header": {
bg: "transparent",
color: {
base: "gray.800",
_dark: "white"
},
py: 4,
borderColor: {
base: "gray.200",
_dark: "whiteAlpha.200"
},
// title
"& h2": {
fontSize: "xl",
fontWeight: "bold"
},
},
// dialog body
"& > div.chakra-dialog__body": {
p: 0,
// box container of the widget category menu
"& div.chakra-tabs__root > div:first-child": {
position: "relative",
display: "flex",
maxW: "100%",
mx: 5,
mt: 4,
mb: 6
},
// the horizontal widget categories menu
"& div.chakra-tabs__list": {
bg: {
base: "rgba(0, 0, 0, 0.04)",
_dark: "rgba(255, 255, 255, 0.05)"
},
p: 1,
borderRadius: "full",
display: "flex",
flexWrap: "nowrap",
overflowX: "auto",
maxW: "100%",
border: "1px solid",
borderColor: {
base: "blackAlpha.50",
_dark: "whiteAlpha.100"
},
scrollbarWidth: "none",
"&::-webkit-scrollbar": {display: "none"},
// the pill shaped menu options
"& button.chakra-tabs__trigger": {
px: 5,
py: 2,
borderRadius: "full",
whiteSpace: "nowrap",
flexShrink: 0,
color: {
base: "gray.500",
_dark: "gray.400"
},
fontWeight: "medium",
transition: "background-color 0.2s, color 0.2s, box-shadow 0.2s",
_hover: {
color: {
base: "gray.800",
_dark: "gray.200"
},
},
_selected: {
bg: {
base: "white",
_dark: "rgba(255, 255, 255, 0.12)"
},
color: {
base: "blue.600",
_dark: "blue.200"
},
boxShadow: "sm",
fontWeight: "bold",
}
}
},
// base styling applied to both chevron navigators
"& div.chakra-tabs__root > div:first-child div:has(svg)": {
position: "absolute",
top: "0",
bottom: "0",
w: "50px",
alignItems: "center",
justifyContent: "center",
zIndex: 2,
cursor: "pointer",
bg: {
base: "rgba(255, 255, 255, 0.7)",
_dark: "rgba(30, 30, 30, 0.8)"
},
color: {
base: "gray.600",
_dark: "gray.300"
},
backdropFilter: "blur(1px)",
transition: "background-color 0.2s",
_hover: {
color: {
base: "blue.500",
_dark: "blue.300"
},
bg: {
base: "rgba(255, 255, 255, 0.9)",
_dark: "rgba(40, 40, 40, 0.95)"
},
},
"&:has(.lucide-chevron-left)": {
left: 0,
borderTopLeftRadius: "full",
borderBottomLeftRadius: "full",
// Bites a transparent circle out of the flat right side!
WebkitMaskImage: "radial-gradient(circle at 100% 50%, transparent 30px, black 19px)",
maskImage: "radial-gradient(circle at 100% 50%, transparent 30px, black 35px)",
},
"&:has(.lucide-chevron-right)": {
right: 0,
borderTopRightRadius: "full",
borderBottomRightRadius: "full",
// THE MAGIC: Bites a transparent circle out of the flat left side!
WebkitMaskImage: "radial-gradient(circle at 0% 50%, transparent 30px, black 19px)",
maskImage: "radial-gradient(circle at 0% 50%, transparent 30px, black 35px)",
}
}
}
}
}
},
mode: {
editing: {
root: {
@@ -338,116 +597,16 @@ const widgetRecipe = defineSlotRecipe({
borderWidth: "2px",
borderColor: "orange.300",
cursor: "grab",
},
},
},
},
});
// 6. TRUE POPOVER: Compact floating card for 3-dots menus
const glassPopoverRecipe = defineSlotRecipe({
slots: ["content", "arrow", "positioner"],
base: {
content: {
...glassSurface,
borderRadius: "xl",
p: 3,
boxShadow: "lg",
bg: {base: "rgba(255, 255, 255, 0.85)", _dark: "rgba(20, 22, 25, 0.85)"},
backdropFilter: "blur(15px)",
WebkitBackdropFilter: "blur(15px)",
},
},
});
// 7. MODAL DIALOG: Large view for the Widget Shop
const glassDialogRecipe = defineSlotRecipe({
slots: ["content", "header", "body", "backdrop"],
base: {
backdrop: {
bg: "rgba(0, 0, 0, 0.4)",
backdropFilter: "blur(4px)",
WebkitBackdropFilter: "blur(4px)",
},
content: {
display: "flex",
flexDirection: "column",
position: "relative",
...glassSurface,
borderRadius: "2xl",
p: 2,
boxShadow: "xl",
minW: "240px",
maxW: "60%",
minH: "80%",
overflow: "hidden",
bg: {base: "rgba(255, 255, 255, 0.75)", _dark: "rgba(20, 22, 25, 0.8)"},
backdropFilter: "blur(15px)",
WebkitBackdropFilter: "blur(15px)",
},
header: {
bg: "transparent",
color: {base: "gray.800", _dark: "white"},
py: 4,
borderColor: {base: "gray.200", _dark: "whiteAlpha.200"},
"& h2": {fontSize: "xl", fontWeight: "bold"},
},
body: {
p: 0,
"& div.chakra-tabs__root > div:first-child": {
position: "relative",
display: "flex",
maxW: "100%",
mx: 5,
mt: 4,
mb: 6
},
"& div.chakra-tabs__list": {
bg: {base: "rgba(0, 0, 0, 0.04)", _dark: "rgba(255, 255, 255, 0.05)"},
p: 1, borderRadius: "full", display: "flex", flexWrap: "nowrap", overflowX: "auto", maxW: "100%",
border: "1px solid", borderColor: {base: "blackAlpha.50", _dark: "whiteAlpha.100"},
scrollbarWidth: "none", "&::-webkit-scrollbar": {display: "none"},
"& button.chakra-tabs__trigger": {
px: 5, py: 2, borderRadius: "full", whiteSpace: "nowrap", flexShrink: 0,
color: {base: "gray.500", _dark: "gray.400"},
fontWeight: "medium", transition: "background-color 0.2s, color 0.2s, box-shadow 0.2s",
_hover: {color: {base: "gray.800", _dark: "gray.200"}},
_selected: {
bg: {base: "white", _dark: "rgba(255, 255, 255, 0.12)"},
color: {base: "blue.600", _dark: "blue.200"},
boxShadow: "sm",
fontWeight: "bold"
}
}
},
"& div.chakra-tabs__root > div:first-child div:has(svg)": {
position: "absolute", top: "0", bottom: "0", w: "50px", alignItems: "center", justifyContent: "center",
zIndex: 2, cursor: "pointer", bg: {base: "rgba(255, 255, 255, 0.7)", _dark: "rgba(30, 30, 30, 0.8)"},
color: {base: "gray.600", _dark: "gray.300"}, backdropFilter: "blur(1px)", transition: "background-color 0.2s",
_hover: {
color: {base: "blue.500", _dark: "blue.300"},
bg: {base: "rgba(255, 255, 255, 0.9)", _dark: "rgba(40, 40, 40, 0.95)"}
},
"&:has(.lucide-chevron-left)": {
left: 0,
borderTopLeftRadius: "full",
borderBottomLeftRadius: "full",
WebkitMaskImage: "radial-gradient(circle at 100% 50%, transparent 30px, black 19px)",
maskImage: "radial-gradient(circle at 100% 50%, transparent 30px, black 35px)"
},
"&:has(.lucide-chevron-right)": {
right: 0,
borderTopRightRadius: "full",
borderBottomRightRadius: "full",
WebkitMaskImage: "radial-gradient(circle at 0% 50%, transparent 30px, black 19px)",
maskImage: "radial-gradient(circle at 0% 50%, transparent 30px, black 35px)"
},
},
},
}
}
},
defaultVariants: {
layout: "widget"
}
});
// 6. Pill/Glass Expanding Tab Button
const glassTabRecipe = defineRecipe({
base: {
display: "flex",
@@ -504,30 +663,11 @@ const glassTabRecipe = defineRecipe({
bg: "{gooeyButtonBackground}",
cursor: "default",
textDecoration: "none",
},
},
},
}
}
}
});
/* ==========================================================================
RAW WIDGET COLORS (For Canvas/Plotly libraries that reject CSS variables)
========================================================================== */
export const rawWidgetColors = {
light: {
text: "#000000",
muted: "#4A5568", // gray.600
grid: "rgba(0, 0, 0, 0.1)",
},
dark: {
text: "#FFFFFF",
muted: "#A0AEC0", // gray.400
grid: "rgba(255, 255, 255, 0.15)",
}
};
/* ==========================================================================
CONFIG & SYSTEM
========================================================================== */
const config = defineConfig({
globalCss: {
".react-grid-placeholder": {
@@ -566,14 +706,36 @@ const config = defineConfig({
"::-webkit-scrollbar-track": {
background: "transparent",
},
".leaflet-control-zoom-in, .leaflet-control-zoom-out, .leaflet-control-attribution, .leaflet-container": {
// '.leaflet-tile': {
// _dark: {
// filter: "invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%)",
// }
// },
'.leaflet-control-zoom-in, .leaflet-control-zoom-out, .leaflet-control-attribution, .leaflet-container': {
_dark: {
filter: "invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%)",
},
}
},
".leaflet-container": {
'.leaflet-control-attribution': {
_dark: {
filter: "invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%)",
}
},
'.leaflet-container': {
fontFamily: "system-ui, sans-serif !important",
_dark: {
filter: "invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%)",
}
},
// ".leaflet-popup-content": {
// fontFamily: "georgia, system-ui, sans-serif !important"
// },
// ".leaflet-control a": {
// fontFamily: "georgia, system-ui, sans-serif !important"
// },
// ".leaflet-tooltip": {
// fontFamily: "georgia, system-ui, sans-serif !important"
// },
".react-grid-item": {
transition: "none !important"
},
@@ -581,25 +743,22 @@ const config = defineConfig({
theme: {
semanticTokens: {
colors: {
text: { value: { base: "#000000", _dark: "#FFFFFF" } },
textInverted: { value: { base: "#000000", _dark: "#FFFFFF" } }, // Fixed: Properly inverted
MainBackground: { value: { base: "#F9F9F9", _dark: "#141414" } },
titleColor: { value: { base: "gray.800", _dark: "#FFFFFF" } },
iconColor: { value: { base: "gray.600", _dark: "gray.300" } }, // Fixed: Visible in dark mode
glassSeperator: { value: { base: "#0000001A", _dark: "#FFFFFF3F" } },
// base100: {value: {base: "#f6f9faff", _dark: "#1617199e"}},
// base200: {value: {base: "#e6ecf1ff", _dark: "#242424"}},
// base300: {value: {base: "#d3dae4ff", _dark: "#0a0b0bff"}},
// primary: {value: {base: "#2B98F8", _dark: "#2B98F8"}},
// primaryLt: {value: {base: "#98cdffff", _dark: "#98cdffff"}},
// secondaryBG: {value: {base: "#EDF1F1", _dark: "#121212"}},
// border: {value: {base: "#000000", _dark: "#cbcbcb84"}},
text: {value: {base: "#000000", _dark: "#FFFFFF"}},
textInverted: {value: {base: "#000000", _dark: "#FFFFFF"}},
// icon: {value: {base: "#000000", _dark: "#FFFFFF"}},
gooeyButtonBackground: {value: {base: "rgba(255, 255, 255, 0.1)", _dark: "rgba(255, 255, 255, 0.1)"}},
// WIDGET SPECIFIC VALUES
widgetItemBg: { value: { base: "rgba(0, 0, 0, 0.04)", _dark: "rgba(255, 255, 255, 0.05)" } },
widgetItemExpandedBg: { value: { base: "rgba(0, 0, 0, 0.08)", _dark: "rgba(0, 0, 0, 0.3)" } },
widgetBadgeBg: { value: { base: "rgba(255, 255, 255, 0.6)", _dark: "rgba(0, 0, 0, 0.5)" } },
widgetTextMuted: { value: { base: "gray.600", _dark: "gray.400" } },
// ALERT COLORS
alertRed: { value: { base: "red.600", _dark: "red.400" } },
alertOrange: { value: { base: "orange.600", _dark: "orange.400" } },
alertYellow: { value: { base: "yellow.600", _dark: "yellow.400" } },
alertGreen: { value: { base: "green.600", _dark: "green.400" } },
MainBackground: {value: {base: "#F9F9F9", _dark: "#141414"}},
titleColor: {value: {base: "gray.800", _dark: "#FFFFFF"}},
iconColor: {value: {base: "gray.600", _dark: "#000000"}},
glassSeperator: {value: {base: "#0000001A", _dark: "#FFFFFF3F"}},
},
},
tokens: {
@@ -609,17 +768,19 @@ const config = defineConfig({
},
recipes: {
dashboard: dashboardRecipe,
glassTab: glassTabRecipe,
// canvas: canvasRecipe,
glassTab: glassTabRecipe
},
slotRecipes: {
header: headerRecipe,
sidebar: sidebarRecipe,
// widget: widgetRecipe,
glassPanel: glassPanelRecipe,
home: homeRecipe,
widget: widgetRecipe,
glassPopover: glassPopoverRecipe,
glassDialog: glassDialogRecipe,
},
},
});
// Define semantic tokens and export recipes
export const system = createSystem(defaultConfig, config);