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 { AdminMenu } from '@/components/AdminMenu/AdminMenu'
|
||||
import { GroupEvents } from '@/compositions/GroupEvents/GroupEvents'
|
||||
import { RichText } from '@payloadcms/richtext-lexical/react'
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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 authenticated = await isAuthenticated();
|
||||
|
|
@ -62,8 +63,8 @@ export default async function GroupPage({ params }: { params: Promise<{slug: str
|
|||
<Row>
|
||||
<Col>
|
||||
<div className={styles.content}>
|
||||
{ text_html &&
|
||||
<RawHTML html={text_html} />
|
||||
{ text &&
|
||||
<RichText data={text} />
|
||||
}
|
||||
</div>
|
||||
</Col>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
import type { Metadata } from 'next'
|
||||
import './globals.css'
|
||||
import { DynamicMenu, Menu } from '@/components/Menu/Menu'
|
||||
import { Menu } from '@/components/Menu/Menu'
|
||||
import { Footer } from '@/compositions/Footer/Footer'
|
||||
import { comment } from '@/app/(home)/layout-comment'
|
||||
import { FONT_MAP, getFont } from '@/assets/fonts'
|
||||
import { siteConfig } from '@/config/site'
|
||||
import { fetchDesign } from '@/fetch/design'
|
||||
import { fetchSiteConfig } from '@/fetch/siteConfig'
|
||||
import { FetchedMenu } from '@/components/Menu/FetchedMenu'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
let site
|
||||
|
|
@ -31,6 +34,7 @@ export async function generateMetadata(): Promise<Metadata> {
|
|||
},
|
||||
description,
|
||||
keywords,
|
||||
metadataBase: new URL(url),
|
||||
openGraph: {
|
||||
title: name,
|
||||
description,
|
||||
|
|
@ -92,7 +96,7 @@ export default async function RootLayout({
|
|||
<html lang="de" className={selectedDefaultFont.className} style={themeStyle}>
|
||||
<body>
|
||||
<div dangerouslySetInnerHTML={{ __html: comment }}></div>
|
||||
<DynamicMenu />
|
||||
<FetchedMenu />
|
||||
<main className={"mainContent"}>
|
||||
{children}
|
||||
</main>
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ export const ContactformBlock: Block = {
|
|||
{
|
||||
name: 'email',
|
||||
type: 'email',
|
||||
defaultValue: async ({ req }) => {
|
||||
const config = await req.payload.findGlobal({
|
||||
slug: 'site-config',
|
||||
})
|
||||
return config?.email || siteConfig.email
|
||||
},
|
||||
// defaultValue: async ({ req }) => {
|
||||
// const config = await req.payload.findGlobal({
|
||||
// slug: 'site-config',
|
||||
// })
|
||||
// return config?.email || siteConfig.email
|
||||
// },
|
||||
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 MenuIcon from './menu.svg'
|
||||
|
|
@ -6,11 +6,10 @@ import Image from 'next/image'
|
|||
import classNames from 'classnames'
|
||||
import { MegaMenuItemProps, Menu as MenuType, MenuItem as MenuItemType, SimpleItemProps } from './menu.types'
|
||||
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 { CollapsibleArrow } from '@/components/CollapsibleArrow/CollapsibleArrow'
|
||||
import Link from 'next/link'
|
||||
import { fetchConfig } from '@/fetch/config'
|
||||
|
||||
/**
|
||||
* 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'
|
||||
|
||||
type Config = {
|
||||
menu: Menu
|
||||
}
|
||||
|
||||
export const fetchConfig = async (): Promise<Config> => {
|
||||
export const fetchMenu = async (): Promise<Menu> => {
|
||||
const rep = await fetch(
|
||||
"/api/globals/menu",
|
||||
"http://localhost:3000/api/globals/menu",
|
||||
{ next: { tags: ['menu'] } } // cache fetch result
|
||||
);
|
||||
|
||||
if (!rep.ok) {
|
||||
throw new Error("Could not fetch menu")
|
||||
}
|
||||
const menu = await rep.json();
|
||||
|
||||
return {
|
||||
menu
|
||||
}
|
||||
return await rep.json()
|
||||
}
|
||||
Loading…
Reference in a new issue