diff --git a/src/App.jsx b/src/App.jsx index 1138f59..f87a46d 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,16 +1,34 @@ +import { useEffect, useState } from 'react'; import NavBar from '@/components/NavBar/NavBar' import PageRoutes from '@/components/PageRoutes' +import Welcome from '@/pages/Welcome'; import "./i18n.js"; const App = () => { + const [isNew, setNew] = useState(false); + useEffect(() => { + if (!localStorage.getItem("visited")) { + setNew(true); + } + }, []); + + const handleWelcomeComplete = () => { + localStorage.setItem("visited", "true"); + setNew(false); + }; + return ( <>
- + {isNew ? ( + + ) : ( + + )}
diff --git a/src/components/Dropdown/LanguageDropdown.jsx b/src/components/Dropdown/LanguageDropdown.jsx index bc18a11..509d715 100644 --- a/src/components/Dropdown/LanguageDropdown.jsx +++ b/src/components/Dropdown/LanguageDropdown.jsx @@ -10,6 +10,9 @@ const langMapping = { Türkçe: "tr", }; + + + const LanguageDropdown = () => { const [selectedLang, setSelectedLang] = useState(); const { i18n } = useTranslation(); @@ -17,10 +20,12 @@ const LanguageDropdown = () => { useEffect(() => { const savedLang = i18n.language; if (savedLang) { - const langName = Object.keys(langMapping).find(key => langMapping[key] === savedLang); + const langName = Object.keys(langMapping).find(key => langMapping[key] === savedLang); setSelectedLang(langName); + } - }, []); + + }, [selectedLang]); const handleSelectLang = (langName) => { const langCode = langMapping[langName]; diff --git a/src/components/NavBar/NavLink.jsx b/src/components/NavBar/NavLink.jsx index cb724a8..30d5ad3 100644 --- a/src/components/NavBar/NavLink.jsx +++ b/src/components/NavBar/NavLink.jsx @@ -2,8 +2,6 @@ import { Link, useLocation } from 'wouter'; const NavLink = ({ href, isMobile, children }) => { const [location] = useLocation(); - console.log("location:", location) - console.log("href:", href) return ( { + const [, setLocation] = useLocation(); + + return ( + <> +
+
+

Dillar Academy

+

Free English education for Uyghurs around the world.

+
+
+ +
+
+

Already have an account?

+
+
+ + ); +}; + +export default Welcome;