diff --git a/frontend/src/components/DeleteDocumentAction.jsx b/frontend/src/components/DeleteDocumentAction.jsx new file mode 100644 index 0000000..212dbe5 --- /dev/null +++ b/frontend/src/components/DeleteDocumentAction.jsx @@ -0,0 +1,40 @@ +import { useState } from 'react'; +import { useNavigate } from 'react-router-dom'; +import { Modal, Button } from 'react-bootstrap'; +import DiscreeteDropdown from './DiscreeteDropdown'; + +function DeleteDocumentAction({metadata, backend, setLastUpdate}) { + const focus = useNavigate('#'); + const [show, setShow] = useState(false); + + const handleClick = () => { + backend.deleteDocument(metadata) + .then(x => setLastUpdate(x._rev)) + .then(focus); + }; + + return ( + <> + setShow(true)}> + Delete... + + setShow(false)}> + + Are you sure you want to delete this document (with all of its contents and metadata). + This action cannot be undone. + + + + + + + + ); +} + +export default DeleteDocumentAction; + diff --git a/frontend/src/components/OpenedDocuments.jsx b/frontend/src/components/OpenedDocuments.jsx index 2b958a4..64ab042 100644 --- a/frontend/src/components/OpenedDocuments.jsx +++ b/frontend/src/components/OpenedDocuments.jsx @@ -8,6 +8,7 @@ import License from './License'; import DiscreeteDropdown from './DiscreeteDropdown'; import InviteEditorsAction from './InviteEditorsAction'; import BreakIntoPassagesAction from './BreakIntoPassagesAction'; +import DeleteDocumentAction from './DeleteDocumentAction'; import Bookmark from './Bookmark'; import LicenseCompatibility from './LicenseCompatibility'; @@ -68,6 +69,7 @@ function RunningHeadMargin({metadata, lectern, margin, sourceHasRubrics, marginH +