Skip to content

Commit 3b9f842

Browse files
authored
Merge pull request #42 from MathisBurger/feature/runner-cmd
[FIX] Fixed impress page hidden
2 parents 922220a + c45168e commit 3b9f842

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

web/app/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import "@mantine/dropzone/styles.css";
1818
import { DatesProvider } from "@mantine/dates";
1919
import SpotlightWrapper from "@/components/spotlight/SpotlightWrapper";
2020
import Footer from "@/components/Footer";
21+
import { publicRoutes } from "@/static/routes";
2122

2223
export default function RootLayout({
2324
children,
@@ -27,7 +28,7 @@ export default function RootLayout({
2728
const [user, setUser] = useState<User | null>(null);
2829
const pathname = usePathname();
2930
const showNavbar = useMemo(
30-
() => pathname !== "/login" && pathname !== "/register" && pathname !== "/",
31+
() => publicRoutes.indexOf(pathname) === -1,
3132
[pathname],
3233
);
3334

web/components/Header.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { usePathname, useRouter } from "next/navigation";
66
import useApiServiceClient from "@/hooks/useApiServiceClient";
77
import { User } from "@/service/types/usernator";
88
import { useEffect } from "react";
9+
import {publicRoutes} from "@/static/routes";
910

1011
const Header = () => {
1112
const api = useApiServiceClient();
@@ -22,9 +23,7 @@ const Header = () => {
2223
.catch(() => {
2324
setUser(null);
2425
if (
25-
pathname !== "/login" &&
26-
pathname !== "/register" &&
27-
pathname !== "/"
26+
publicRoutes.indexOf(pathname) === -1
2827
) {
2928
router.push("/login");
3029
}

web/static/routes.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ export const routes: Route[] = [
5151
authRoles: [UserRoles.Student],
5252
},
5353
];
54+
55+
export const publicRoutes = ["/login", "/register", "/", "/impress", "/privacy"];

0 commit comments

Comments
 (0)