diff --git a/frontend/src/app/[id]/loading.tsx b/frontend/src/app/[id]/loading.tsx new file mode 100644 index 0000000..25825ef --- /dev/null +++ b/frontend/src/app/[id]/loading.tsx @@ -0,0 +1,17 @@ +import EventAvailabilities from '/src/app/[id]/EventAvailabilities' +import Content from '/src/components/Content/Content' + +import styles from './page.module.scss' + +const Loading = async () => <> + +

+
+
+
+
+ + + + +export default Loading diff --git a/frontend/src/app/[id]/page.tsx b/frontend/src/app/[id]/page.tsx index 44b18f1..0090a33 100644 --- a/frontend/src/app/[id]/page.tsx +++ b/frontend/src/app/[id]/page.tsx @@ -6,7 +6,7 @@ import { Temporal } from '@js-temporal/polyfill' import Content from '/src/components/Content/Content' import Copyable from '/src/components/Copyable/Copyable' -import { EventResponse, getEvent } from '/src/config/api' +import { getEvent } from '/src/config/api' import { useTranslation } from '/src/i18n/server' import { makeClass, relativeTimeFormat } from '/src/utils' @@ -27,7 +27,10 @@ export const generateMetadata = async ({ params }: PageProps): Promise } const Page = async ({ params }: PageProps) => { - const event = getEvent(params.id) + const event = await getEvent(params.id).catch(() => undefined) + if (!event) notFound() + + const { t, i18n } = await useTranslation(['common', 'event']) return <> {
} > - + +

{event.name}

+ {t('common:created', { date: relativeTimeFormat(Temporal.Instant.fromEpochSeconds(event.created_at), i18n.language) })} + + + {`https://crab.fit/${event.id}`} + +

+ ___ +

+
- undefined)} /> + } -const EventMeta = async (props: { event: Promise }) => { - const event = await props.event.catch(() => undefined) - if (!event) notFound() - - const { t, i18n } = await useTranslation(['common', 'event']) - - return -

{event.name}

- {t('common:created', { date: relativeTimeFormat(Temporal.Instant.fromEpochSeconds(event.created_at), i18n.language) })} - - - {`https://crab.fit/${event.id}`} - -

- ___ -

-
-} - export default Page diff --git a/frontend/src/components/Login/Login.tsx b/frontend/src/components/Login/Login.tsx index c3178ec..d3f86c3 100644 --- a/frontend/src/components/Login/Login.tsx +++ b/frontend/src/components/Login/Login.tsx @@ -78,6 +78,7 @@ const Login = ({ eventId, user, onChange }: LoginProps) => { type="text" isInline required + disabled={!eventId} {...register('username')} /> @@ -85,13 +86,14 @@ const Login = ({ eventId, user, onChange }: LoginProps) => { label={t('form.password')} type="password" isInline + disabled={!eventId} {...register('password')} /> setError(undefined)}>{error}