From dba4c40ad0f98d3199a21ed8881a36ff7499df9e Mon Sep 17 00:00:00 2001 From: Enrique Date: Mon, 10 Jun 2024 14:22:48 +0200 Subject: [PATCH] new version without SSR --- app/layout.js | 15 +++++++++++---- app/tools/page.js | 4 ++-- components/Footer.js | 3 ++- components/Header.js | 2 +- components/RecentPublications.js | 2 ++ 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/layout.js b/app/layout.js index 4a28c7e..d34dbe0 100644 --- a/app/layout.js +++ b/app/layout.js @@ -1,9 +1,9 @@ -"use client" +"use client"; import { Montserrat } from "next/font/google"; import './sass/main.scss'; import "./globals.sass"; -// import 'bootstrap/dist/css/bootstrap.min.css'; +import { useState, useEffect } from "react"; // import i18n (needs to be bundled ;)) import './i18n'; @@ -11,9 +11,16 @@ import './i18n'; const montserrat = Montserrat({ subsets: ["latin"] }); export default function RootLayout({ children }) { + //disable SSR whole project, this will make the project to be rendered only on client side + const [isClient, setIsClient] = useState(false) + + useEffect(() => { + setIsClient(true) + }, []) + return ( - - {children} + + {isClient ? children:null} ); } diff --git a/app/tools/page.js b/app/tools/page.js index 19288de..d90c9c2 100644 --- a/app/tools/page.js +++ b/app/tools/page.js @@ -64,12 +64,12 @@ export default function Tools(props) { {tools.map( ({ title, description, route, logo, github, gradient }) => { return ( -
+
{"Project
-
+

{title}

diff --git a/components/Footer.js b/components/Footer.js index ea1e163..8ea8c24 100644 --- a/components/Footer.js +++ b/components/Footer.js @@ -15,6 +15,7 @@ import { } from "@fortawesome/free-brands-svg-icons"; import { useTranslation } from "react-i18next"; + export default function Footer(props) { const { t } = useTranslation(); const routes = [ @@ -59,7 +60,7 @@ export default function Footer(props) { : "text-left mb-2 font-medium" } > - + {t(route.key)} diff --git a/components/Header.js b/components/Header.js index 72067bb..f089c14 100644 --- a/components/Header.js +++ b/components/Header.js @@ -79,7 +79,7 @@ export default function Header(props) { key={index} className={route.route === props.route ? "li-selected" : ""} > - {t(route.key)} + {t(route.key)} ))} diff --git a/components/RecentPublications.js b/components/RecentPublications.js index 46b257b..27a48e0 100644 --- a/components/RecentPublications.js +++ b/components/RecentPublications.js @@ -1,3 +1,5 @@ +"use client"; + import React from "react"; import Link from "next/link"; import { useState, useEffect } from "react";