feat(web): add session loading.tsx with spinner for route transitions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ashish Huddar 2026-04-05 20:39:35 +05:30 committed by Gaurav Bhola
parent 6bfc239af0
commit fa73a9fb7f
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,17 @@
import { render, screen } from "@testing-library/react";
import { describe, it, expect } from "vitest";
import SessionLoading from "./loading";
describe("SessionLoading", () => {
it("renders the session loading text", () => {
render(<SessionLoading />);
expect(screen.getByText("Loading session…")).toBeInTheDocument();
});
it("renders a spinning indicator", () => {
const { container } = render(<SessionLoading />);
const spinner = container.querySelector(".animate-spin");
expect(spinner).toBeInTheDocument();
expect(spinner?.tagName.toLowerCase()).toBe("svg");
});
});

View File

@ -0,0 +1,20 @@
export default function SessionLoading() {
return (
<div className="flex min-h-screen items-center justify-center bg-[var(--color-bg-base)]">
<div className="flex flex-col items-center gap-3">
<svg
className="h-5 w-5 animate-spin text-[var(--color-text-tertiary)]"
fill="none"
stroke="currentColor"
strokeWidth="2"
viewBox="0 0 24 24"
>
<path d="M12 3a9 9 0 1 0 9 9" />
</svg>
<p className="text-[13px] text-[var(--color-text-tertiary)]">
Loading session
</p>
</div>
</div>
);
}