diff options
| author | physcik <mynameisgennadiy@vk.com> | 2026-04-28 23:33:59 +0500 |
|---|---|---|
| committer | physcik <mynameisgennadiy@vk.com> | 2026-04-28 23:33:59 +0500 |
| commit | 533c04d9558bd0a575671c157ca42236f59a2c5a (patch) | |
| tree | 895ec8672f9633fd6cfef85f6a12921fc5339ab3 /front/src/Emelents/Topbar.tsx | |
| parent | ec5ef35ed47b90b9f09199d28f7885f8287815a8 (diff) | |
frontend auth
Diffstat (limited to 'front/src/Emelents/Topbar.tsx')
| -rw-r--r-- | front/src/Emelents/Topbar.tsx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/front/src/Emelents/Topbar.tsx b/front/src/Emelents/Topbar.tsx index 73e0e38..284cbb9 100644 --- a/front/src/Emelents/Topbar.tsx +++ b/front/src/Emelents/Topbar.tsx @@ -1,4 +1,5 @@ import { useContext } from "react"; +import { AuthContext } from "../Authentication/ContextProvider"; import { LanguageContext } from "../Locales/Context"; import { GetLocalizedString } from "../Locales/Locales"; @@ -6,11 +7,20 @@ const defaultPathName = 'index'; function Topbar() { var language = useContext(LanguageContext); + var user = useContext(AuthContext); let path = getTopbarElement(window.location.pathname); + function getTopText() { + if (user == null) { + return <h1> View from the edge </h1>; + } else { + return <h1> <img src={"/EBM.webp"} /> { `${GetLocalizedString("Welcome", language)}, ${user.Username}` } </h1>; + } + } + return ( <div className="Topbar"> - <h1> View from the edge </h1> + { getTopText() } <div className="TopbarContents"> <h2> {GetLocalizedString(path, language)} </h2> </div> |
