wip - committing to check out another branch
This commit is contained in:
@@ -4,21 +4,23 @@ import {useDashboardStore} from "@/store/useDashboardStore.jsx";
|
|||||||
export default function IvansAlertsSettings({ widgetId, currentSettings }) {
|
export default function IvansAlertsSettings({ widgetId, currentSettings }) {
|
||||||
const updateSettings = useDashboardStore(state => state.updateWidgetSettings);
|
const updateSettings = useDashboardStore(state => state.updateWidgetSettings);
|
||||||
|
|
||||||
|
console.log("currentSettings:", currentSettings);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex flexDirection="column" justifyContent="space-between" gap={2} pb={2}>
|
<Flex flexDirection="column" justifyContent="space-between" align="center" gap={2} pb={2}>
|
||||||
{/* SLIDER DATE RANGE SELECTION */}
|
{/* SLIDER DATE RANGE SELECTION */}
|
||||||
<Slider.Root
|
<Slider.Root
|
||||||
width="80%" h="100%"
|
w="90%" h="100%"
|
||||||
min={1} max={14}
|
min={1} max={14}
|
||||||
defaultValue={[7]}
|
defaultValue={[1]}
|
||||||
step={1}
|
step={1}
|
||||||
onValueChangeEnd={(e) => {
|
onValueChangeEnd={(e) => {
|
||||||
|
console.log("change end", e);
|
||||||
const day = new Date(Date.now() - (e.value[0])*86400000).toLocaleDateString('en-CA');
|
const day = new Date(Date.now() - (e.value[0])*86400000).toLocaleDateString('en-CA');
|
||||||
console.log("new start: ", day);
|
|
||||||
updateSettings(widgetId, {...currentSettings, startDate: day});
|
updateSettings(widgetId, {...currentSettings, startDate: day});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Slider.Label>{currentSettings?.endDate} to {currentSettings?.startDate}</Slider.Label>
|
<Slider.Label>{currentSettings?.startDate} to {currentSettings?.endDate}</Slider.Label>
|
||||||
<Slider.Control>
|
<Slider.Control>
|
||||||
<Slider.Track>
|
<Slider.Track>
|
||||||
<Slider.Range />
|
<Slider.Range />
|
||||||
|
|||||||
@@ -29,9 +29,11 @@ export default function MyDashboard() {
|
|||||||
const hasHydrated = useRef(false);
|
const hasHydrated = useRef(false);
|
||||||
|
|
||||||
// 1. Pull the global slot recipes
|
// 1. Pull the global slot recipes
|
||||||
const recipe = useSlotRecipe({key: "glassPanel"});
|
const glassPanelRecipe = useSlotRecipe({key: "glassPanel"});
|
||||||
const styles = recipe({ layout: "widget" });
|
const glassPanelStyles = glassPanelRecipe();
|
||||||
const popoverStyles = recipe({ layout: "popover" });
|
const widgetStyles = glassPanelRecipe({ layout: "widget" });
|
||||||
|
const widgetSettingsRecipe = useSlotRecipe({ key: "widgetSettings" });
|
||||||
|
const widgetSettingsStyles = widgetSettingsRecipe();
|
||||||
|
|
||||||
// 2. Populate widgets
|
// 2. Populate widgets
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -67,7 +69,7 @@ export default function MyDashboard() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box css={styles.header}>
|
<Box css={widgetStyles.header}>
|
||||||
<Text>
|
<Text>
|
||||||
{registryEntry.name}
|
{registryEntry.name}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -82,8 +84,8 @@ export default function MyDashboard() {
|
|||||||
</Popover.Trigger>
|
</Popover.Trigger>
|
||||||
|
|
||||||
{/* NEW: The Positioner lifts the content out of the Flexbox flow */}
|
{/* NEW: The Positioner lifts the content out of the Flexbox flow */}
|
||||||
<Popover.Positioner zIndex={1}>
|
<Popover.Positioner z-index="1">
|
||||||
<Popover.Content css={popoverStyles.root}>
|
<Popover.Content css={[widgetSettingsStyles.root, glassPanelStyles.root]}> {/*className={`${glassPanelStyles.root} ${widgetSettingsStyles.root}`}>*/}
|
||||||
<Suspense fallback={<Spinner size="sm"/>}>
|
<Suspense fallback={<Spinner size="sm"/>}>
|
||||||
<SettingsUI
|
<SettingsUI
|
||||||
widgetId={widget.id}
|
widgetId={widget.id}
|
||||||
@@ -96,7 +98,7 @@ export default function MyDashboard() {
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box css={styles.body}>
|
<Box css={widgetStyles.body}>
|
||||||
<Component settings={widget.settings || {}} widgetID={widget.id || {}}/>
|
<Component settings={widget.settings || {}} widgetID={widget.id || {}}/>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
@@ -105,7 +107,7 @@ export default function MyDashboard() {
|
|||||||
|
|
||||||
// Fallback if someone asks for a widget that doesn't exist
|
// Fallback if someone asks for a widget that doesn't exist
|
||||||
return (
|
return (
|
||||||
<Flex css={styles.body} align="center" justify="center" direction="column">
|
<Flex css={widgetStyles.body} align="center" justify="center" direction="column">
|
||||||
<Text fontWeight="bold" color="red.400">Error</Text>
|
<Text fontWeight="bold" color="red.400">Error</Text>
|
||||||
<Text fontSize="sm" color="gray.400">Widget '{widget.type}' not found.</Text>
|
<Text fontSize="sm" color="gray.400">Widget '{widget.type}' not found.</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
@@ -129,12 +131,12 @@ export default function MyDashboard() {
|
|||||||
{widgets.map(widget => (
|
{widgets.map(widget => (
|
||||||
<Box
|
<Box
|
||||||
key={widget.id}
|
key={widget.id}
|
||||||
css={styles.root}
|
css={widgetStyles.root}
|
||||||
// Grid-specific state overrides remain inline
|
// Grid-specific state overrides remain inline
|
||||||
boxShadow={isEditing ? "outline" : styles.root.boxShadow}
|
boxShadow={isEditing ? "outline" : widgetStyles.root.boxShadow}
|
||||||
borderStyle={isEditing ? "dashed" : "solid"}
|
borderStyle={isEditing ? "dashed" : "solid"}
|
||||||
borderWidth={isEditing ? "2px" : "1px"}
|
borderWidth={isEditing ? "2px" : "1px"}
|
||||||
borderColor={isEditing ? "orange.300" : styles.root.borderColor}
|
borderColor={isEditing ? "orange.300" : widgetStyles.root.borderColor}
|
||||||
cursor={isEditing ? "grab" : "default"}
|
cursor={isEditing ? "grab" : "default"}
|
||||||
position="relative" // REQUIRED so the absolute button stays inside this box
|
position="relative" // REQUIRED so the absolute button stays inside this box
|
||||||
>
|
>
|
||||||
@@ -163,7 +165,7 @@ export default function MyDashboard() {
|
|||||||
|
|
||||||
{/* SUSPENSE BOUNDARY wrapping the render function */}
|
{/* SUSPENSE BOUNDARY wrapping the render function */}
|
||||||
<Suspense fallback={
|
<Suspense fallback={
|
||||||
<Flex css={styles.body} align="center" justify="center">
|
<Flex css={widgetStyles.body} align="center" justify="center">
|
||||||
<Spinner size="md" color="blue.400" thickness="3px"/>
|
<Spinner size="md" color="blue.400" thickness="3px"/>
|
||||||
</Flex>
|
</Flex>
|
||||||
}>
|
}>
|
||||||
|
|||||||
+12
-1
@@ -304,6 +304,16 @@ const homeRecipe = defineSlotRecipe({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const widgetSettingsRecipe = defineSlotRecipe({
|
||||||
|
slots: ["root"],
|
||||||
|
base: {
|
||||||
|
root: {
|
||||||
|
w: "100%",
|
||||||
|
h: "500px",
|
||||||
|
bg: "red",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
// const canvasRecipe = defineRecipe({
|
// const canvasRecipe = defineRecipe({
|
||||||
// base: {
|
// base: {
|
||||||
// bg: "{transparent}",
|
// bg: "{transparent}",
|
||||||
@@ -428,7 +438,7 @@ const glassPanelRecipe = defineSlotRecipe({
|
|||||||
popover: {
|
popover: {
|
||||||
root: {
|
root: {
|
||||||
borderRadius: "2xl",
|
borderRadius: "2xl",
|
||||||
p: 0,
|
p: 2,
|
||||||
boxShadow: "xl",
|
boxShadow: "xl",
|
||||||
minW: "240px",
|
minW: "240px",
|
||||||
maxW: "60%",
|
maxW: "60%",
|
||||||
@@ -775,6 +785,7 @@ const config = defineConfig({
|
|||||||
header: headerRecipe,
|
header: headerRecipe,
|
||||||
sidebar: sidebarRecipe,
|
sidebar: sidebarRecipe,
|
||||||
// widget: widgetRecipe,
|
// widget: widgetRecipe,
|
||||||
|
widgetSettings: widgetSettingsRecipe,
|
||||||
glassPanel: glassPanelRecipe,
|
glassPanel: glassPanelRecipe,
|
||||||
home: homeRecipe,
|
home: homeRecipe,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user