import React, { useEffect } from 'react'; const WindowButtons: React.FC = () => { useEffect(() => { const handleMouseDown = async (e: MouseEvent) => { const { getCurrentWindow } = await import('@tauri-apps/api/window'); if (e.buttons === 1) { if (e.detail === 2) { getCurrentWindow().toggleMaximize(); } else { getCurrentWindow().startDragging(); } } }; const header = document.getElementById('titlebar'); header?.addEventListener('mousedown', handleMouseDown); return () => { header?.removeEventListener('mousedown', handleMouseDown); }; }, []); const handleMinimize = async () => { const { getCurrentWindow } = await import('@tauri-apps/api/window'); getCurrentWindow().minimize(); }; const handleMaximize = async () => { const { getCurrentWindow } = await import('@tauri-apps/api/window'); getCurrentWindow().toggleMaximize(); }; const handleClose = async () => { const { getCurrentWindow } = await import('@tauri-apps/api/window'); getCurrentWindow().close(); }; return (
); }; export default WindowButtons;