diff options
| author | physcik <mynameisgennadiy@vk.com> | 2026-04-11 16:40:22 +0500 |
|---|---|---|
| committer | physcik <mynameisgennadiy@vk.com> | 2026-04-11 16:40:22 +0500 |
| commit | 5d2c8369389013895264caf16e71d44bddabb22c (patch) | |
| tree | c4c9556cce9b25d2a852d32f8e2624c2ff19041b /front/src/Emelents/Topbar.tsx | |
| parent | ae614c0d1174d3b5527f1fb3dc6e339d7ad6a10b (diff) | |
Language toggle
Diffstat (limited to 'front/src/Emelents/Topbar.tsx')
| -rw-r--r-- | front/src/Emelents/Topbar.tsx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/front/src/Emelents/Topbar.tsx b/front/src/Emelents/Topbar.tsx index 6c4ef74..667b42f 100644 --- a/front/src/Emelents/Topbar.tsx +++ b/front/src/Emelents/Topbar.tsx @@ -1,12 +1,31 @@ +import { useContext } from "react"; +import { LanguageContext } from "../Locales/Context"; +import { GetString } from "../Locales/Locales"; + +const defaultPathName = 'index'; + function Topbar() { + var language = useContext(LanguageContext); + let path = getTopbarElement(window.location.pathname); + return ( <div className="Topbar"> <h1> View from the edge </h1> <div className="TopbarContents"> - <h2> Lifepath </h2> + <h2> {GetString(path, language)} </h2> </div> </div> ); } +// Extracts the black part thing from the path +function getTopbarElement(fullPath: string): string { + let path = fullPath.replace('/', ''); + if (path.length === 0) { + path = defaultPathName; + } + + return path.split('/')[0]; +} + export default Topbar; |
