mirror of
https://github.com/outline/outline.git
synced 2026-11-22 14:01:41 +03:00
code cleanup
This commit is contained in:
1 parent
b405e1e985
commit
b9e34e4227
4 files changed
+16
-15
No files matched your search
@@ -11,7 +11,6 @@ import useStores from "~/hooks/useStores";
|
||||
import DocumentMove from "~/scenes/DocumentMove";
|
||||
import DocumentDelete from "~/scenes/DocumentDelete";
|
||||
import DocumentArchive from "~/scenes/DocumentArchive";
|
||||
import { toast } from "sonner";
|
||||
|
||||
function BulkSelectionToolbar() {
|
||||
const { t } = useTranslation();
|
||||
@@ -30,14 +29,15 @@ function BulkSelectionToolbar() {
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!canArchiveAll && !canDeleteAll && !canMoveAll) {
|
||||
if (
|
||||
!canArchiveAll &&
|
||||
!canDeleteAll &&
|
||||
!canMoveAll &&
|
||||
documents.isSelectionMode
|
||||
) {
|
||||
documents.clearSelection();
|
||||
toast.info(
|
||||
t("Selection cleared due to changes in permissions or document state.")
|
||||
);
|
||||
s;
|
||||
}
|
||||
}, [canArchiveAll, canDeleteAll, canMoveAll]);
|
||||
}, [canArchiveAll, canDeleteAll, canMoveAll, documents.isSelectionMode]);
|
||||
|
||||
const handleClear = React.useCallback(
|
||||
(ev: React.MouseEvent) => {
|
||||
|
||||
@@ -77,7 +77,7 @@ function DocumentArchive({ documents, onSubmit }: Props) {
|
||||
{isBulkAction ? (
|
||||
<Trans
|
||||
count={documents.length}
|
||||
defaults="Are you sure you want to archive <em>{{ count }} documents</em>? They will be removed from collections and search results."
|
||||
defaults="Are you sure you want to archive these <em>{{ count }} documents</em>? They will be removed from collections and search results."
|
||||
values={{ count: documents.length }}
|
||||
components={{ em: <strong /> }}
|
||||
/>
|
||||
|
||||
@@ -80,6 +80,9 @@ function DocumentDelete({ documents, onSubmit }: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
onSubmit?.();
|
||||
dialogs.closeAllModals();
|
||||
|
||||
// Show toast messages
|
||||
if (isBulkAction) {
|
||||
const message = failedIds.length
|
||||
@@ -115,9 +118,7 @@ function DocumentDelete({ documents, onSubmit }: Props) {
|
||||
} catch (err) {
|
||||
toast.error(err.message);
|
||||
} finally {
|
||||
onSubmit?.();
|
||||
setDeleting(false);
|
||||
dialogs.closeAllModals();
|
||||
}
|
||||
},
|
||||
[
|
||||
@@ -157,6 +158,9 @@ function DocumentDelete({ documents, onSubmit }: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
onSubmit?.();
|
||||
dialogs.closeAllModals();
|
||||
|
||||
// Show toast messages
|
||||
if (isBulkAction) {
|
||||
const successCount = results.filter(
|
||||
@@ -176,9 +180,7 @@ function DocumentDelete({ documents, onSubmit }: Props) {
|
||||
} catch (err) {
|
||||
toast.error(err.message);
|
||||
} finally {
|
||||
onSubmit?.();
|
||||
setArchiving(false);
|
||||
dialogs.closeAllModals();
|
||||
}
|
||||
},
|
||||
[documents, dialogs, isBulkAction, t, onSubmit]
|
||||
|
||||
@@ -181,7 +181,6 @@
|
||||
"currently viewing": "currently viewing",
|
||||
"previously edited": "previously edited",
|
||||
"You": "You",
|
||||
"Selection cleared due to changes in permissions or document state.": "Selection cleared due to changes in permissions or document state.",
|
||||
"Archive {{ count }} documents": "Archive {{ count }} documents",
|
||||
"Archive {{ count }} documents_plural": "Archive {{ count }} documents",
|
||||
"Delete {{ count }} documents": "Delete {{ count }} documents",
|
||||
@@ -790,8 +789,8 @@
|
||||
"{{ count }} documents archived": "{{ count }} documents archived",
|
||||
"{{ count }} documents archived_plural": "{{ count }} documents archived",
|
||||
"{{ errorCount }} documents failed to archive, try again?": "{{ errorCount }} documents failed to archive, try again?",
|
||||
"Are you sure you want to archive <em>{{ count }} documents</em>? They will be removed from collections and search results.": "Are you sure you want to archive <em>{{ count }} documents</em>? They will be removed from collections and search results.",
|
||||
"Are you sure you want to archive <em>{{ count }} documents</em>? They will be removed from collections and search results._plural": "Are you sure you want to archive <em>{{ count }} documents</em>? They will be removed from collections and search results.",
|
||||
"Are you sure you want to archive these <em>{{ count }} documents</em>? They will be removed from collections and search results.": "Are you sure you want to archive these <em>{{ count }} documents</em>? They will be removed from collections and search results.",
|
||||
"Are you sure you want to archive these <em>{{ count }} documents</em>? They will be removed from collections and search results._plural": "Are you sure you want to archive these <em>{{ count }} documents</em>? They will be removed from collections and search results.",
|
||||
"Archiving this document will remove it from the collection and search results.": "Archiving this document will remove it from the collection and search results.",
|
||||
"Couldn’t delete the {{noun}}, try again?": "Couldn’t delete the {{noun}}, try again?",
|
||||
"{{ errorCount }} documents failed to delete, try again?": "{{ errorCount }} documents failed to delete, try again?",
|
||||
|
||||
Reference in new issue
Block a user