feat: Add widget integration option (#14)

* wip: add widget integrations

* feat: Add integration option to widgets

* feat: Add translation for widget integration select

* fix: formatting issue

* chore: address pull request feedback
This commit is contained in:
Meier Lukas
2024-02-03 10:24:39 +01:00
committed by GitHub
parent 3a0f280984
commit 1740450648
22 changed files with 378 additions and 55 deletions

View File

@@ -2,5 +2,7 @@
import { createFormContext } from "@homarr/form";
import type { WidgetEditModalState } from "../modals/widget-edit-modal";
export const [FormProvider, useFormContext, useForm] =
createFormContext<Record<string, unknown>>();
createFormContext<WidgetEditModalState>();

View File

@@ -19,7 +19,7 @@ export const WidgetMultiSelectInput = ({
label={t("label")}
data={options.options as unknown as string[]}
description={options.withDescription ? t("description") : undefined}
{...form.getInputProps(property)}
{...form.getInputProps(`options.${property}`)}
/>
);
};

View File

@@ -21,7 +21,7 @@ export const WidgetNumberInput = ({
min={options.validate.minValue ?? undefined}
max={options.validate.maxValue ?? undefined}
step={options.step}
{...form.getInputProps(property)}
{...form.getInputProps(`options.${property}`)}
/>
);
};

View File

@@ -19,7 +19,7 @@ export const WidgetSelectInput = ({
label={t("label")}
data={options.options as unknown as string[]}
description={options.withDescription ? t("description") : undefined}
{...form.getInputProps(property)}
{...form.getInputProps(`options.${property}`)}
/>
);
};

View File

@@ -23,7 +23,7 @@ export const WidgetSliderInput = ({
min={options.validate.minValue ?? undefined}
max={options.validate.maxValue ?? undefined}
step={options.step}
{...form.getInputProps(property)}
{...form.getInputProps(`options.${property}`)}
/>
</InputWrapper>
);

View File

@@ -18,7 +18,7 @@ export const WidgetSwitchInput = ({
<Switch
label={t("label")}
description={options.withDescription ? t("description") : undefined}
{...form.getInputProps(property, { type: "checkbox" })}
{...form.getInputProps(`options.${property}`, { type: "checkbox" })}
/>
);
};

View File

@@ -18,7 +18,7 @@ export const WidgetTextInput = ({
<TextInput
label={t("label")}
description={options.withDescription ? t("description") : undefined}
{...form.getInputProps(property)}
{...form.getInputProps(`options.${property}`)}
/>
);
};