import { default as classNames } from "classnames"; import { useTranslation } from "next-i18next"; import { HTMLProps } from "react"; import { useMyEventsSWR } from "../hooks/swr/useMyEventsSWR"; import { Loading } from "./Loading"; import { EventList } from "./EventList"; import { EventCreate } from "./EventCreate"; export function ActionEventList(props: HTMLProps) { const { t } = useTranslation() const { data, error } = useMyEventsSWR() 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}
) }