import { Event } from "@prisma/client" import { useTranslation } from "next-i18next" import { Dispatch, SetStateAction, useMemo } from "react" import { KeyedMutator } from "swr" import { UsePromise } from "../../generic/loading/promise" import { ViewContent } from "../../generic/views/content" export type EventsActionViewProps = { data: Event, setData: Dispatch>, save: UsePromise, setEditing: Dispatch, } export const EventsActionEdit = ({ data, setData, save, setEditing }: EventsActionViewProps) => { const { t } = useTranslation() const name = data.name const description = data.description const postcard = data.postcard return (
{ e.preventDefault() save.run() setEditing(false) }}>

{useMemo( () => ( setData(prev => ({ ...prev!, name: e.target.value }))} placeholder={t("eventNamePlaceholder")} /> ), [t, setData, name] )}

{useMemo( () => (