mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-19 22:19:49 -04:00
19 lines
552 B
TypeScript
19 lines
552 B
TypeScript
import { useKey } from 'rooks';
|
|
import { ExplorerItem } from '@sd/client';
|
|
import { dialogManager } from '@sd/ui';
|
|
import DeleteDialog from '../app/$libraryId/Explorer/File/DeleteDialog';
|
|
|
|
const useKeyDeleteFile = (selectedItem: ExplorerItem | null, location_id: number | null) => {
|
|
return useKey('Delete', (e) => {
|
|
e.preventDefault();
|
|
|
|
if (!selectedItem || !location_id) return;
|
|
|
|
dialogManager.create((dp) => (
|
|
<DeleteDialog {...dp} location_id={location_id} path_id={selectedItem.item.id} />
|
|
));
|
|
});
|
|
};
|
|
|
|
export default useKeyDeleteFile;
|