import classNames from "classnames"; import { useTranslation } from "next-i18next"; import { HTMLProps } from "react"; import { useMyEvents } from "../hooks/useMyEvents"; import { Loading } from "./Loading"; import { Event } from "@prisma/client"; import { EventList } from "./EventList"; import { EventCreate } from "./EventCreate"; export function ActionEventList(props: HTMLProps) { const {t} = useTranslation() const { data, error } = useMyEvents() const newClassName = classNames(props.className, { "negative": error, }) let contents: JSX.Element if(error) { contents = <>

{t("eventListError")}

{JSON.stringify(error)} } else if(!data) { contents = } else { if(data.length === 0) { contents = <>

{t("eventListCreateFirst")}

} else { contents = <>

{t("eventListDescription")}

{t("eventListCreateAnother")}

} } return (
{contents}
) }