diff --git a/apps/hub/app/(app)/admin/keyword/[id]/page.tsx b/apps/hub/app/(app)/admin/keyword/[id]/page.tsx index 399adf90..7cfeaf45 100644 --- a/apps/hub/app/(app)/admin/keyword/[id]/page.tsx +++ b/apps/hub/app/(app)/admin/keyword/[id]/page.tsx @@ -1,13 +1,13 @@ -import { prisma } from '@repo/db'; -import { StationForm } from '../_components/Form'; +import { prisma } from "@repo/db"; +import { KeywordForm } from "../_components/Form"; export default async ({ params }: { params: Promise<{ id: string }> }) => { - const { id } = await params; - const station = await prisma.station.findUnique({ - where: { - id: parseInt(id), - }, - }); - if (!station) return
Station not found
; - return ; + const { id } = await params; + const keyword = await prisma.keyword.findUnique({ + where: { + id: parseInt(id), + }, + }); + if (!keyword) return
Station not found
; + return ; }; diff --git a/apps/hub/app/(app)/admin/keyword/_components/Form.tsx b/apps/hub/app/(app)/admin/keyword/_components/Form.tsx index c604dfa9..e54d0189 100644 --- a/apps/hub/app/(app)/admin/keyword/_components/Form.tsx +++ b/apps/hub/app/(app)/admin/keyword/_components/Form.tsx @@ -1,20 +1,20 @@ "use client"; import { zodResolver } from "@hookform/resolvers/zod"; -import { StationOptionalDefaultsSchema } from "@repo/db/zod"; +import { KeywordOptionalDefaultsSchema } from "@repo/db/zod"; import { set, useForm } from "react-hook-form"; import { z } from "zod"; -import { BosUse, Country, Station } from "@repo/db"; +import { BosUse, Country, KEYWORD_CATEGORY, Keyword } from "@repo/db"; import { FileText, LocateIcon, PlaneIcon } from "lucide-react"; import { Input } from "../../../../_components/ui/Input"; import { useState } from "react"; -import { deleteStation, upsertStation } from "../action"; +import { deleteKeyword, upsertKeyword } from "../action"; import { Button } from "../../../../_components/ui/Button"; import { redirect } from "next/navigation"; -export const StationForm = ({ station }: { station?: Station }) => { - const form = useForm>({ - resolver: zodResolver(StationOptionalDefaultsSchema), - defaultValues: station, +export const KeywordForm = ({ keyword }: { keyword?: Keyword }) => { + const form = useForm>({ + resolver: zodResolver(KeywordOptionalDefaultsSchema), + defaultValues: keyword, }); const [loading, setLoading] = useState(false); const [deleteLoading, setDeleteLoading] = useState(false); @@ -23,85 +23,26 @@ export const StationForm = ({ station }: { station?: Station }) => {
{ setLoading(true); - const createdStation = await upsertStation(values, station?.id); + const createdKeyword = await upsertKeyword(values, keyword?.id); setLoading(false); - if (!station) redirect(`/admin/station`); + if (!keyword) redirect(`/admin/keyword`); })} className="grid grid-cols-6 gap-3" > -
+

Allgemeines

- - - - - - - -
-
-
-
-

- Standort + Ausrüstung -

-
+
- - - -
- -
-
-

- Hubschrauber -

- - - -
-
@@ -223,13 +88,13 @@ export const StationForm = ({ station }: { station?: Station }) => { > Speichern - {station && ( + {keyword && ( - -

- } - /> - - ); + return ( + <> + + Stichwörter + + } + rightOfSearch={ +

+ + + +

+ } + /> + + ); }; diff --git a/apps/hub/app/(app)/admin/station/_components/Form.tsx b/apps/hub/app/(app)/admin/station/_components/Form.tsx index c604dfa9..0cf23c93 100644 --- a/apps/hub/app/(app)/admin/station/_components/Form.tsx +++ b/apps/hub/app/(app)/admin/station/_components/Form.tsx @@ -123,33 +123,35 @@ export const StationForm = ({ station }: { station?: Station }) => { Ausgerüstet mit: -
-