feat: Clock widget and dayjs locale standard (#79)
* feat: Clock widget and dayjs locale standard Co-authored-by: Meier Lukas - Widget options modifications <meierschlumpf@gmail.com> * perf: add improved time state for clock widget * fix: final fixes * refactor: unify selectOptions * chore: fix CI & remove serverdata from clock widget * chore: Change custom title to be under a toggle --------- Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import { MultiSelect } from "@homarr/ui";
|
||||
import type { CommonWidgetInputProps } from "./common";
|
||||
import { useWidgetInputTranslation } from "./common";
|
||||
import { useFormContext } from "./form";
|
||||
import type { SelectOption } from "./widget-select-input";
|
||||
|
||||
export const WidgetMultiSelectInput = ({
|
||||
property,
|
||||
@@ -17,8 +18,9 @@ export const WidgetMultiSelectInput = ({
|
||||
return (
|
||||
<MultiSelect
|
||||
label={t("label")}
|
||||
data={options.options as unknown as string[]}
|
||||
data={options.options as unknown as SelectOption[]}
|
||||
description={options.withDescription ? t("description") : undefined}
|
||||
searchable={options.searchable}
|
||||
{...form.getInputProps(`options.${property}`)}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -6,6 +6,20 @@ import type { CommonWidgetInputProps } from "./common";
|
||||
import { useWidgetInputTranslation } from "./common";
|
||||
import { useFormContext } from "./form";
|
||||
|
||||
export type SelectOption =
|
||||
| {
|
||||
value: string;
|
||||
label: string;
|
||||
}
|
||||
| string;
|
||||
|
||||
export type inferSelectOptionValue<TOption extends SelectOption> =
|
||||
TOption extends {
|
||||
value: infer TValue;
|
||||
}
|
||||
? TValue
|
||||
: TOption;
|
||||
|
||||
export const WidgetSelectInput = ({
|
||||
property,
|
||||
kind,
|
||||
@@ -17,8 +31,9 @@ export const WidgetSelectInput = ({
|
||||
return (
|
||||
<Select
|
||||
label={t("label")}
|
||||
data={options.options as unknown as string[]}
|
||||
data={options.options as unknown as SelectOption[]}
|
||||
description={options.withDescription ? t("description") : undefined}
|
||||
searchable={options.searchable}
|
||||
{...form.getInputProps(`options.${property}`)}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user