All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Fixes all 542 ESLint problems in the web package to achieve 0 errors and 0 warnings. Changes: - Fixed 144 issues: nullish coalescing, return types, unused variables - Fixed 118 issues: unnecessary conditions, type safety, template literals - Fixed 79 issues: non-null assertions, unsafe assignments, empty functions - Fixed 67 issues: explicit return types, promise handling, enum comparisons - Fixed 45 final warnings: missing return types, optional chains - Fixed 25 typecheck-related issues: async/await, type assertions, formatting - Fixed JSX.Element namespace errors across 90+ files All Quality Rails violations resolved. Lint and typecheck both pass with 0 problems. Files modified: 118 components, tests, hooks, and utilities Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
"use client";
|
|
|
|
import { useTheme } from "@/providers/ThemeProvider";
|
|
|
|
interface ThemeToggleProps {
|
|
className?: string;
|
|
}
|
|
|
|
export function ThemeToggle({ className = "" }: ThemeToggleProps): React.JSX.Element {
|
|
const { resolvedTheme, toggleTheme } = useTheme();
|
|
|
|
return (
|
|
<button
|
|
onClick={toggleTheme}
|
|
className={`btn-ghost rounded-md p-2 ${className}`}
|
|
title={`Switch to ${resolvedTheme === "dark" ? "light" : "dark"} mode`}
|
|
aria-label={`Switch to ${resolvedTheme === "dark" ? "light" : "dark"} mode`}
|
|
>
|
|
{resolvedTheme === "dark" ? (
|
|
// Sun icon for dark mode (click to switch to light)
|
|
<svg
|
|
className="h-5 w-5"
|
|
style={{ color: "rgb(var(--semantic-warning))" }}
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
strokeWidth={1.5}
|
|
>
|
|
<circle cx="12" cy="12" r="4" />
|
|
<path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" />
|
|
</svg>
|
|
) : (
|
|
// Moon icon for light mode (click to switch to dark)
|
|
<svg
|
|
className="h-5 w-5"
|
|
style={{ color: "rgb(var(--text-secondary))" }}
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
strokeWidth={1.5}
|
|
>
|
|
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z" />
|
|
</svg>
|
|
)}
|
|
</button>
|
|
);
|
|
}
|