import { useContext } from "react"; import { AuthContext } from "../Authentication/ContextProvider"; import { LanguageContext } from "../Locales/Context"; import { GetLocalizedString } from "../Locales/Locales"; 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

View from the edge

; } else { return

{ `${GetLocalizedString("Welcome", language)}, ${user.Username}` }

; } } return (
{ getTopText() }

{GetLocalizedString(path, language)}

); } // 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;