⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
"use client";
import { MoonIcon, SunIcon } from "lucide-react";
import { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
type Theme = "light" | "dark";
function applyTheme(theme: Theme) {
const root = document.documentElement;
root.classList.toggle("dark", theme === "dark");
root.style.colorScheme = theme;
}
export function ThemeToggle() {
const [theme, setTheme] = useState<Theme>("dark");
const [mounted, setMounted] = useState(false);
useEffect(() => {
const stored = localStorage.getItem("kaneo-site-theme");
const initial: Theme =
stored === "light" || stored === "dark"
? stored
: window.matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light";
setTheme(initial);
applyTheme(initial);
setMounted(true);
}, []);
const toggleTheme = () => {
const nextTheme: Theme = theme === "dark" ? "light" : "dark";
setTheme(nextTheme);
applyTheme(nextTheme);
localStorage.setItem("kaneo-site-theme", nextTheme);
};
return (
<Button
aria-label="Toggle theme"
className="size-8"
onClick={toggleTheme}
size="icon"
variant="ghost"
>
{mounted && theme === "dark" ? (
<SunIcon className="size-4" />
) : (
<MoonIcon className="size-4" />
)}
</Button>
);
}