mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 10:33:01 +00:00
improved loading screen with spinner
This commit is contained in:
@@ -6,6 +6,7 @@ import SmallUserDisplay from "@/components/small-user-display";
|
|||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||||
import { getAuthHeaders } from "@/lib/utils";
|
import { getAuthHeaders } from "@/lib/utils";
|
||||||
import LogOutButton from "./components/log-out-button";
|
import LogOutButton from "./components/log-out-button";
|
||||||
|
import Loading from "./components/loading";
|
||||||
|
|
||||||
function Index() {
|
function Index() {
|
||||||
const serverURL = import.meta.env.VITE_SERVER_URL?.trim() || "http://localhost:3000";
|
const serverURL = import.meta.env.VITE_SERVER_URL?.trim() || "http://localhost:3000";
|
||||||
|
|||||||
@@ -51,9 +51,5 @@ export function Auth({ children }: AuthProviderProps) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return <Loading message={"Understanding your authentication state"} />;
|
||||||
<Loading>
|
|
||||||
<span className="text-xs px-2 py-1 bg-input">Understanding your authentication state</span>
|
|
||||||
</Loading>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
export default function Loading({ children }: { children?: React.ReactNode }) {
|
import { Spinner } from "@/components/ui/spinner";
|
||||||
|
|
||||||
|
export default function Loading({ message, children }: { message?: string; children?: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col items-center justify-center gap-4 w-full h-[100vh]">
|
<div className="flex flex-col items-center justify-center gap-4 w-full h-[100vh]">
|
||||||
<h1>Loading...</h1>
|
<Spinner className="size-6" />
|
||||||
|
{message && (
|
||||||
|
<span className="text-xs px-2 py-1 border-2 border-input border-dashed">{message}</span>
|
||||||
|
)}
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
16
packages/frontend/src/components/ui/spinner.tsx
Normal file
16
packages/frontend/src/components/ui/spinner.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { Loader2Icon, Loader } from "lucide-react";
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
|
||||||
|
return (
|
||||||
|
<Loader
|
||||||
|
role="status"
|
||||||
|
aria-label="Loading"
|
||||||
|
className={cn("size-4 animate-spin", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Spinner };
|
||||||
Reference in New Issue
Block a user