A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
feat(widgets): add border color option to advanced-options (#2512)
Jack Wellerb3464b3340cf
diff --git a/apps/nextjs/src/app/[locale]/widgets/[kind]/_content.tsx b/apps/nextjs/src/app/[locale]/widgets/[kind]/_content.tsxindex d31f42e9e..362236300 100644--- a/apps/nextjs/src/app/[locale]/widgets/[kind]/_content.tsx+++ b/apps/nextjs/src/app/[locale]/widgets/[kind]/_content.tsx@@ -49,6 +49,7 @@ export const WidgetPreviewPageContent = ({ kind, integrationData }: WidgetPrevieintegrationIds: [],advancedOptions: {customCssClasses: [],+ borderColor: "",},});diff --git a/apps/nextjs/src/components/board/items/actions/create-item.ts b/apps/nextjs/src/components/board/items/actions/create-item.tsindex 6525718f9..d29d407b5 100644--- a/apps/nextjs/src/components/board/items/actions/create-item.ts+++ b/apps/nextjs/src/components/board/items/actions/create-item.ts@@ -29,6 +29,7 @@ export const createItemCallback =integrationIds: [],advancedOptions: {customCssClasses: [],+ borderColor: "",},} satisfies Modify<Item,diff --git a/apps/nextjs/src/components/board/items/actions/test/duplicate-item.spec.ts b/apps/nextjs/src/components/board/items/actions/test/duplicate-item.spec.tsindex 7bb2fb7ad..88ccd781b 100644--- a/apps/nextjs/src/components/board/items/actions/test/duplicate-item.spec.ts+++ b/apps/nextjs/src/components/board/items/actions/test/duplicate-item.spec.ts@@ -20,7 +20,7 @@ describe("item actions duplicate-item", () => {kind: itemKind,integrationIds: ["1"],options: { address: "localhost" },- advancedOptions: { customCssClasses: ["test"] },+ advancedOptions: { customCssClasses: ["test"], borderColor: "#ff0000" },}).addLayout({ layoutId, sectionId: currentSectionId, ...currentItemSize }).build();diff --git a/apps/nextjs/src/components/board/items/actions/test/mocks/item-mock.ts b/apps/nextjs/src/components/board/items/actions/test/mocks/item-mock.tsindex f7533bd56..71b84918e 100644--- a/apps/nextjs/src/components/board/items/actions/test/mocks/item-mock.ts+++ b/apps/nextjs/src/components/board/items/actions/test/mocks/item-mock.ts@@ -14,6 +14,7 @@ export class ItemMockBuilder {integrationIds: [],advancedOptions: {customCssClasses: [],+ borderColor: "",},...item,} satisfies Item;diff --git a/apps/nextjs/src/components/board/items/item-content.tsx b/apps/nextjs/src/components/board/items/item-content.tsxindex b486a20cf..709d52182 100644--- a/apps/nextjs/src/components/board/items/item-content.tsx+++ b/apps/nextjs/src/components/board/items/item-content.tsx@@ -40,6 +40,7 @@ export const BoardItemContent = ({ item }: BoardItemContentProps) => {"--opacity": board.opacity / 100,containerType: "size",overflow: item.kind === "iframe" ? "hidden" : undefined,+ "--border-color": item.advancedOptions.borderColor !== "" ? item.advancedOptions.borderColor : undefined,},}}p={0}diff --git a/packages/translation/src/lang/en.json b/packages/translation/src/lang/en.jsonindex 72ed28ddc..d7d9f8697 100644--- a/packages/translation/src/lang/en.json+++ b/packages/translation/src/lang/en.json@@ -1070,6 +1070,9 @@},"customCssClasses": {"label": "Custom css classes"+ },+ "borderColor": {+ "label": "Border color"}}},diff --git a/packages/validation/src/shared.ts b/packages/validation/src/shared.tsindex 0080254c0..733d3edef 100644--- a/packages/validation/src/shared.ts+++ b/packages/validation/src/shared.ts@@ -15,6 +15,7 @@ export type BoardItemIntegration = z.infer<typeof integrationSchema>;export const itemAdvancedOptionsSchema = z.object({customCssClasses: z.array(z.string()).default([]),+ borderColor: z.string().default(""),});export type BoardItemAdvancedOptions = z.infer<typeof itemAdvancedOptionsSchema>;diff --git a/packages/widgets/src/modals/widget-advanced-options-modal.tsx b/packages/widgets/src/modals/widget-advanced-options-modal.tsxindex 674bc8f9c..f957b100a 100644--- a/packages/widgets/src/modals/widget-advanced-options-modal.tsx+++ b/packages/widgets/src/modals/widget-advanced-options-modal.tsx@@ -1,6 +1,6 @@"use client";-import { Button, Group, Stack } from "@mantine/core";+import { Button, CloseButton, ColorInput, Group, Stack, useMantineTheme } from "@mantine/core";import { useForm } from "@homarr/form";import { createModal } from "@homarr/modals";@@ -15,6 +15,7 @@ interface InnerProps {export const WidgetAdvancedOptionsModal = createModal<InnerProps>(({ actions, innerProps }) => {const t = useI18n();+ const theme = useMantineTheme();const form = useForm({initialValues: innerProps.advancedOptions,});@@ -30,6 +31,18 @@ export const WidgetAdvancedOptionsModal = createModal<InnerProps>(({ actions, inlabel={t("item.edit.field.customCssClasses.label")}{...form.getInputProps("customCssClasses")}/>+ <ColorInput+ label={t("item.edit.field.borderColor.label")}+ format="hex"+ swatches={Object.values(theme.colors).map((color) => color[6])}+ rightSection={+ <CloseButton+ onClick={() => form.setFieldValue("borderColor", "")}+ style={{ display: form.getInputProps("borderColor").value ? undefined : "none" }}+ />+ }+ {...form.getInputProps("borderColor")}+ /><Group justify="end"><Button onClick={actions.closeModal} variant="subtle" color="gray">{t("common.action.cancel")}diff --git a/packages/widgets/src/modals/widget-edit-modal.tsx b/packages/widgets/src/modals/widget-edit-modal.tsxindex 446d8c6c0..6667637ed 100644--- a/packages/widgets/src/modals/widget-edit-modal.tsx+++ b/packages/widgets/src/modals/widget-edit-modal.tsx@@ -65,6 +65,7 @@ export const WidgetEditModal = createModal<ModalProps<WidgetKind>>(({ actions, iintegrationIds: z.array(z.string()),advancedOptions: z.object({customCssClasses: z.array(z.string()),+ borderColor: z.string(),}),}),),