mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 07:55:52 +01:00
fix defaultValue on widget options
This commit is contained in:
@@ -58,14 +58,6 @@ export const WidgetsEditModal = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMutliselectData = (option: string) => {
|
|
||||||
const currentWidgetDefinition = Widgets[innerProps.widgetId as keyof typeof Widgets];
|
|
||||||
if (!Widgets) return [];
|
|
||||||
|
|
||||||
const options = currentWidgetDefinition.options as any;
|
|
||||||
return options[option]?.data ?? [];
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
updateConfig(
|
updateConfig(
|
||||||
configName,
|
configName,
|
||||||
@@ -85,9 +77,9 @@ export const WidgetsEditModal = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
{items.map(([key, defaultValue], index) => {
|
{items.map(([key, _], index) => {
|
||||||
const option = (currentWidgetDefinition as any).options[key] as IWidgetOptionValue;
|
const option = (currentWidgetDefinition as any).options[key] as IWidgetOptionValue;
|
||||||
const value = moduleProperties[key] ?? defaultValue;
|
const value = moduleProperties[key] ?? option.defaultValue;
|
||||||
|
|
||||||
if (!option) {
|
if (!option) {
|
||||||
return (
|
return (
|
||||||
@@ -183,10 +175,10 @@ function WidgetOptionTypeSwitch(
|
|||||||
case 'slider':
|
case 'slider':
|
||||||
return (
|
return (
|
||||||
<Stack spacing="xs">
|
<Stack spacing="xs">
|
||||||
<Text>{t(`descriptor.settings.${key}.label`)}</Text>
|
|
||||||
<Slider
|
<Slider
|
||||||
color={primaryColor}
|
color={primaryColor}
|
||||||
key={`${option.type}-${index}`}
|
key={`${option.type}-${index}`}
|
||||||
|
label={value}
|
||||||
value={value as number}
|
value={value as number}
|
||||||
min={option.min}
|
min={option.min}
|
||||||
max={option.max}
|
max={option.max}
|
||||||
|
|||||||
Reference in New Issue
Block a user