/** * FileActionBottomSheet — Long-Press Action-Sheet für Mobile. * * Slide-Up von unten, 48 px Touch-Targets, ESC + Backdrop schließen. */ import React, { useEffect } from 'react'; import { type FileAction, type FileActionContext, type FileActionTarget, resolveActionLabel, } from './types'; import { runAction } from './registry'; import styles from './FileActionBottomSheet.module.css'; interface Props { open: boolean; actions: FileAction[]; target: FileActionTarget; ctx: FileActionContext; onClose: () => void; title?: string; confirm?: (title: string, body: string) => boolean | Promise; } export const FileActionBottomSheet: React.FC = ({ open, actions, target, ctx, onClose, title, confirm, }) => { useEffect(() => { if (!open) return; const _onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; window.addEventListener('keydown', _onKey); return () => window.removeEventListener('keydown', _onKey); }, [open, onClose]); if (!open) return null; const _handleClick = async (action: FileAction) => { onClose(); await runAction(action, target, ctx, confirm); }; return ( <>
); };