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
3 changes: 2 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import AdminSignup from './Pages/Admin/AdminSignup';
import AdminDashboard from './Pages/Admin/AdminDashboard';
import ViewDebate from './Pages/ViewDebate';
import SupportOpenSource from './Pages/SupportOpenSource';
import LoadingSpinner from './components/LoadingSpinner';

// Protects routes based on authentication status
function ProtectedRoute() {
Expand All @@ -38,7 +39,7 @@ function ProtectedRoute() {
}
const { isAuthenticated, loading: isLoading } = authContext;
if (isLoading) {
return <div>Loading...</div>;
return <LoadingSpinner/>
}
return isAuthenticated ? <Outlet /> : <Navigate to='/' replace />;
}
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/Pages/Admin/AdminDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
ResponsiveContainer,
} from "recharts";
import { TrendingUp, Users, MessageSquare, Activity } from "lucide-react";
import LoadingSpinner from "@/components/LoadingSpinner";

type SnapshotLike = AnalyticsSnapshot &
Partial<Record<"DebatesToday" | "CommentsToday" | "NewUsersToday", number>>;
Expand Down Expand Up @@ -474,9 +475,13 @@ export default function AdminDashboard() {
setSelectedComments(newSelected);
};

if (loading) {
return <div className="p-8">Loading...</div>;
}
if (loading) {
return (
<div className="flex items-center justify-center min-h-screen">
<LoadingSpinner fullScreen />
</div>
);
}

if (error) {
return (
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/Pages/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import {
transcriptService,
SavedDebateTranscript,
} from "@/services/transcriptService";
import LoadingSpinner from "@/components/LoadingSpinner";

const handleProfileAvatarLoadError = (
event: React.SyntheticEvent<HTMLImageElement>
Expand Down Expand Up @@ -637,7 +638,7 @@ const debounceTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
</div>
<div className="max-h-32 overflow-y-auto space-y-1 p-2 bg-muted/50 rounded border">
{loadingFollowers ? (
<div className="text-center py-2 text-xs text-muted-foreground">Loading...</div>
<div className="text-center py-2 text-xs text-muted-foreground"><LoadingSpinner/></div>
) : followers.length === 0 ? (
<div className="text-center py-2 text-xs text-muted-foreground">No followers yet</div>
) : (
Expand All @@ -659,7 +660,7 @@ const debounceTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
</div>
<div className="max-h-32 overflow-y-auto space-y-1 p-2 bg-muted/50 rounded border">
{loadingFollowing ? (
<div className="text-center py-2 text-xs text-muted-foreground">Loading...</div>
<div className="text-center py-2 text-xs text-muted-foreground"><LoadingSpinner size="sm" /></div>
) : following.length === 0 ? (
<div className="text-center py-2 text-xs text-muted-foreground">Not following anyone yet</div>
) : (
Expand Down
Loading