Update to buttons on widget choices
This commit is contained in:
@@ -13,10 +13,16 @@ import {
|
|||||||
useRecipe,
|
useRecipe,
|
||||||
useSlotRecipe
|
useSlotRecipe
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import {Settings, Plus, LayoutGrid, Move, Save, X} from 'lucide-react';
|
import {Settings, LayoutGrid, Move, Save, X} from 'lucide-react';
|
||||||
import {useDashboardStore} from "../../store/useDashboardStore.jsx";
|
import {useDashboardStore} from "../../store/useDashboardStore.jsx";
|
||||||
import {WIDGET_REGISTRY} from "../../constants/widgetRegistry.jsx";
|
import {WIDGET_REGISTRY} from "../../constants/widgetRegistry.jsx";
|
||||||
|
|
||||||
|
// 🚨 NEW: Tiny helper to convert size keys into abbreviations
|
||||||
|
const getSizeAbbreviation = (key) => {
|
||||||
|
const mapping = { small: "S", medium: "M", large: "L", xlarge: "XL" };
|
||||||
|
return mapping[key.toLowerCase()] || key.charAt(0).toUpperCase();
|
||||||
|
};
|
||||||
|
|
||||||
export function SettingsButton() {
|
export function SettingsButton() {
|
||||||
// 1. ☁Store connections
|
// 1. ☁Store connections
|
||||||
const isEditing = useDashboardStore(state => state.isEditing);
|
const isEditing = useDashboardStore(state => state.isEditing);
|
||||||
@@ -192,7 +198,7 @@ export function SettingsButton() {
|
|||||||
pt={3}>
|
pt={3}>
|
||||||
<Text fontSize="xs" fontWeight="bold" color="gray.400" textTransform="uppercase"
|
<Text fontSize="xs" fontWeight="bold" color="gray.400" textTransform="uppercase"
|
||||||
mb={2}>
|
mb={2}>
|
||||||
Add to Grid:
|
Add to Dashboard:
|
||||||
</Text>
|
</Text>
|
||||||
<HStack gap={2} flexWrap="wrap">
|
<HStack gap={2} flexWrap="wrap">
|
||||||
{Object.keys(widget.allowedSizes).map(sizeKey => (
|
{Object.keys(widget.allowedSizes).map(sizeKey => (
|
||||||
@@ -203,8 +209,24 @@ export function SettingsButton() {
|
|||||||
onClick={() => handleAddWidget(widget.id, sizeKey)}
|
onClick={() => handleAddWidget(widget.id, sizeKey)}
|
||||||
color={{base: "blue.600", _dark: "blue.300"}}
|
color={{base: "blue.600", _dark: "blue.300"}}
|
||||||
>
|
>
|
||||||
<Plus size={16} style={{flexShrink: 0}}/>
|
{/* 🚨 THE ABBREVIATION ICON: Always visible */}
|
||||||
<Box as="span">{sizeKey.charAt(0).toUpperCase() + sizeKey.slice(1)}</Box>
|
<Flex
|
||||||
|
align="center"
|
||||||
|
justify="center"
|
||||||
|
w="24px"
|
||||||
|
h="24px"
|
||||||
|
flexShrink={0}
|
||||||
|
borderRadius="full"
|
||||||
|
bg={{ base: "blue.50", _dark: "whiteAlpha.200" }}
|
||||||
|
fontWeight="black"
|
||||||
|
fontSize="xs"
|
||||||
|
bg='transparent'
|
||||||
|
>
|
||||||
|
{getSizeAbbreviation(sizeKey)}
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
{/* 🚨 THE EXPANDED TEXT: Only visible on hover */}
|
||||||
|
<Box as="span">Add Widget</Box>
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
</HStack>
|
</HStack>
|
||||||
@@ -216,9 +238,7 @@ export function SettingsButton() {
|
|||||||
))}
|
))}
|
||||||
</Tabs.Root>
|
</Tabs.Root>
|
||||||
</Dialog.Body>
|
</Dialog.Body>
|
||||||
<Dialog.CloseTrigger position="absolute" top={3} right={3}
|
<Dialog.CloseTrigger position="absolute" top={3} right={3} color={{ base: "gray.500", _dark: "whiteAlpha.800" }} _hover={{ color: "red.400" }} />
|
||||||
color={{base: "gray.500", _dark: "whiteAlpha.800"}}
|
|
||||||
_hover={{color: "red.400"}}/>
|
|
||||||
</Dialog.Content>
|
</Dialog.Content>
|
||||||
</Dialog.Positioner>
|
</Dialog.Positioner>
|
||||||
</Dialog.Root>
|
</Dialog.Root>
|
||||||
|
|||||||
Reference in New Issue
Block a user