mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-07-16 09:38:51 +02:00
162 lines
4.5 KiB
TypeScript
162 lines
4.5 KiB
TypeScript
//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
|
|
//Copyright (C) 2024 HTWKalender support@htwkalender.de
|
|
|
|
//This program is free software: you can redistribute it and/or modify
|
|
//it under the terms of the GNU Affero General Public License as published by
|
|
//the Free Software Foundation, either version 3 of the License, or
|
|
//(at your option) any later version.
|
|
|
|
//This program is distributed in the hope that it will be useful,
|
|
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
//GNU Affero General Public License for more details.
|
|
|
|
//You should have received a copy of the GNU Affero General Public License
|
|
//along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
import { createRouter, createWebHistory } from "vue-router";
|
|
|
|
const Faq = () => import("../components/FaqPage.vue");
|
|
const AdditionalModules = () => import("../view/AdditionalModules.vue");
|
|
const CalendarLink = () => import("../components/CalendarLink.vue");
|
|
const RenameModules = () => import("../components/RenameModules.vue");
|
|
const RoomFinder = () => import("../view/RoomFinder.vue");
|
|
const RoomFinderOffline = () => import("../view/RoomFinderOffline.vue");
|
|
const EditCalendarView = () => import("../view/EditCalendarView.vue");
|
|
const EditAdditionalModules = () =>
|
|
import("../view/editCalendar/EditAdditionalModules.vue");
|
|
const EditModules = () => import("../view/editCalendar/EditModules.vue");
|
|
const CourseSelection = () => import("../view/CourseSelection.vue");
|
|
const FreeRooms = () => import("../view/FreeRooms.vue");
|
|
const CalenderViewer = () => import("../view/UserCalendar.vue");
|
|
const SettingsView = () => import("../view/SettingsView.vue");
|
|
const NotFound = () => import("../view/NotFound.vue");
|
|
|
|
import i18n from "../i18n";
|
|
import settingsStore from "@/store/settingsStore.ts";
|
|
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
routes: [
|
|
{
|
|
path: "/",
|
|
name: "default",
|
|
component: CourseSelection,
|
|
},
|
|
{
|
|
path: "/home",
|
|
name: "home",
|
|
component: CourseSelection,
|
|
},
|
|
{
|
|
path: "/calendar/create",
|
|
name: "calendar-create",
|
|
component: CourseSelection,
|
|
},
|
|
{
|
|
path: "/rooms/occupancy",
|
|
name: "room-schedule",
|
|
component: RoomFinder,
|
|
},
|
|
{
|
|
path: "/rooms/occupancy/offline",
|
|
name: "room-schedule-offline",
|
|
component: RoomFinderOffline,
|
|
},
|
|
{
|
|
path: "/rooms/free",
|
|
name: "free-rooms",
|
|
component: FreeRooms,
|
|
},
|
|
{
|
|
path: "/calendar/view",
|
|
name: "calendar-view",
|
|
component: CalenderViewer,
|
|
},
|
|
{
|
|
path: "/faq",
|
|
name: "faq",
|
|
component: Faq,
|
|
},
|
|
{
|
|
path: "/additional-modules",
|
|
name: "additional-modules",
|
|
component: AdditionalModules,
|
|
},
|
|
{
|
|
path: "/edit-additional-modules",
|
|
name: "edit-additional-modules",
|
|
component: EditAdditionalModules,
|
|
},
|
|
{
|
|
path: "/edit-calendar",
|
|
name: "edit-calendar",
|
|
component: EditModules,
|
|
},
|
|
{
|
|
path: "/calendar-link",
|
|
name: "calendar-link",
|
|
component: CalendarLink,
|
|
},
|
|
{
|
|
path: "/calendar/edit",
|
|
name: "edit",
|
|
component: EditCalendarView,
|
|
},
|
|
{
|
|
path: "/privacy-policy",
|
|
name: "privacy-policy",
|
|
component: Faq,
|
|
beforeEnter() {
|
|
window.location.href =
|
|
"https://www.htwk-leipzig.de/hochschule/kontakt/datenschutzerklaerung/";
|
|
},
|
|
},
|
|
{
|
|
path: "/imprint",
|
|
name: "imprint",
|
|
component: Faq,
|
|
beforeEnter() {
|
|
window.location.href =
|
|
"https://www.htwk-leipzig.de/hochschule/kontakt/impressum/";
|
|
},
|
|
},
|
|
{
|
|
path: "/rename-modules",
|
|
name: "rename-modules",
|
|
component: RenameModules,
|
|
},
|
|
{
|
|
path: "/settings",
|
|
name: "settings",
|
|
component: SettingsView,
|
|
},
|
|
{
|
|
path: "/:catchAll(.*)", // Catch all undefined routes
|
|
name: "not-found",
|
|
component: NotFound, // Replace with your NotFound component
|
|
},
|
|
],
|
|
});
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
const newLocale = to.params.locale;
|
|
const prevLocale = from.params.locale;
|
|
// If the locale hasn't changed, do nothing
|
|
if (!(newLocale === prevLocale)) {
|
|
i18n.setLocale(newLocale);
|
|
}
|
|
|
|
const userSettings = settingsStore();
|
|
const defaultPath = userSettings.defaultPage || "/home";
|
|
|
|
if (to.path === "/") {
|
|
next(defaultPath.value);
|
|
} else {
|
|
next();
|
|
}
|
|
});
|
|
|
|
export default router;
|