diff --git a/src/app/(home)/gruppe/[slug]/page.tsx b/src/app/(home)/gruppe/[slug]/page.tsx index 80e6a85..505bf0b 100644 --- a/src/app/(home)/gruppe/[slug]/page.tsx +++ b/src/app/(home)/gruppe/[slug]/page.tsx @@ -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
- { text_html && - + { text && + }
diff --git a/src/app/(home)/layout.tsx b/src/app/(home)/layout.tsx index 57f5f69..3b03b16 100644 --- a/src/app/(home)/layout.tsx +++ b/src/app/(home)/layout.tsx @@ -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 { let site @@ -31,6 +34,7 @@ export async function generateMetadata(): Promise { }, description, keywords, + metadataBase: new URL(url), openGraph: { title: name, description, @@ -92,7 +96,7 @@ export default async function RootLayout({
- +
{children}
diff --git a/src/collections/blocks/Contactform.ts b/src/collections/blocks/Contactform.ts index 7a3b8bc..5f317f8 100644 --- a/src/collections/blocks/Contactform.ts +++ b/src/collections/blocks/Contactform.ts @@ -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, } ] diff --git a/src/components/Menu/FetchedMenu.tsx b/src/components/Menu/FetchedMenu.tsx new file mode 100644 index 0000000..f6909fa --- /dev/null +++ b/src/components/Menu/FetchedMenu.tsx @@ -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 +} \ No newline at end of file diff --git a/src/components/Menu/Menu.tsx b/src/components/Menu/Menu.tsx index 232b1b2..c07fa9b 100644 --- a/src/components/Menu/Menu.tsx +++ b/src/components/Menu/Menu.tsx @@ -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({leftItems: [], rightItems: []}) - - useEffect(() => { - fetchConfig().then((data) => { - setMenu(data.menu); - }); - }, []) - - return -} diff --git a/src/fetch/config.ts b/src/fetch/config.ts index a48be53..3c45c4e 100644 --- a/src/fetch/config.ts +++ b/src/fetch/config.ts @@ -1,21 +1,13 @@ import { Menu } from '@/payload-types' -type Config = { - menu: Menu -} - -export const fetchConfig = async (): Promise => { +export const fetchMenu = async (): Promise => { 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() } \ No newline at end of file