import { getPlatform } from '@/actions/app'; import { closeWindow, maximizeWindow, minimizeWindow } from '@/actions/window'; import { logger } from '@/utils/logger'; import { type ReactNode, useEffect, useState } from 'react'; interface DragWindowRegionProps { title?: ReactNode; } export default function DragWindowRegion({ title }: DragWindowRegionProps) { const [platform, setPlatform] = useState(null); useEffect(() => { let active = true; getPlatform() .then((value: any) => { if (!active) { return; } setPlatform(value as string); }) .catch((error: any) => { logger.error('Failed to detect platform', error); }); return () => { active = false; }; }, []); const isMacOS = platform === 'darwin'; return (
{title && !isMacOS && (
{title}
)} {isMacOS && (
{/* Maintain the same height but do not display content */}
)}
{!isMacOS && }
); } function WindowButtons() { return (
); }