* feat: add widget definition system * fix: wrong typecheck command in turbo generator * chore: fix formatting * feat: add widget preview page * chore: fix formatting and type errors * chore: fix from widget edit modal and remove some never casts * chore: address pull request feedback
27 lines
745 B
TypeScript
27 lines
745 B
TypeScript
import { IconClock } from "@homarr/ui";
|
|
|
|
import { createWidgetDefinition } from "../definition";
|
|
import { opt } from "../options";
|
|
|
|
export const { definition, componentLoader } = createWidgetDefinition("clock", {
|
|
icon: IconClock,
|
|
options: opt.from(
|
|
(fac) => ({
|
|
is24HourFormat: fac.switch({
|
|
defaultValue: true,
|
|
withDescription: true,
|
|
}),
|
|
isLocaleTime: fac.switch({ defaultValue: true }),
|
|
timezone: fac.select({
|
|
options: ["Europe/Berlin", "Europe/London", "Europe/Moscow"] as const,
|
|
defaultValue: "Europe/Berlin",
|
|
}),
|
|
}),
|
|
{
|
|
timezone: {
|
|
shouldHide: (options) => options.isLocaleTime,
|
|
},
|
|
},
|
|
),
|
|
}).withDynamicImport(() => import("./component"));
|