Files
spacedrive/interface/app/$libraryId/Explorer/File/DeleteDialog.tsx
T
187ec933f4 [ENG-770 / ENG-773] Copy/paste / Explorer context menu duplicate (#992)
* Fixing copy, cut and paste

* Bug on duplicating files without extensions

* Fix paste only ignoring the location origin when validating relative paths
 - Add Error handling to all context menu actions
 - Hide FS actions in Overview and MediaView
 - Remove redundant useExplorerSearchParams
 - Add default schema to the Zod param hooks

* Hide FS actions in all Explorers but location ones
 - Fix react warnings in RenameTextBox
 - Fix ReactTextBox not selecting the whole file name, instead of just up to file extension
 - Fix react warning due to inputing missing onChange

* basic show jobs for cut, copy and delete in job manager

* tweaks

* Fixing some warnings and minor tweaks

* Rust fmt

* Fix cut between locations on Linux

* Change how routes retrieve route params
 - Replace useZodRouteParams with useLoader
 - Define all schemas in the router file instead of in the route Component
 - Parse schema in loader to avoid requiring the route Components having to import the schema from the router file

* Remove default argument from useZodRouteParams

---------

Co-authored-by: Vítor Vasconcellos <vasconcellos.dev@gmail.com>
Co-authored-by: Jamie Pine <32987599+jamiepine@users.noreply.github.com>
Co-authored-by: James Pine <ijamespine@me.com>
2023-06-22 23:41:29 +00:00

41 lines
1.0 KiB
TypeScript

import { useLibraryMutation } from '@sd/client';
import { CheckBox, Dialog, Tooltip, UseDialogProps, useDialog } from '@sd/ui';
import { useZodForm } from '@sd/ui/src/forms';
interface Props extends UseDialogProps {
location_id: number;
path_id: number;
}
export default (props: Props) => {
const deleteFile = useLibraryMutation('files.deleteFiles');
const form = useZodForm();
return (
<Dialog
form={form}
onSubmit={form.handleSubmit(() =>
deleteFile.mutateAsync({
location_id: props.location_id,
file_path_ids: [props.path_id]
})
)}
dialog={useDialog(props)}
title="Delete a file"
description="Warning: This will delete your file forever, we don't have a trash can yet..."
loading={deleteFile.isLoading}
ctaLabel="Delete"
ctaDanger
className="w-[200px]"
>
<Tooltip label="Coming soon">
<div className="flex items-center pt-2 opacity-50">
<CheckBox disabled className="!mt-0" />
<p className="text-sm text-ink-dull">Delete all matching files</p>
</div>
</Tooltip>
</Dialog>
);
};