feat(integrations): add search.ch integration with timetable widget (#5180)

This commit is contained in:
Meier Lukas authored and GitHub committed 2026-04-03 20:23:15 +02:00
1 parent 279d830b79
commit abb2dfc92a
19 files changed
+535

No files matched your search

+17
View File
@@ -6,6 +6,7 @@ import type { ZodType } from "zod/v4";
import type { IntegrationKind } from "@homarr/definitions";
import type { DynamicSelectOption } from "./_inputs/widget-dynamic-select-input";
import type { inferSelectOptionValue, SelectOption } from "./_inputs/widget-select-input";
import type { ReleasesRepository } from "./releases/releases-repository";
@@ -47,6 +48,16 @@ interface SelectInput<TOptions extends readonly SelectOption[]> extends CommonIn
searchable?: boolean;
}
interface DynamicSelectInput extends CommonInput<DynamicSelectOption | null> {
useOptions: (
query: string,
integrationIds: string[],
) => {
isPending: boolean;
options: DynamicSelectOption[];
};
}
interface NumberInput extends CommonInput<number> {
validate: z.ZodNumber;
step?: number;
@@ -82,6 +93,12 @@ const optionsFactory = {
searchable: input.searchable ?? false,
withDescription: input.withDescription ?? false,
}),
dynamicSelect: (input: DynamicSelectInput) => ({
type: "dynamicSelect" as const,
defaultValue: input.defaultValue ?? null,
useOptions: input.useOptions,
withDescription: input.withDescription ?? false,
}),
select: <const TOptions extends SelectOption[]>(input: SelectInput<TOptions>) => ({
type: "select" as const,
defaultValue: (input.defaultValue ?? input.options[0]) as inferSelectOptionValue<TOptions[number]>,