Files
spacedrive/interface/app/$libraryId/Explorer/FilePath/DeleteDialog.tsx
Jamie Pine 01dbc2caf7 [ENG-864] Create directory (#1458)
* folder

* wrote function

* Abstracting duplicate on file name

* Spliting between ephemeral and indexed

* Now with more type safety

* Forgot to prep

* location + path based

* bruh

* link frontend + error toast

* strip main separator

* dumb

* bruh

* create directory

Co-authored-by: Brendan Allan <Brendonovich@users.noreply.github.com>

* make some reactivity happen

---------

Co-authored-by: Ericson Fogo Soares <ericson.ds999@gmail.com>
Co-authored-by: Brendan Allan <brendonovich@outlook.com>
Co-authored-by: Brendan Allan <Brendonovich@users.noreply.github.com>
2023-10-11 00:47:56 +00:00

43 lines
1.1 KiB
TypeScript

import { useLibraryMutation, useZodForm } from '@sd/client';
import { CheckBox, Dialog, Tooltip, useDialog, UseDialogProps } from '@sd/ui';
interface Props extends UseDialogProps {
locationId: number;
rescan?: () => void;
pathIds: number[];
}
export default (props: Props) => {
const deleteFile = useLibraryMutation('files.deleteFiles');
const form = useZodForm();
return (
<Dialog
form={form}
onSubmit={form.handleSubmit(async () => {
await deleteFile.mutateAsync({
location_id: props.locationId,
file_path_ids: props.pathIds
});
props.rescan?.();
})}
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>
);
};