fix: harden production flows and user messaging
This commit is contained in:
1 parent
52dce168dd
commit
86dfe8053d
43 files changed
+3520
-358
No files matched your search
@@ -8,20 +8,18 @@ import { expect, test } from "vitest";
|
||||
import { PortalShell } from "@/components/layout/portal-shell";
|
||||
import { BrandLogo } from "./logo";
|
||||
|
||||
test("uses the supplied logo's true intrinsic dimensions and renders both light and dark variants", () => {
|
||||
test("lets CSS constrain both supplied logo variants without oversized intrinsic attributes", () => {
|
||||
render(<BrandLogo />);
|
||||
const logos = screen.getAllByAltText("Leon Tonhäuser Sportfotografie");
|
||||
|
||||
expect(logos).toHaveLength(2);
|
||||
|
||||
// Light mode logo
|
||||
expect(logos[0].getAttribute("width")).toBe("1000");
|
||||
expect(logos[0].getAttribute("height")).toBe("1000");
|
||||
expect(logos[0].getAttribute("width")).toBeNull();
|
||||
expect(logos[0].getAttribute("height")).toBeNull();
|
||||
expect(logos[0].className).toContain("brand-logo-light");
|
||||
|
||||
// Dark mode logo
|
||||
expect(logos[1].getAttribute("width")).toBe("1000");
|
||||
expect(logos[1].getAttribute("height")).toBe("1000");
|
||||
expect(logos[1].getAttribute("width")).toBeNull();
|
||||
expect(logos[1].getAttribute("height")).toBeNull();
|
||||
expect(logos[1].className).toContain("brand-logo-dark");
|
||||
});
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ import { authClient } from "@/modules/auth/client";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
// Renders into the portal masthead. Better Auth's signOut clears the session
|
||||
// cookie server-side; we then hard-navigate to the login page so no stale
|
||||
// session remains in the client router cache.
|
||||
// cookie server-side; a hard replacement clears any stale router cache.
|
||||
export function LogoutButton() {
|
||||
const [pending, setPending] = useState(false);
|
||||
|
||||
@@ -16,7 +15,7 @@ export function LogoutButton() {
|
||||
try {
|
||||
await authClient.signOut();
|
||||
} finally {
|
||||
window.location.assign("/anmelden");
|
||||
window.location.replace("/anmelden");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,4 +30,4 @@ export function LogoutButton() {
|
||||
{pending ? "…" : "Abmelden"}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,22 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { Moon, Sun } from "lucide-react"
|
||||
import { useTheme } from "next-themes"
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
export function ThemeToggle() {
|
||||
const { theme, setTheme } = useTheme()
|
||||
const [mounted, setMounted] = React.useState(false)
|
||||
|
||||
// Avoid hydration mismatch
|
||||
React.useEffect(() => setMounted(true), [])
|
||||
if (!mounted) return <div className="w-9 h-9" /> // Placeholder to prevent layout shift
|
||||
const { resolvedTheme, setTheme } = useTheme()
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => setTheme(theme === "light" ? "dark" : "light")}
|
||||
onClick={() => setTheme(resolvedTheme === "dark" ? "light" : "dark")}
|
||||
title="Design umschalten"
|
||||
>
|
||||
{theme === "light" ? (
|
||||
<Sun className="h-[1.2rem] w-[1.2rem] transition-all" />
|
||||
) : (
|
||||
<Moon className="h-[1.2rem] w-[1.2rem] transition-all" />
|
||||
)}
|
||||
<Sun className="h-[1.2rem] w-[1.2rem] transition-all dark:hidden" />
|
||||
<Moon className="hidden h-[1.2rem] w-[1.2rem] transition-all dark:block" />
|
||||
<span className="sr-only">Design umschalten</span>
|
||||
</Button>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user