fix: build
This commit is contained in:
parent
aefea1e538
commit
a190e0aa6d
6 changed files with 35 additions and 42 deletions
|
|
@ -15,6 +15,7 @@ import { getPhoto } from '@/utils/dto/gallery'
|
||||||
import { isAuthenticated } from '@/utils/auth'
|
import { isAuthenticated } from '@/utils/auth'
|
||||||
import { AdminMenu } from '@/components/AdminMenu/AdminMenu'
|
import { AdminMenu } from '@/components/AdminMenu/AdminMenu'
|
||||||
import { GroupEvents } from '@/compositions/GroupEvents/GroupEvents'
|
import { GroupEvents } from '@/compositions/GroupEvents/GroupEvents'
|
||||||
|
import { RichText } from '@payloadcms/richtext-lexical/react'
|
||||||
|
|
||||||
export default async function GroupPage({ params }: { params: Promise<{slug: string}>}) {
|
export default async function GroupPage({ params }: { params: Promise<{slug: string}>}) {
|
||||||
|
|
||||||
|
|
@ -25,7 +26,7 @@ export default async function GroupPage({ params }: { params: Promise<{slug: str
|
||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
const {id, shortDescription, photo,name, text_html, content } = groups.docs[0]
|
const {id, shortDescription, photo,name, content, text } = groups.docs[0]
|
||||||
const media = getPhoto("tablet", photo)
|
const media = getPhoto("tablet", photo)
|
||||||
|
|
||||||
const authenticated = await isAuthenticated();
|
const authenticated = await isAuthenticated();
|
||||||
|
|
@ -62,8 +63,8 @@ export default async function GroupPage({ params }: { params: Promise<{slug: str
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
{ text_html &&
|
{ text &&
|
||||||
<RawHTML html={text_html} />
|
<RichText data={text} />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
import type { Metadata } from 'next'
|
import type { Metadata } from 'next'
|
||||||
import './globals.css'
|
import './globals.css'
|
||||||
import { DynamicMenu, Menu } from '@/components/Menu/Menu'
|
import { Menu } from '@/components/Menu/Menu'
|
||||||
import { Footer } from '@/compositions/Footer/Footer'
|
import { Footer } from '@/compositions/Footer/Footer'
|
||||||
import { comment } from '@/app/(home)/layout-comment'
|
import { comment } from '@/app/(home)/layout-comment'
|
||||||
import { FONT_MAP, getFont } from '@/assets/fonts'
|
import { FONT_MAP, getFont } from '@/assets/fonts'
|
||||||
import { siteConfig } from '@/config/site'
|
import { siteConfig } from '@/config/site'
|
||||||
import { fetchDesign } from '@/fetch/design'
|
import { fetchDesign } from '@/fetch/design'
|
||||||
import { fetchSiteConfig } from '@/fetch/siteConfig'
|
import { fetchSiteConfig } from '@/fetch/siteConfig'
|
||||||
|
import { FetchedMenu } from '@/components/Menu/FetchedMenu'
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic'
|
||||||
|
|
||||||
export async function generateMetadata(): Promise<Metadata> {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
let site
|
let site
|
||||||
|
|
@ -31,6 +34,7 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||||
},
|
},
|
||||||
description,
|
description,
|
||||||
keywords,
|
keywords,
|
||||||
|
metadataBase: new URL(url),
|
||||||
openGraph: {
|
openGraph: {
|
||||||
title: name,
|
title: name,
|
||||||
description,
|
description,
|
||||||
|
|
@ -92,7 +96,7 @@ export default async function RootLayout({
|
||||||
<html lang="de" className={selectedDefaultFont.className} style={themeStyle}>
|
<html lang="de" className={selectedDefaultFont.className} style={themeStyle}>
|
||||||
<body>
|
<body>
|
||||||
<div dangerouslySetInnerHTML={{ __html: comment }}></div>
|
<div dangerouslySetInnerHTML={{ __html: comment }}></div>
|
||||||
<DynamicMenu />
|
<FetchedMenu />
|
||||||
<main className={"mainContent"}>
|
<main className={"mainContent"}>
|
||||||
{children}
|
{children}
|
||||||
</main>
|
</main>
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ export const ContactformBlock: Block = {
|
||||||
{
|
{
|
||||||
name: 'email',
|
name: 'email',
|
||||||
type: 'email',
|
type: 'email',
|
||||||
defaultValue: async ({ req }) => {
|
// defaultValue: async ({ req }) => {
|
||||||
const config = await req.payload.findGlobal({
|
// const config = await req.payload.findGlobal({
|
||||||
slug: 'site-config',
|
// slug: 'site-config',
|
||||||
})
|
// })
|
||||||
return config?.email || siteConfig.email
|
// return config?.email || siteConfig.email
|
||||||
},
|
// },
|
||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
14
src/components/Menu/FetchedMenu.tsx
Normal file
14
src/components/Menu/FetchedMenu.tsx
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { fetchMenu } from '@/fetch/config'
|
||||||
|
import { Menu } from '@/components/Menu/Menu'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a dynamic menu component.
|
||||||
|
* This component fetches menu data from a remote source and renders it.
|
||||||
|
* @returns {JSX.Element} The rendered dynamic menu component
|
||||||
|
*/
|
||||||
|
export const FetchedMenu = async () => {
|
||||||
|
|
||||||
|
const menu = await fetchMenu()
|
||||||
|
|
||||||
|
return <Menu menu={menu} />
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
"use client"
|
'use client'
|
||||||
|
|
||||||
import styles from './styles.module.scss'
|
import styles from './styles.module.scss'
|
||||||
import MenuIcon from './menu.svg'
|
import MenuIcon from './menu.svg'
|
||||||
|
|
@ -6,11 +6,10 @@ import Image from 'next/image'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import { MegaMenuItemProps, Menu as MenuType, MenuItem as MenuItemType, SimpleItemProps } from './menu.types'
|
import { MegaMenuItemProps, Menu as MenuType, MenuItem as MenuItemType, SimpleItemProps } from './menu.types'
|
||||||
import { Logo } from '@/components/Logo/Logo'
|
import { Logo } from '@/components/Logo/Logo'
|
||||||
import { Fragment, useCallback, useEffect, useState } from 'react'
|
import { Fragment, useCallback, useState } from 'react'
|
||||||
import { MegaMenu } from '@/components/MegaMenu/MegaMenu'
|
import { MegaMenu } from '@/components/MegaMenu/MegaMenu'
|
||||||
import { CollapsibleArrow } from '@/components/CollapsibleArrow/CollapsibleArrow'
|
import { CollapsibleArrow } from '@/components/CollapsibleArrow/CollapsibleArrow'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { fetchConfig } from '@/fetch/config'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a simple item component.
|
* Represents a simple item component.
|
||||||
|
|
@ -190,20 +189,3 @@ export const Menu = ({menu}: MenuProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a dynamic menu component.
|
|
||||||
* This component fetches menu data from a remote source and renders it.
|
|
||||||
* @returns {JSX.Element} The rendered dynamic menu component
|
|
||||||
*/
|
|
||||||
export const DynamicMenu = () => {
|
|
||||||
|
|
||||||
const [menu, setMenu] = useState<MenuType>({leftItems: [], rightItems: []})
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
fetchConfig().then((data) => {
|
|
||||||
setMenu(data.menu);
|
|
||||||
});
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
return <Menu menu={menu} />
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,13 @@
|
||||||
import { Menu } from '@/payload-types'
|
import { Menu } from '@/payload-types'
|
||||||
|
|
||||||
type Config = {
|
export const fetchMenu = async (): Promise<Menu> => {
|
||||||
menu: Menu
|
|
||||||
}
|
|
||||||
|
|
||||||
export const fetchConfig = async (): Promise<Config> => {
|
|
||||||
const rep = await fetch(
|
const rep = await fetch(
|
||||||
"/api/globals/menu",
|
"http://localhost:3000/api/globals/menu",
|
||||||
{ next: { tags: ['menu'] } } // cache fetch result
|
{ next: { tags: ['menu'] } } // cache fetch result
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!rep.ok) {
|
if (!rep.ok) {
|
||||||
throw new Error("Could not fetch menu")
|
throw new Error("Could not fetch menu")
|
||||||
}
|
}
|
||||||
const menu = await rep.json();
|
return await rep.json()
|
||||||
|
|
||||||
return {
|
|
||||||
menu
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue