diff --git a/src/api/index.ts b/src/api/index.ts index 4a11577..c502355 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -2,3 +2,5 @@ export * from "./about"; export * from "./contact"; export * from "./gallery"; export * from "./home"; +export * from "./menu"; + diff --git a/src/api/menu.ts b/src/api/menu.ts new file mode 100644 index 0000000..1039428 --- /dev/null +++ b/src/api/menu.ts @@ -0,0 +1,12 @@ +import { Options } from "node_modules/payload/dist/collections/operations/local/find"; +import { getPayload } from "@/utils/payload"; + +export const getMenuCategories = async () => { + const payload = await getPayload(); + return payload.find({ collection: "menu-category", pagination: false }); +}; + +export const getMenuItems = async (opts: Omit, "collection">) => { + const payload = await getPayload(); + return payload.find({ collection: "menu-item", ...opts }); +}; diff --git a/src/api/openingTimes.ts b/src/api/openingTimes.ts new file mode 100644 index 0000000..3f11ee3 --- /dev/null +++ b/src/api/openingTimes.ts @@ -0,0 +1,6 @@ +import { getPayload } from "@/utils/payload"; + +export const getOpeningTimes = async () => { + const payload = await getPayload(); + return await payload.find({ collection: "opening-time", sort: "from", pagination: false }); +}; diff --git a/src/app/(frontend)/[locale]/contact/page.tsx b/src/app/(frontend)/[locale]/contact/page.tsx index a81e750..ba3c97e 100644 --- a/src/app/(frontend)/[locale]/contact/page.tsx +++ b/src/app/(frontend)/[locale]/contact/page.tsx @@ -1 +1,78 @@ -export default async function Contact() {} +import { Box, HStack, Stack } from "@styled-system/jsx"; +import { getAbout, getContact } from "@/api"; + +import { Heading } from "@/components/ui/heading"; +import { Text } from "@/components/ui/text"; +import { getI18n } from "@/i18n/server"; +import { getOpeningTimes } from "@/api/openingTimes"; +import { styled } from "@styled-system/jsx"; + +export default async function Contact() { + const t = await getI18n(); + const about = await getAbout(); + const contact = await getContact(); + const openingTimes = await getOpeningTimes(); + + return ( + + + {t("general.contact")} + + + + + {t("general.openingTimes")} + + {openingTimes.docs.map((ot) => ( + + + {t(`days.${ot.from}`)} + {ot.to ? `- ${t(`days.${ot.to}`)}` : ""} + + + {new Date(ot.timeOpen).toLocaleTimeString("de-CH", { timeStyle: "short" })} -{" "} + {new Date(ot.timeClose).toLocaleTimeString("de-CH", { timeStyle: "short" })} + + + ))} + + + + + {t("general.address")} + + + {contact.address.embeddedMaps && ( + + )} + + + {about.name} + + {contact.address.street} {contact.address.number} + + + {contact.address.zip} {contact.address.area} + + + {contact.phone && ( + + {t("general.phoneNumber")} + {contact.phone} + + )} + {contact.email && ( + + {t("general.email")} + {contact.email} + + )} + + + + + ); +} diff --git a/src/app/(frontend)/[locale]/layout.tsx b/src/app/(frontend)/[locale]/layout.tsx index 8b22843..59e18d1 100644 --- a/src/app/(frontend)/[locale]/layout.tsx +++ b/src/app/(frontend)/[locale]/layout.tsx @@ -23,13 +23,15 @@ export default async function RootLayout({ }) { return ( - - - - {children}{" "} - -