mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-26 16:30:57 +01:00
* feat: add pi hole summary integration * feat: add pi hole summary widget * fix: type issues with integrations and integrationIds * feat: add middleware for integrations and improve cache redis channel * feat: add error boundary for widgets * fix: broken lock file * fix: format format issues * fix: typecheck issue * fix: deepsource issues * fix: widget sandbox without error boundary * chore: address pull request feedback * chore: remove todo comment and created issue * fix: format issues * fix: deepsource issue
32 lines
941 B
TypeScript
32 lines
941 B
TypeScript
"use client";
|
|
|
|
import { MultiSelect } from "@mantine/core";
|
|
|
|
import { translateIfNecessary } from "@homarr/translation";
|
|
|
|
import type { CommonWidgetInputProps } from "./common";
|
|
import { useWidgetInputTranslation } from "./common";
|
|
import { useFormContext } from "./form";
|
|
|
|
export const WidgetMultiSelectInput = ({ property, kind, options }: CommonWidgetInputProps<"multiSelect">) => {
|
|
const t = useWidgetInputTranslation(kind, property);
|
|
const form = useFormContext();
|
|
|
|
return (
|
|
<MultiSelect
|
|
label={t("label")}
|
|
data={options.options.map((option) =>
|
|
typeof option === "string"
|
|
? option
|
|
: {
|
|
value: option.value,
|
|
label: translateIfNecessary(t, option.label)!,
|
|
},
|
|
)}
|
|
description={options.withDescription ? t("description") : undefined}
|
|
searchable={options.searchable}
|
|
{...form.getInputProps(`options.${property}`)}
|
|
/>
|
|
);
|
|
};
|