Skip to content

Commit

Permalink
Add loading screen when user is loading
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashonecker committed Jul 5, 2024
1 parent cf7803b commit 809daa4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion frontend/src/components/utils/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Navigate, Outlet } from "react-router-dom";
import { User } from "../../types/User.ts";
import { AppBar, Skeleton, Toolbar } from "@mui/material";

type ProtectedRouteProps = {
user: User | undefined | null;
Expand All @@ -11,7 +12,15 @@ export default function ProtectedRoute({
isTargetLoginPage,
}: Readonly<ProtectedRouteProps>) {
if (user === undefined) {
return <div>Loading...</div>;
return (
<>
<AppBar elevation={0} position={"sticky"}>
<Toolbar>
<Skeleton variant={"rectangular"} width={"100%"} height={26} />
</Toolbar>
</AppBar>
</>
);
}

//When user is logged in, don't show login page
Expand Down

0 comments on commit 809daa4

Please sign in to comment.