Files
spacedrive/interface/hooks/useKeyDeleteFile.tsx
Brendan Allan a1ed97b702 [ENG-816, ENG-821] Re-implement reveal in finder + ContextMenu overhaul (#1029)
* mostly there

* native opening working

* more

* cleanup

* reorganise

* remove unnecessary import

* uncomment some stuff

* spacing

* store quickview ref inside provider

* fix linting

* clippy

---------

Co-authored-by: Utku <74243531+utkubakir@users.noreply.github.com>
Co-authored-by: Jamie Pine <32987599+jamiepine@users.noreply.github.com>
2023-06-27 15:34:53 +00:00

17 lines
528 B
TypeScript

import { useKey } from 'rooks';
import { ExplorerItem } from '@sd/client';
import { dialogManager } from '@sd/ui';
import DeleteDialog from '~/app/$libraryId/Explorer/FilePath/DeleteDialog';
export 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} />
));
});
};