diff --git a/apps/nextjs/src/app/[locale]/manage/search-engines/_form.tsx b/apps/nextjs/src/app/[locale]/manage/search-engines/_form.tsx index e937cf503..4db3ba01a 100644 --- a/apps/nextjs/src/app/[locale]/manage/search-engines/_form.tsx +++ b/apps/nextjs/src/app/[locale]/manage/search-engines/_form.tsx @@ -1,8 +1,12 @@ "use client"; import Link from "next/link"; -import { Button, Grid, Group, Stack, Textarea, TextInput } from "@mantine/core"; +import type { SegmentedControlItem } from "@mantine/core"; +import { Button, Fieldset, Grid, Group, SegmentedControl, Stack, Textarea, TextInput } from "@mantine/core"; +import { WidgetIntegrationSelect } from "node_modules/@homarr/widgets/src/widget-integration-select"; +import { clientApi } from "@homarr/api/client"; +import { searchEngineTypes } from "@homarr/definitions"; import { useZodForm } from "@homarr/form"; import type { TranslationFunction } from "@homarr/translation"; import { useI18n } from "@homarr/translation/client"; @@ -25,6 +29,8 @@ export const SearchEngineForm = (props: SearchEngineFormProps) => { const { submitButtonTranslation, handleSubmit, initialValues, isPending, disableShort } = props; const t = useI18n(); + const [integrationData] = clientApi.integration.allThatSupportSearch.useSuspenseQuery(); + const form = useZodForm(validation.searchEngine.manage, { initialValues: initialValues ?? { name: "", @@ -32,6 +38,7 @@ export const SearchEngineForm = (props: SearchEngineFormProps) => { iconUrl: "", urlTemplate: "", description: "", + type: "generic", }, }); @@ -52,11 +59,40 @@ export const SearchEngineForm = (props: SearchEngineFormProps) => { - + +
+ + ({ + label: t(`search.engine.page.edit.searchEngineType.${type}`), + value: type, + }) satisfies SegmentedControlItem, + )} + {...form.getInputProps("type")} + fullWidth + /> + + {form.values.type === "generic" && ( + + )} + + {form.values.type === "fromIntegration" && ( + form.setFieldValue("integrationId", value[0])} + value={form.values.integrationId !== undefined ? [form.values.integrationId] : []} + withAsterisk + /> + )} +
+