Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection removal preventions #1037

Merged
merged 17 commits into from
May 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,9 @@ const FilesTableView = () => {
})
}, [deleteFiles, selectedCids])

const handleRecoverFiles = useCallback(() => {
const handleRecoverFiles = useCallback((e: React.MouseEvent) => {
e.preventDefault()
e.stopPropagation()
if (!recoverFiles) return

setIsRecoveringFiles(true)
Expand Down Expand Up @@ -589,6 +591,18 @@ const FilesTableView = () => {
viewFolder && viewFolder(cid)
}, [viewFolder])

const handleOpenMoveFileDialog = useCallback((e: React.MouseEvent) => {
e.preventDefault()
e.stopPropagation()
setIsMoveFileModalOpen(true)
}, [])

const handleOpenDeleteDialog = useCallback((e: React.MouseEvent) => {
e.preventDefault()
e.stopPropagation()
setIsDeleteModalOpen(true)
}, [])

return (
<article
className={clsx(classes.root, {
Expand Down Expand Up @@ -731,7 +745,7 @@ const FilesTableView = () => {
<>
{validBulkOps.indexOf("move") >= 0 && (
<Button
onClick={() => setIsMoveFileModalOpen(true)}
onClick={handleOpenMoveFileDialog}
variant="outline"
>
<Trans>Move selected</Trans>
Expand All @@ -748,9 +762,7 @@ const FilesTableView = () => {
)}
{validBulkOps.indexOf("delete") >= 0 && (
<Button
onClick={() => {
setIsDeleteModalOpen(true)
}}
onClick={handleOpenDeleteDialog}
variant="outline"
>
<Trans>Delete selected</Trans>
Expand Down