- );
-}
-
-
-export default Map
\ No newline at end of file
diff --git a/Website/src/pages/_app.tsx b/Website/src/pages/_app.tsx
new file mode 100644
index 00000000..649bd2fc
--- /dev/null
+++ b/Website/src/pages/_app.tsx
@@ -0,0 +1,14 @@
+import BaseLayout from '@/app/components/base_layout'
+import type { AppProps } from 'next/app'
+
+/**
+ * Together with _document.tsx the equivalent of magic things to get the base layout
+ * to apply for pages in the pages-directory.
+ */
+export default function MyApp({ Component, pageProps }: AppProps) {
+ return (
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/Website/src/pages/_document.tsx b/Website/src/pages/_document.tsx
new file mode 100644
index 00000000..9e02a4ef
--- /dev/null
+++ b/Website/src/pages/_document.tsx
@@ -0,0 +1,15 @@
+import {Html, Head, Main, NextScript} from 'next/document'
+import {inter} from "@/utils/common";
+
+export default function Document() {
+ return (
+
+
+
+
+
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/Website/src/pages/logout.tsx b/Website/src/pages/logout.tsx
index 4fd63249..c6b87bf8 100644
--- a/Website/src/pages/logout.tsx
+++ b/Website/src/pages/logout.tsx
@@ -1,10 +1,18 @@
-import Login from "@/components/login";
+import Login from "@/app/components/login";
+import "@/app/components/globals.css";
import {GetServerSideProps, InferGetServerSidePropsType} from "next";
import {deleteCookie, hasCookie} from "cookies-next";
-import RootLayout from "@/components/layout"
-import {ReactElement} from "react";
+import Head from "next/head";
+import {meta_info} from "@/utils/common";
+import {FormWrapper} from "@/app/components/form";
+/**
+ * Executed on the server side on page load. See: https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props
+ *
+ * Will check if the token-cookie exists in the request, and if it
+ * exists will add a header in the response to delete the token cookie.
+ */
export const getServerSideProps: GetServerSideProps<{
success: boolean
}> = async ({req, res,}) => {
@@ -12,13 +20,13 @@ export const getServerSideProps: GetServerSideProps<{
if (hasCookie('token', {
httpOnly: true,
- sameSite: true,
+ sameSite: 'lax',
req, res
})) {
deleteCookie('token', {
httpOnly: true,
- sameSite: true,
+ sameSite: 'lax',
req, res
})
success = true;
@@ -29,23 +37,21 @@ export const getServerSideProps: GetServerSideProps<{
export default function Page({success}: InferGetServerSidePropsType
) {
return (
-
-
- {success ? (You are logged out!
) : (You are not logged in
)}
-
-
-
- );
-}
+ <>
+
+ {/* Include the generic metadata for this page */}
+ {meta_info.title}
+
+
+
+ {success ? (Sie wurden ausgeloggt.
) : (Sie waren nicht eingeloggt.
)}
+ Möchten Sie sich wieder einloggen?
+ {/* Include a login-form directed at the main page to allow someone to login again. */}
+
+
-Page.getLayout = function getLayout(page: ReactElement) {
- return (
-
- {page}
-
+ >
);
}
diff --git a/Website/src/lib/api.website.ts b/Website/src/utils/api.website.ts
similarity index 100%
rename from Website/src/lib/api.website.ts
rename to Website/src/utils/api.website.ts
diff --git a/Website/src/utils/common.ts b/Website/src/utils/common.ts
new file mode 100644
index 00000000..9ba19840
--- /dev/null
+++ b/Website/src/utils/common.ts
@@ -0,0 +1,8 @@
+import {Inter} from "next/font/google";
+
+export const inter = Inter({ subsets: ['latin'] })
+
+export const meta_info = {
+ title: 'RailTrail Admin Interface',
+ description: 'An administrative interface for the RailTrail rail vehicle management system.',
+}
\ No newline at end of file
diff --git a/Website/src/lib/data.ts b/Website/src/utils/data.ts
similarity index 94%
rename from Website/src/lib/data.ts
rename to Website/src/utils/data.ts
index 0213a8e9..f8a54cc3 100644
--- a/Website/src/lib/data.ts
+++ b/Website/src/utils/data.ts
@@ -1,3 +1,7 @@
+/**
+ * A collection on functions that relate to fetching data from the backend.
+ */
+
import {
AuthenticationRequest,
AuthenticationResponse,
@@ -5,10 +9,10 @@ import {
TrackPath,
Vehicle
} from "./api.website";
-import {UnauthorizedError} from "@/lib/types";
+import {UnauthorizedError} from "@/utils/types";
import 'server-only'
-
+/** The base path from which the webserver process can reach the backend server. */
const BACKEND_BASE_PATH = process.env['BACKEND_URI']
export const getVehicleData = async (token: string, track_id: number) => {
diff --git a/Website/src/lib/helpers.ts b/Website/src/utils/helpers.ts
similarity index 100%
rename from Website/src/lib/helpers.ts
rename to Website/src/utils/helpers.ts
diff --git a/Website/src/lib/types.ts b/Website/src/utils/types.ts
similarity index 100%
rename from Website/src/lib/types.ts
rename to Website/src/utils/types.ts