import { useState, CSSProperties, useEffect } from "react"; import type { AeBridge } from "../types/preload"; interface TitleBarProps { title?: string; } export default function TitleBar({ title = "AeThex Terminal" }: TitleBarProps) { const [pinned, setPinned] = useState(false); useEffect(() => { const bridge = window.aeBridge; if (bridge?.isPinned) { bridge.isPinned().then(setPinned).catch(() => {}); } }, []); const call = async (method: keyof AeBridge) => { const api = window.aeBridge; if (!api || typeof api[method] !== "function") return; const fn = api[method] as () => Promise; const res = await fn(); if (method === "togglePin") setPinned(res); }; return (
{title}
); } function btnStyle(bg: string): CSSProperties { return { border: "1px solid #111827", background: bg, color: "#e5e7eb", borderRadius: 6, padding: "4px 8px", cursor: "pointer", fontSize: 12, minWidth: 36, display: "flex", alignItems: "center", justifyContent: "center", }; }