Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/components/Loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export function Loading() {
return (
<div className="flex flex-col items-center justify-center min-h-screen bg-gray-50">
<div className="flex flex-col items-center p-8 bg-white rounded-lg shadow-md">
<div className="mb-4">
<svg className="w-16 h-16 text-primary animate-spin" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor">
<circle className="opacity-25" cx="12" cy="12" r="10" strokeWidth="4"/>
<path className="opacity-75" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" fill="currentColor"/>
</svg>
</div>
<h2 className="text-xl font-semibold text-gray-900">Loading</h2>
<p className="mt-2 text-gray-500">Preparing your Teampilot dashboard...</p>
</div>
</div>
);
}
3 changes: 2 additions & 1 deletion src/modules/auth/components/AuthenticatedRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {ReactNode, useContext} from "react";
import {Navigate, useLocation} from "react-router-dom";
import {UserContext} from "@/contexts/UserContext.tsx";
import {Loading} from "@/components/Loading.tsx";

type AuthenticatedRouteProps = {
children: ReactNode
Expand All @@ -12,7 +13,7 @@ export default function AuthenticatedRoute({children}: AuthenticatedRouteProps)
const {isAuthenticated, user} = useContext(UserContext)

if (!user) {
return (<div>Loading ...</div>);
return <Loading/>;
}

if (!isAuthenticated()) {
Expand Down