feat(ux): cached roomId auto-join + theme toggle

- Receiver: auto-fill and join on Retrieve tab when input empty, not in room, no URL roomId, and cachedId exists (ClipboardApp + roomIdCache)
  - Sender: “Use cached ID” now immediately joins the room (add onUseCached + disabled to CachedIdActionButton; wire in SendTabPanel)
  - UI: add ThemeToggle and integrate into Header (desktop and mobile)
  - Styles: replace hardcoded white with design tokens in Retrieve panel (bg-card/text-card-foreground) for dark mode
  - Docs: update AI playbook flows and code-map
This commit is contained in:
david_bai
2025-11-25 12:24:28 +08:00
parent 10f236dc8d
commit 723a1ea086
8 changed files with 87 additions and 2 deletions
+3
View File
@@ -8,6 +8,7 @@ import Image from "next/image";
import { Menu, X, Github } from "lucide-react";
import LanguageSwitcher from "@/components/LanguageSwitcher";
import { Messages } from "@/types/messages";
import ThemeToggle from "@/components/web/ThemeToggle";
/**
* Props interface for the Header component
@@ -91,6 +92,7 @@ const Header = ({ messages, lang }: HeaderProps) => {
<Github className="h-5 w-5" />
</Link>
</Button>
<ThemeToggle />
<LanguageSwitcher />
</div>
</div>
@@ -98,6 +100,7 @@ const Header = ({ messages, lang }: HeaderProps) => {
{/* Mobile menu controls */}
<div className="md:hidden flex items-center space-x-2">
<LanguageSwitcher />
<ThemeToggle />
<Button asChild variant="ghost" size="icon">
<Link
href={githubUrl}
+30
View File
@@ -0,0 +1,30 @@
"use client";
import { Button } from "@/components/ui/button";
import { Moon, Sun } from "lucide-react";
import { useTheme } from "next-themes";
import { useEffect, useState } from "react";
export default function ThemeToggle() {
const { resolvedTheme, setTheme } = useTheme();
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
const isDark = resolvedTheme === "dark";
const toggle = () => setTheme(isDark ? "light" : "dark");
return (
<Button
variant="ghost"
size="icon"
aria-label="Toggle theme"
onClick={toggle}
disabled={!mounted}
>
{isDark ? <Sun className="h-5 w-5" /> : <Moon className="h-5 w-5" />}
<span className="sr-only">Toggle theme</span>
</Button>
);
}