Add selection and report bottom dock

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-11-13 22:47:59 +08:00
parent 1c7d85b3a2
commit 26c0963363
5 changed files with 50 additions and 3 deletions

View File

@@ -0,0 +1,30 @@
import React, { useState } from "react";
export function BottomDock({ selection, report, onClose }: {
selection: string[];
report: string[];
onClose: () => void;
}) {
const [tab, setTab] = useState<"selection" | "report">("selection");
return <section className="bottom-dock" aria-label="Bottom dock">
<style>{`
.bottom-dock{position:fixed;left:300px;right:300px;bottom:26px;height:180px;background:#17212b;border:1px solid #3f3f3f;border-radius:6px 6px 0 0;z-index:55;display:flex;flex-direction:column;color:#dbe6ee;font:12px/1.5 system-ui,"Noto Sans SC",sans-serif;box-shadow:0 -6px 20px #0006}
.bottom-dock header{display:flex;align-items:center;gap:4px;padding:3px 6px;background:#1b242c;border-bottom:1px solid #3f3f3f}
.bottom-dock header button{background:transparent;border:0;color:#93a6b3;padding:2px 8px;border-radius:3px;cursor:pointer;font-size:12px}
.bottom-dock header button[aria-selected=true]{background:#29444b;color:#73c6d4}
.bottom-dock header .close{margin-left:auto}
.bottom-dock .body{flex:1;overflow:auto;padding:5px 10px;font-family:ui-monospace,monospace;font-size:11.5px;color:#b9c7d0}
.bottom-dock .body p{margin:2px 0}
`}</style>
<header>
<button type="button" aria-selected={tab === "selection"} onClick={() => setTab("selection")}>Selection view</button>
<button type="button" aria-selected={tab === "report"} onClick={() => setTab("report")}>Report view</button>
<button type="button" className="close" aria-label="Close bottom dock" onClick={onClose}>×</button>
</header>
<div className="body" role="tabpanel" aria-label={tab === "selection" ? "Selection view" : "Report view"}>
{tab === "selection"
? (selection.length ? selection.map(item => <p key={item}>{item}</p>) : <p>No selection</p>)
: (report.length ? report.map((item, index) => <p key={`${index}-${item.slice(0, 12)}`}>{item}</p>) : <p>No messages</p>)}
</div>
</section>;
}

View File

@@ -1,6 +1,6 @@
import React, { useState } from "react";
export function UtilityMenus({ onPreferences, onShortcuts }: { onPreferences: () => void; onShortcuts: () => void }) {
export function UtilityMenus({ onPreferences, onShortcuts, onToggleDock }: { onPreferences: () => void; onShortcuts: () => void; onToggleDock: () => void }) {
const [open, setOpen] = useState("");
return <div className="utility-menus">
<style>{`
@@ -21,6 +21,13 @@ export function UtilityMenus({ onPreferences, onShortcuts }: { onPreferences: ()
<span>Customize / Units calculator: P3</span>
</div>}
</button>
<button type="button" aria-expanded={open === "Windows"}
onClick={() => setOpen(previous => previous === "Windows" ? "" : "Windows")}>Windows
{open === "Windows" && <div className="dropdown" role="menu" aria-label="Windows">
<button type="button" onClick={() => { setOpen(""); onToggleDock(); }}>Selection / Report views</button>
<span>Tile / floating docks: P3</span>
</div>}
</button>
<button type="button" aria-expanded={open === "Help"}
onClick={() => setOpen(previous => previous === "Help" ? "" : "Help")}>Help
{open === "Help" && <div className="dropdown" role="menu" aria-label="Help">