- {/*

*/}
-
-
+
-
{item.description}
{
);
};
-export default EcosystemGrid;
+export default React.memo(EcosystemGrid);
diff --git a/package.json b/package.json
index 7f4161e..b5d6359 100644
--- a/package.json
+++ b/package.json
@@ -6,26 +6,26 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
- "lint": "next lint"
+ "lint": "next lint",
+ "analyze": "ANALYZE=true next build"
},
"dependencies": {
"aos": "^2.3.4",
"axios": "^1.1.3",
- "lighthouse_ui_2.0": "file:",
- "next": "12.3.1",
+ "next": "^12.3.1",
"react": "18.2.0",
"react-countup": "^6.5.0",
"react-dom": "18.2.0",
"react-icons": "^4.7.1",
"react-markdown": "^8.0.5",
"react-paginate": "^8.1.4",
- "react-pagination": "^1.0.0",
"react-toastify": "^9.1.1",
"rfs": "^10.0.0",
"sass": "^1.55.0",
"swiper": "^8.4.7"
},
"devDependencies": {
+ "@next/bundle-analyzer": "^12.3.1",
"eslint": "8.25.0",
"eslint-config-next": "12.3.1"
}
diff --git a/pages/_app.js b/pages/_app.js
index 03befd5..ce806f3 100644
--- a/pages/_app.js
+++ b/pages/_app.js
@@ -3,8 +3,6 @@ import "../styles/globals.scss";
import "swiper/css";
import "swiper/css/navigation";
import "swiper/css/pagination";
-import AOS from "aos";
-import "aos/dist/aos.css";
import { useEffect, useState } from "react";
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
@@ -15,36 +13,45 @@ function MyApp({ Component, pageProps }) {
const [theme, setTheme] = useState(null);
useEffect(() => {
- AOS.init({
- disable: false,
- startEvent: "DOMContentLoaded",
- initClassName: "aos-init",
- animatedClassName: "aos-animate",
- useClassNames: false,
- disableMutationObserver: false,
- debounceDelay: 50,
- throttleDelay: 99,
+ const initAOS = async () => {
+ if (typeof window !== 'undefined') {
+ const AOS = (await import('aos')).default;
+ await import('aos/dist/aos.css');
+
+ AOS.init({
+ disable: false,
+ startEvent: "DOMContentLoaded",
+ initClassName: "aos-init",
+ animatedClassName: "aos-animate",
+ useClassNames: false,
+ disableMutationObserver: false,
+ debounceDelay: 50,
+ throttleDelay: 99,
+ offset: 120,
+ delay: 0,
+ duration: 400,
+ easing: "ease",
+ once: true,
+ mirror: false,
+ anchorPlacement: "top-center",
+ });
+ }
+ };
- offset: 120,
- delay: 0,
- duration: 400,
- easing: "ease",
- once: true,
- mirror: false,
- anchorPlacement: "top-center",
- });
- const themeFromLocalStorage = JSON.parse(
- localStorage?.getItem("lighthouse.storage/store") || "{}"
- );
- if (themeFromLocalStorage?.theme) {
- setTheme(themeFromLocalStorage?.theme);
- } else {
- setTheme("dark");
+ initAOS();
+
+ if (typeof window !== 'undefined') {
+ const themeFromLocalStorage = JSON.parse(
+ localStorage?.getItem("lighthouse.storage/store") || "{}"
+ );
+ setTheme(themeFromLocalStorage?.theme || "dark");
}
}, []);
useEffect(() => {
- themeChanger(theme);
+ if (theme) {
+ themeChanger(theme);
+ }
}, [theme]);
return (
diff --git a/utils/services/theme.js b/utils/services/theme.js
index 36ee513..900781f 100644
--- a/utils/services/theme.js
+++ b/utils/services/theme.js
@@ -42,12 +42,24 @@ const ThemeProperties = [
];
export const themeChanger = (theme) => {
- theme &&
- localStorage.setItem("lighthouse.storage/store", JSON.stringify({ theme }));
- ThemeProperties.forEach((property) => {
- document.documentElement.style.setProperty(
- `${property?.property}`,
- theme === "dark" ? property?.dark : property?.light
- );
- });
+ if (!theme || typeof window === 'undefined') return;
+
+ try {
+ requestAnimationFrame(() => {
+ localStorage.setItem(
+ "lighthouse.storage/store",
+ JSON.stringify({ theme })
+ );
+
+ const style = document.documentElement.style;
+ ThemeProperties.forEach((property) => {
+ style.setProperty(
+ property.property,
+ theme === "dark" ? property.dark : property.light
+ );
+ });
+ });
+ } catch (error) {
+ console.error('Error updating theme:', error);
+ }
};