Three root causes resolved: 1. .woodpecker/web.yml: build-shared step was missing @mosaic/ui build, causing 10 test suite failures + 20 typecheck errors (TS2307) 2. apps/orchestrator/Dockerfile: find -o without parentheses only deleted last pattern's matches, leaving spec files with test fixture secrets that triggered 5 Trivy false positives (3 CRITICAL, 2 HIGH) 3. 9 web files had untyped event handler parameters (e) causing 49 lint errors and 19 typecheck errors — added React.ChangeEvent<T> types Verification: lint 0 errors, typecheck 0 errors, tests 73/73 suites pass Co-Authored-By: Claude Opus 4.6 <[email protected]>
35 lines
783 B
TypeScript
35 lines
783 B
TypeScript
"use client";
|
|
|
|
import { useRouter } from "next/navigation";
|
|
import { Button, type ButtonProps } from "@mosaic/ui";
|
|
import { useAuth } from "@/lib/auth/auth-context";
|
|
|
|
interface LogoutButtonProps {
|
|
variant?: ButtonProps["variant"];
|
|
className?: string;
|
|
}
|
|
|
|
export function LogoutButton({
|
|
variant = "secondary",
|
|
className,
|
|
}: LogoutButtonProps): React.JSX.Element {
|
|
const router = useRouter();
|
|
const { signOut } = useAuth();
|
|
|
|
const handleSignOut = async (): Promise<void> => {
|
|
try {
|
|
await signOut();
|
|
} catch (error) {
|
|
console.error("Sign out error:", error);
|
|
} finally {
|
|
router.push("/login");
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Button variant={variant} onClick={() => void handleSignOut()} className={className}>
|
|
Sign Out
|
|
</Button>
|
|
);
|
|
}
|