Skip to content

Commit

Permalink
fix lng
Browse files Browse the repository at this point in the history
  • Loading branch information
Evi-2003 committed Nov 2, 2024
1 parent 8e1b3b6 commit 0bb963a
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 162 deletions.
31 changes: 7 additions & 24 deletions app/en-US/about-me/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import froukje from '@/app/images/froukje-cover.png';
import glassanimals from '@/app/images/glassanimals.jpeg';
import s10 from '@/app/images/s10.jpeg';
import twofeet from '@/app/images/twofeet.jpeg';
import checkLanguage from '@/app/utils/checkLanguage';
import Image from 'next/image';

async function getSeoData(lng: string) {
Expand Down Expand Up @@ -30,13 +29,8 @@ async function getSeoData(lng: string) {
return data;
}

export async function generateMetadata(props: { params: Promise<{ lang: string }> }) {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const metaData = await getSeoData(lng);
export async function generateMetadata() {
const metaData = await getSeoData('en');

return {
title: metaData.pagina.seoGegevens.title,
Expand Down Expand Up @@ -66,13 +60,8 @@ async function getOverMij(lng: string) {
return data;
}

export default async function overMij(props: { params: Promise<{ lang: string }> }) {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const getData = await getOverMij(lng);
export default async function overMij() {
const getData = await getOverMij('en');
const data = getData.overMij;
return (
<main className="grid w-4/5 grid-cols-2 gap-2 text-stone-800 lg:w-3/5 2xl:w-6/12 dark:text-stone-100">
Expand All @@ -82,9 +71,7 @@ export default async function overMij(props: { params: Promise<{ lang: string }>
className="col-span-full row-start-3 flex w-full flex-col justify-center space-y-2 rounded-lg bg-slate-100 px-10
py-5 pb-10 shadow dark:bg-neutral-800 dark:text-stone-100"
>
<h3 className="mb-2 text-center text-2xl font-semibold">
{lng === 'en' ? 'My favorite artists 🎶' : 'Mijn favoriete artiesten 🎶'}
</h3>
<h3 className="mb-2 text-center text-2xl font-semibold">My favorite artists 🎶</h3>
<ul className="flex flex-col items-center justify-center gap-10 lg:flex-row">
<li className="h-44 w-44 text-center font-bold hover:scale-95">
<a
Expand Down Expand Up @@ -149,9 +136,7 @@ export default async function overMij(props: { params: Promise<{ lang: string }>
className="col-span-full row-start-4 flex h-fit flex-col justify-start space-y-2 rounded-lg bg-slate-100 px-10
py-5 pb-10 shadow lg:col-span-1 dark:bg-neutral-800 dark:text-stone-100"
>
<h3 className="mb-2 text-center text-2xl font-semibold">
{lng === 'en' ? 'My favorite songs 🔊' : 'Mijn favoriete nummers 🔊'}
</h3>
<h3 className="mb-2 text-center text-2xl font-semibold">My favorite songs 🔊</h3>
<ul className="flex flex-col items-center justify-center gap-1">
<li>
<iframe
Expand Down Expand Up @@ -195,9 +180,7 @@ export default async function overMij(props: { params: Promise<{ lang: string }>
className="col-span-full row-start-5 flex h-fit w-full flex-col justify-center space-y-2 rounded-lg bg-slate-100
px-10 py-5 pb-10 shadow lg:col-start-2 lg:row-start-4 dark:bg-neutral-800 dark:text-stone-100"
>
<h3 className="mb-2 text-center text-2xl font-semibold">
{lng === 'en' ? 'Great music 🎧' : 'Goeie muziek 🎧'}
</h3>
<h3 className="mb-2 text-center text-2xl font-semibold">Great music 🎧</h3>
<iframe
src="https://open.spotify.com/embed/playlist/6R7LQidnLidYgzdZzINase?utm_source=generator&theme=0"
width="100%"
Expand Down
17 changes: 5 additions & 12 deletions app/en-US/gallery/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,28 +97,21 @@ export async function generateMetadata(props: { params: Promise<{ lang: string }
};
}

const Page = async (props: { params: Promise<{ lang: string }> }) => {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const { allAfbeeldings } = await getGalleryImages(lng);
const Page = async () => {
const { allAfbeeldings } = await getGalleryImages('en');

Fancybox.bind('[data-fancybox="gallery"]', {});

return (
<main className="flex w-5/6 flex-col dark:text-stone-100">
<h1 className="col-span-3 row-span-1 mb-3 text-4xl font-bold text-stone-800 dark:text-stone-100">
{lng === 'en' ? 'Gallery' : 'Galerij'}
</h1>
<h1 className="col-span-3 row-span-1 mb-3 text-4xl font-bold text-stone-800 dark:text-stone-100">Gallery</h1>

<div className="flex justify-between">
<span
className="row-start-1 mb-2 w-fit self-center rounded-full bg-stone-300 px-3 py-1 text-left text-black
opacity-80 dark:bg-stone-700 dark:text-white dark:opacity-100"
>
{`${lng === 'en' ? 'Used camera:' : 'Gebruikte camera:'} Pentax ME Super`}
Used camera: Pentax ME Super
</span>
</div>

Expand All @@ -140,7 +133,7 @@ const Page = async (props: { params: Promise<{ lang: string }> }) => {
<span
className={`${index > 0 && 'my-2'} col-span-full row-start-1 w-fit self-center rounded-full bg-stone-300
px-3 py-1 text-left text-black opacity-80 dark:bg-stone-700 dark:text-white dark:opacity-100`}
>{`${lng === 'en' ? 'Used film:' : 'Gebruikte fotorol:'} ${collection.fotorolletje}`}</span>
>{`Used film: ${collection.fotorolletje}`}</span>

{collection.cloudflareAfbeeldingen.map((image: { imageId: string }, indexCloudflare: number) => (
<GalleryImage
Expand Down
9 changes: 2 additions & 7 deletions app/en-US/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,8 @@ async function getBasicInfo(lng: string) {
return data;
}

export default async function Home(props: { params: Promise<{ lang: string }> }) {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const getData = await getBasicInfo(lng);
export default async function Home() {
const getData = await getBasicInfo('en');
const data = getData.overMij;

return (
Expand Down
12 changes: 6 additions & 6 deletions app/en-US/projects/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ async function getProject(slug: string, lng: string) {
return data;
}

export default async function Projecten(props: { params: Promise<{ slug: string; lang: string }> }) {
export default async function Projecten(props: { params: Promise<{ slug: string }> }) {
const params = await props.params;

const { slug, lang } = params;
const { slug } = params;

const slugSplitted = slug.split('/');
const lng = checkLanguage(lang);
const getData = await getProject(slugSplitted[0], lng);

const getData = await getProject(slugSplitted[0], 'en');
const data = getData.projecten;

return (
Expand All @@ -125,8 +125,8 @@ export default async function Projecten(props: { params: Promise<{ slug: string;
dark:text-white"
>
<div className="col-span-full row-start-1 text-sm">
<Link href={`/${lng === 'nl' ? 'nl-NL' : 'en-US'}/projects`} prefetch>
{lng === 'en' ? 'Projects' : 'Projecten'}
<Link href={'/en-US/projects'} prefetch>
Projects
</Link>
<span className="mx-2">/</span>
<span>{data.title}</span>
Expand Down
21 changes: 5 additions & 16 deletions app/en-US/projects/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import CloudflareImage from '@/app/components/CloudflareImage';
import checkLanguage from '@/app/utils/checkLanguage';
import Link from 'next/link';
import { Image as ResponsiveImage } from 'react-datocms';

Expand Down Expand Up @@ -32,13 +31,8 @@ async function getSeoData(lng: string) {
return data;
}

export async function generateMetadata(props: { params: Promise<{ lang: string }> }) {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const metaData = await getSeoData(lng);
export async function generateMetadata() {
const metaData = await getSeoData('en');

return {
title: metaData.pagina.seoGegevens.title,
Expand Down Expand Up @@ -85,14 +79,9 @@ async function getWerkErvaring(lng: string) {
return data;
}

export default async function Projecten(props: { params: Promise<{ lang: string }> }) {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const getData = await getWerkErvaring(lng);
const { pagina } = await getSeoData(lng);
export default async function Projecten() {
const getData = await getWerkErvaring('en');
const { pagina } = await getSeoData('en');
const data = getData.allProjectens;

return (
Expand Down
16 changes: 4 additions & 12 deletions app/en-US/work-experience/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import checkLanguage from '@/app/utils/checkLanguage';
import React from 'react';

async function getSeoData(lng: string) {
Expand Down Expand Up @@ -62,14 +61,9 @@ async function getWerkErvaring(lng: string) {
return data;
}

export default async function Werkervaring(props: { params: Promise<{ lang: string }> }) {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const { allWerkervarings: data } = await getWerkErvaring(lng);
const { pagina } = await getSeoData(lng);
export default async function Werkervaring() {
const { allWerkervarings: data } = await getWerkErvaring('en');
const { pagina } = await getSeoData('en');

return (
<main className="text-center text-stone-800 dark:text-stone-100">
Expand Down Expand Up @@ -119,9 +113,7 @@ export default async function Werkervaring(props: { params: Promise<{ lang: stri
month: '2-digit',
year: 'numeric',
})
: lng === 'en'
? 'Present'
: 'Heden'}
: 'Present'}
</span>
</li>
),
Expand Down
21 changes: 5 additions & 16 deletions app/nl-NL/about-me/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,8 @@ async function getOverMij(lng: string) {
return data;
}

export default async function overMij(props: { params: Promise<{ lang: string }> }) {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const getData = await getOverMij(lng);
export default async function overMij() {
const getData = await getOverMij('nl');
const data = getData.overMij;
return (
<main className="grid w-4/5 grid-cols-2 gap-2 text-stone-800 lg:w-3/5 2xl:w-6/12 dark:text-stone-100">
Expand All @@ -82,9 +77,7 @@ export default async function overMij(props: { params: Promise<{ lang: string }>
className="col-span-full row-start-3 flex w-full flex-col justify-center space-y-2 rounded-lg bg-slate-100 px-10
py-5 pb-10 shadow dark:bg-neutral-800 dark:text-stone-100"
>
<h3 className="mb-2 text-center text-2xl font-semibold">
{lng === 'en' ? 'My favorite artists 🎶' : 'Mijn favoriete artiesten 🎶'}
</h3>
<h3 className="mb-2 text-center text-2xl font-semibold">Mijn favoriete artiesten 🎶</h3>
<ul className="flex flex-col items-center justify-center gap-10 lg:flex-row">
<li className="h-44 w-44 text-center font-bold hover:scale-95">
<a
Expand Down Expand Up @@ -149,9 +142,7 @@ export default async function overMij(props: { params: Promise<{ lang: string }>
className="col-span-full row-start-4 flex h-fit flex-col justify-start space-y-2 rounded-lg bg-slate-100 px-10
py-5 pb-10 shadow lg:col-span-1 dark:bg-neutral-800 dark:text-stone-100"
>
<h3 className="mb-2 text-center text-2xl font-semibold">
{lng === 'en' ? 'My favorite songs 🔊' : 'Mijn favoriete nummers 🔊'}
</h3>
<h3 className="mb-2 text-center text-2xl font-semibold">Mijn favoriete nummers 🔊</h3>
<ul className="flex flex-col items-center justify-center gap-1">
<li>
<iframe
Expand Down Expand Up @@ -195,9 +186,7 @@ export default async function overMij(props: { params: Promise<{ lang: string }>
className="col-span-full row-start-5 flex h-fit w-full flex-col justify-center space-y-2 rounded-lg bg-slate-100
px-10 py-5 pb-10 shadow lg:col-start-2 lg:row-start-4 dark:bg-neutral-800 dark:text-stone-100"
>
<h3 className="mb-2 text-center text-2xl font-semibold">
{lng === 'en' ? 'Great music 🎧' : 'Goeie muziek 🎧'}
</h3>
<h3 className="mb-2 text-center text-2xl font-semibold">Goeie muziek 🎧</h3>
<iframe
src="https://open.spotify.com/embed/playlist/6R7LQidnLidYgzdZzINase?utm_source=generator&theme=0"
width="100%"
Expand Down
27 changes: 7 additions & 20 deletions app/nl-NL/gallery/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Fancybox } from '@fancyapps/ui';
import '@fancyapps/ui/dist/fancybox/fancybox.css';
import GalleryImage from '@/app/components/GalleryImage';
import checkLanguage from '@/app/utils/checkLanguage';

async function getGalleryImages(lng: string) {
const { data } = await fetch(`${process.env.DATO_CMS_URL}`, {
Expand Down Expand Up @@ -83,42 +82,30 @@ async function getSeoData(lng: string) {
return data;
}

export async function generateMetadata(props: { params: Promise<{ lang: string }> }) {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const metaData = await getSeoData(lng);
export async function generateMetadata() {
const metaData = await getSeoData('nl');

return {
title: metaData.pagina.seoGegevens.title,
description: metaData.pagina.seoGegevens.description,
};
}

const Page = async (props: { params: Promise<{ lang: string }> }) => {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const { allAfbeeldings } = await getGalleryImages(lng);
const Page = async () => {
const { allAfbeeldings } = await getGalleryImages('nl');

Fancybox.bind('[data-fancybox="gallery"]', {});

return (
<main className="flex w-5/6 flex-col dark:text-stone-100">
<h1 className="col-span-3 row-span-1 mb-3 text-4xl font-bold text-stone-800 dark:text-stone-100">
{lng === 'en' ? 'Gallery' : 'Galerij'}
</h1>
<h1 className="col-span-3 row-span-1 mb-3 text-4xl font-bold text-stone-800 dark:text-stone-100">Galerij</h1>

<div className="flex justify-between">
<span
className="row-start-1 mb-2 w-fit self-center rounded-full bg-stone-300 px-3 py-1 text-left text-black
opacity-80 dark:bg-stone-700 dark:text-white dark:opacity-100"
>
{`${lng === 'en' ? 'Used camera:' : 'Gebruikte camera:'} Pentax ME Super`}
Gebruikte camera: Pentax ME Super
</span>
</div>

Expand All @@ -140,7 +127,7 @@ const Page = async (props: { params: Promise<{ lang: string }> }) => {
<span
className={`${index > 0 && 'my-2'} col-span-full row-start-1 w-fit self-center rounded-full bg-stone-300
px-3 py-1 text-left text-black opacity-80 dark:bg-stone-700 dark:text-white dark:opacity-100`}
>{`${lng === 'en' ? 'Used film:' : 'Gebruikte fotorol:'} ${collection.fotorolletje}`}</span>
>{`Gebruikte fotorol: ${collection.fotorolletje}`}</span>

{collection.cloudflareAfbeeldingen.map((image: { imageId: string }, indexCloudflare: number) => (
<GalleryImage
Expand Down
19 changes: 4 additions & 15 deletions app/nl-NL/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import checkLanguage from '@/app/utils/checkLanguage';
import { Image as ResponsiveImage, StructuredText } from 'react-datocms';

async function getSeoData(lng: string) {
Expand Down Expand Up @@ -29,13 +28,8 @@ async function getSeoData(lng: string) {
return data;
}

export async function generateMetadata(props: { params: Promise<{ lang: string }> }) {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const metaData = await getSeoData(lng);
export async function generateMetadata() {
const metaData = await getSeoData('nl');

return {
title: metaData.pagina.seoGegevens.title,
Expand Down Expand Up @@ -83,13 +77,8 @@ async function getBasicInfo(lng: string) {
return data;
}

export default async function Home(props: { params: Promise<{ lang: string }> }) {
const params = await props.params;

const { lang } = params;

const lng = checkLanguage(lang);
const getData = await getBasicInfo(lng);
export default async function Home() {
const getData = await getBasicInfo('nl');
const data = getData.overMij;

return (
Expand Down
Loading

0 comments on commit 0bb963a

Please sign in to comment.