mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-27 00:40:58 +01:00
* refactor: move server api to api package * feat: add app widget * refactor: add element size for widget components on board * feat: add resize listener for widget width * feat: add widget app input * refactor: add better responsibe layout, add missing translations * fix: ci issues * fix: deepsource issues * chore: address pull request feedback
27 lines
898 B
TypeScript
27 lines
898 B
TypeScript
import type { WidgetOptionType } from "../options";
|
|
import { WidgetAppInput } from "./widget-app-input";
|
|
import { WidgetMultiSelectInput } from "./widget-multiselect-input";
|
|
import { WidgetNumberInput } from "./widget-number-input";
|
|
import { WidgetSelectInput } from "./widget-select-input";
|
|
import { WidgetSliderInput } from "./widget-slider-input";
|
|
import { WidgetSwitchInput } from "./widget-switch-input";
|
|
import { WidgetTextInput } from "./widget-text-input";
|
|
|
|
const mapping = {
|
|
text: WidgetTextInput,
|
|
location: () => null,
|
|
multiSelect: WidgetMultiSelectInput,
|
|
multiText: () => null,
|
|
number: WidgetNumberInput,
|
|
select: WidgetSelectInput,
|
|
slider: WidgetSliderInput,
|
|
switch: WidgetSwitchInput,
|
|
app: WidgetAppInput,
|
|
} satisfies Record<WidgetOptionType, unknown>;
|
|
|
|
export const getInputForType = <TType extends WidgetOptionType>(
|
|
type: TType,
|
|
) => {
|
|
return mapping[type];
|
|
};
|