// src/renderer/components/TitleBar.tsx
// v2 보더리스 UI: 커스텀 타이틀바 — 투명 드래그 스트립 + 우측 윈도우 컨트롤.
// 콘텐츠 위에 오버레이되며(레퍼런스처럼 컨트롤이 콘텐츠 위에 떠 있음),
// 드래그 영역은 -webkit-app-region: drag, 버튼은 no-drag.
import { useState, useEffect, useCallback } from 'react'
import { Box } from '@mui/material'
import { Minus, Square, Copy, X } from 'lucide-react'
import { d3roPalette } from '@d3ro/ui/theme'
const BAR_HEIGHT = 40
export function TitleBar(): React.ReactElement {
const [isMaximized, setIsMaximized] = useState(false)
useEffect(() => {
window.electronAPI.window.isMaximized().then((max) => setIsMaximized(max))
}, [])
const handleMaximize = useCallback(() => {
window.electronAPI.window.maximize()
// 토글 후 상태 재조회 (이벤트 채널이 없어 폴링 1회)
setTimeout(() => {
window.electronAPI.window.isMaximized().then((max) => setIsMaximized(max))
}, 120)
}, [])
return (
theme.zIndex.drawer + 2,
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'flex-start',
WebkitAppRegion: 'drag',
pointerEvents: 'auto',
}}
>
window.electronAPI.window.minimize()}>
{isMaximized ? : }
window.electronAPI.window.close()}>
)
}
function ControlButton({
children,
danger = false,
onClick,
}: {
children: React.ReactNode
danger?: boolean
onClick: () => void
}): React.ReactElement {
return (
{children}
)
}