Files
spacedrive/interface/app/$libraryId/Explorer/File/DeleteDialog.tsx
Brendan Allan 99a31de824 [ENG-380] Interface code structure improvement (#581)
* beginnings of app directory

* settings mostly good

* colocate way more components

* flatten components folder

* reexport QueryClientProvider from client

* move CodeBlock back to interface

* colocate Explorer, KeyManager + more

* goddamn captialisation

* get toasts out of components

* please eslint

* no more src directory

* $ instead of :

* added back RowHeader component

* fix settings modal padding

* more spacing, less margin

* fix sidebar locations button

* fix tags sidebar link

* clean up back button

* added margin to explorer context menu to prevent contact with edge of viewport

* don't export QueryClientProvider from @sd/client

* basic guidelines

* import interface correctly

* remove old demo data

* fix onboarding layout

* fix onboarding navigation

* fix key manager settings button

---------

Co-authored-by: Jamie Pine <ijamespine@me.com>
2023-02-27 21:29:48 -08:00

37 lines
860 B
TypeScript

import { useLibraryMutation } from '@sd/client';
import { Dialog, UseDialogProps, useDialog } from '@sd/ui';
import { useZodForm } from '@sd/ui/src/forms';
interface Propps extends UseDialogProps {
location_id: number;
path_id: number;
}
export default (props: Propps) => {
const dialog = useDialog(props);
const deleteFile = useLibraryMutation('files.deleteFiles');
const form = useZodForm();
const onSubmit = form.handleSubmit(() =>
deleteFile.mutateAsync({
location_id: props.location_id,
path_id: props.path_id
})
);
return (
<Dialog
form={form}
onSubmit={onSubmit}
dialog={dialog}
title="Delete a file"
description="Configure your deletion settings."
loading={deleteFile.isLoading}
ctaLabel="Delete"
>
<p>TODO: checkbox for "delete all matching files" (only if a file is selected)</p>
</Dialog>
);
};