()
| 6 | const { Text } = Typography |
| 7 | |
| 8 | export function TitleBar(): React.JSX.Element { |
| 9 | const [isMac, setIsMac] = useState(false) |
| 10 | |
| 11 | useEffect(() => { |
| 12 | window.electronWindow?.getPlatform().then((platform: string) => { |
| 13 | setIsMac(platform === 'darwin') |
| 14 | }) |
| 15 | }, []) |
| 16 | |
| 17 | const handleMinimize = (): void => { |
| 18 | window.electron?.ipcRenderer.invoke('window-minimize') |
| 19 | } |
| 20 | const handleMaximize = (): void => { |
| 21 | window.electron?.ipcRenderer.invoke('window-maximize') |
| 22 | } |
| 23 | const handleClose = (): void => { |
| 24 | window.electron?.ipcRenderer.invoke('window-close') |
| 25 | } |
| 26 | |
| 27 | return ( |
| 28 | <Flex |
| 29 | className={`title-bar ${isMac ? 'title-bar-mac' : ''}`} |
| 30 | align="center" |
| 31 | justify="space-between" |
| 32 | > |
| 33 | <Flex className="title-bar-drag" align="center" flex={1}> |
| 34 | {!isMac && <Text className="title-bar-title">Pointer</Text>} |
| 35 | </Flex> |
| 36 | {!isMac && ( |
| 37 | <Flex className="title-bar-controls"> |
| 38 | <button className="title-bar-btn" onClick={handleMinimize}> |
| 39 | <MinusOutlined /> |
| 40 | </button> |
| 41 | <button className="title-bar-btn" onClick={handleMaximize}> |
| 42 | <BorderOutlined /> |
| 43 | </button> |
| 44 | <button className="title-bar-btn title-bar-btn-close" onClick={handleClose}> |
| 45 | <CloseOutlined /> |
| 46 | </button> |
| 47 | </Flex> |
| 48 | )} |
| 49 | </Flex> |
| 50 | ) |
| 51 | } |
nothing calls this directly
no outgoing calls
no test coverage detected