diff --git a/teamized/app/src/components/pageloader.jsx b/teamized/app/src/components/pageloader.jsx index 8745868..fad6138 100644 --- a/teamized/app/src/components/pageloader.jsx +++ b/teamized/app/src/components/pageloader.jsx @@ -15,15 +15,17 @@ import * as Cache from "../utils/cache.js"; This component is used to render the pages. */ -export const PAGELIST = [ - "home", - "club", - "calendars", - "team", - "teamlist", - "workingtime", - "todo", -] +export const PAGE_NAMES = { + "home": "Startseite", + "club": "Verein", + "calendars": "Kalender", + "team": "Team", + "teamlist": "Teams", + "workingtime": "Arbeitszeit", + "todo": "To-do-Listen", +} + +export const PAGE_LIST = Object.keys(PAGE_NAMES); export class PageLoader extends React.Component { constructor(props) { diff --git a/teamized/app/src/utils/navigation.js b/teamized/app/src/utils/navigation.js index 21d2640..8d2e47b 100644 --- a/teamized/app/src/utils/navigation.js +++ b/teamized/app/src/utils/navigation.js @@ -2,18 +2,25 @@ * Module for navigation, routing and rendering */ -import {PageLoader, PAGELIST} from "../components/pageloader.js"; +import {PageLoader, PAGE_LIST, PAGE_NAMES} from "../components/pageloader.js"; import AppMenubar from "../components/menubar.js"; import AppSidebar from "../components/sidebar.js"; import * as Teams from './teams.js'; +import {getCurrentTeamData} from "./cache.js"; function ensureExistingPage() { - if (!PAGELIST.includes(window.appdata.currentPage)) { - window.appdata.currentPage = PAGELIST[0]; + if (!PAGE_LIST.includes(window.appdata.currentPage)) { + window.appdata.currentPage = PAGE_LIST[0]; } } +function updatePageTitle() { + let teamName = getCurrentTeamData().team.name; + let pageName = PAGE_NAMES[window.appdata.currentPage]; + document.title = `${pageName} - ${teamName} | Teamized App`; +} + /** * Export changes from the cache to the URL * @@ -67,6 +74,8 @@ export function exportToURL(options) { window.history.pushState(...args); } } + + updatePageTitle(); } /** @@ -155,7 +164,7 @@ export function reRender() { * @param {String} page */ export function selectPage(page) { - if (PAGELIST.includes(page)) { + if (PAGE_LIST.includes(page)) { window.appdata.currentPage = page; exportToURL(); render(); @@ -174,4 +183,5 @@ export function handleHistoryNavigation() { ensureExistingPage(); Teams.ensureExistingTeam(); render(); + updatePageTitle(); }