/**
* TitleBar Component
* macOS: empty drag region (native traffic lights handled by hiddenInset).
* Windows/Linux: icon + "ClawX" on left, minimize/maximize/close on right.
*/
import { useState, useEffect } from 'react';
import { Minus, Square, X, Copy } from 'lucide-react';
import logoSvg from '@/assets/logo.svg';
import { invokeIpc } from '@/lib/api-client';
const isMac = window.electron?.platform === 'darwin';
export function TitleBar() {
if (isMac) {
// macOS: just a drag region, traffic lights are native
return
;
}
return ;
}
function WindowsTitleBar() {
const [maximized, setMaximized] = useState(false);
useEffect(() => {
// Check initial state
invokeIpc('window:isMaximized').then((val) => {
setMaximized(val as boolean);
});
}, []);
const handleMinimize = () => {
invokeIpc('window:minimize');
};
const handleMaximize = () => {
invokeIpc('window:maximize').then(() => {
invokeIpc('window:isMaximized').then((val) => {
setMaximized(val as boolean);
});
});
};
const handleClose = () => {
invokeIpc('window:close');
};
return (
{/* Left: Icon + App Name */}
ClawX
{/* Right: Window Controls */}
);
}