/* eslint-disable @next/next/no-img-element */ import styles from "../styles/Surroundings.module.scss"; import { db } from "../firebase-config"; import { collection, doc, getDoc, getDocs } from "firebase/firestore"; import { useRouter } from "next/router"; export async function getInitialProps({ router }) { let pageProps = {}; const { locale } = router; return { pageProps, locale }; } export async function getServerSideProps({ locale }) { const dataLocale = await getDoc(doc(db, "localeTexts", locale)); const dataFurnishings = await getDocs(collection(db, "furnishings")); return { props: { localeTexts: dataLocale.data() ?? {}, furnishings: dataFurnishings.docs.map((doc) => ({ ...doc.data(), id: doc.id })) ?? {}, }, }; } export default function Furnishing({ furnishings, localeTexts }) { const { locale } = useRouter(); return (

{localeTexts?.furnishings?.headline}

{furnishings.map((s, i) => { { console.log(locale); } return (

{locale === "en" ? s.title.en : s.title.de}

{locale
{s.links?.map((l, i2) => { return ( {locale === "en" ? l.text.en : l.text.de} ); })}
); })}
); }