mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-22 22:54:22 +00:00
Add something to the event page
This commit is contained in:
parent
9e7bdadc3e
commit
5105ea9045
1 changed files with 35 additions and 8 deletions
|
@ -7,6 +7,13 @@ import { Postcard } from '../../components/postcard/changer'
|
||||||
import { ViewEvent } from '../../components/events/views/event'
|
import { ViewEvent } from '../../components/events/views/event'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
import { Event } from '@prisma/client'
|
import { Event } from '@prisma/client'
|
||||||
|
import { EditableText } from '../../components/generic/editable/inputs'
|
||||||
|
import { EditingContext, EditingMode } from '../../components/generic/editable/base'
|
||||||
|
import { useState } from 'react'
|
||||||
|
import { ToolBar } from '../../components/generic/toolbar/bar'
|
||||||
|
import { ToolToggleEditing } from '../../components/events/toolbar/toolToggleEditing'
|
||||||
|
import { ToolToggleVisibility } from '../../components/postcard/toolbar/toolToggleVisibility'
|
||||||
|
import { WIPBanner } from '../../components/generic/wip/banner'
|
||||||
|
|
||||||
|
|
||||||
export async function getServerSideProps(context: NextPageContext) {
|
export async function getServerSideProps(context: NextPageContext) {
|
||||||
|
@ -28,20 +35,40 @@ const PageEvent: NextPage<PageEventProps> = ({ slug }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { data, error } = useSWR<Event>(`/api/events/${slug}`)
|
const { data, error } = useSWR<Event>(`/api/events/${slug}`)
|
||||||
|
|
||||||
|
const displayTitle = data?.name ?? slug
|
||||||
|
const displayPostcard = data?.postcard ?? defaultPostcard
|
||||||
|
const displayDescription = data?.description ?? ""
|
||||||
|
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<Head>
|
<Head>
|
||||||
<title key="title">eventName - {t("siteTitle")}</title>
|
<title key="title">{displayTitle} - {t("siteTitle")}</title>
|
||||||
<link rel="preload" href={`/api/events/${slug}`} as="fetch" />
|
<link rel="preload" href={`/api/events/${slug}`} as="fetch" />
|
||||||
</Head>
|
</Head>
|
||||||
<Postcard
|
<Postcard
|
||||||
src={data?.postcard ?? defaultPostcard}
|
src={displayPostcard}
|
||||||
/>
|
/>
|
||||||
|
<WIPBanner />
|
||||||
|
<EditingContext.Provider value={useState<EditingMode>(EditingMode.VIEW)}>
|
||||||
<ViewEvent
|
<ViewEvent
|
||||||
title={<>{data?.name ?? slug}</>}
|
title={<>
|
||||||
|
<EditableText
|
||||||
|
value={displayTitle}
|
||||||
|
/>
|
||||||
|
</>}
|
||||||
postcard={<></>}
|
postcard={<></>}
|
||||||
description={<>{data?.description}</>}
|
description={<>
|
||||||
|
<EditableText
|
||||||
|
value={displayDescription}
|
||||||
|
/>
|
||||||
|
</>}
|
||||||
daterange={<></>}
|
daterange={<></>}
|
||||||
/>
|
/>
|
||||||
|
<ToolBar vertical="vadapt" horizontal="right">
|
||||||
|
<ToolToggleEditing />
|
||||||
|
<ToolToggleVisibility />
|
||||||
|
</ToolBar>
|
||||||
|
</EditingContext.Provider>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue