SessionIndicator.jsx 939 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use client";
  2. import React from "react";
  3. import { Loader2 } from "lucide-react";
  4. import { useAuth } from "@/components/auth/authContext";
  5. /**
  6. * SessionIndicator (RHL-032)
  7. *
  8. * Shows a small inline indicator when:
  9. * - the initial session check is running (status === "loading")
  10. * - a background revalidation is running (isValidating === true)
  11. *
  12. * UX:
  13. * - Keep it subtle and non-blocking.
  14. * - Text is German.
  15. */
  16. export default function SessionIndicator() {
  17. const { status, isValidating } = useAuth();
  18. const show = status === "loading" || Boolean(isValidating);
  19. if (!show) return null;
  20. return (
  21. <div
  22. className="flex items-center gap-2"
  23. aria-live="polite"
  24. title="Sitzung wird geprüft"
  25. >
  26. <Loader2
  27. className="h-4 w-4 animate-spin text-muted-foreground"
  28. aria-hidden="true"
  29. />
  30. <span className="hidden text-xs text-muted-foreground md:inline">
  31. Sitzung wird geprüft…
  32. </span>
  33. </div>
  34. );
  35. }