Skip to content

Commit

Permalink
refactor: improve dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
leopuleo committed Apr 22, 2024
1 parent 295c777 commit 3dd7ab7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const ActionDelete = observer(() => {
const openDeleteEntriesDialog = () =>
showConfirmationDialog({
title: "Trash entries",
message: `You are about to trash ${entriesLabel}. Are you sure you want to continue?`,
message: `You are about to move ${entriesLabel} to trash. Are you sure you want to continue?`,
loadingLabel: `Processing ${entriesLabel}`,
execute: async () => {
await worker.processInSeries(async ({ item, report }) => {
Expand All @@ -44,15 +44,15 @@ export const ActionDelete = observer(() => {

if (error) {
throw new Error(
error.message || "Unknown error while trashing the entry."
error.message || "Unknown error while moving the entry to trash."
);
}

removeRecordFromCache(item.id);

report.success({
title: `${item.meta.title}`,
message: "Entry successfully trashed."
message: "Entry successfully moved to trash."
});
} catch (e) {
report.error({
Expand All @@ -67,7 +67,7 @@ export const ActionDelete = observer(() => {
showResultsDialog({
results: worker.results,
title: "Trash entries",
message: "Finished trashing entries! See full report below:"
message: "Finished moving entries to trash! See full report below:"
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const useDeleteEntry = (): UseDeleteEntryDialogResponse => {
title: "Trash entry",
message: (
<p>
Are you sure you want to trash <strong>{title}</strong>?
Are you sure you want to move <strong>{title}</strong> to trash?
<br />
This action will include all of its revisions?
</p>
Expand All @@ -46,11 +46,11 @@ export const useDeleteEntry = (): UseDeleteEntryDialogResponse => {
});

if (error) {
showDialog(error.message, { title: `Could not trash ${title}!` });
showDialog(error.message, { title: `Could not move ${title} to trash!` });
return;
}

showSnackbar(`${title} has been trashed successfully!`);
showSnackbar(`${title} has been moved to trash successfully!`);
removeRecordFromCache(entry.id);
navigateToLatestFolder();

Expand Down
6 changes: 3 additions & 3 deletions packages/app-headless-cms/src/admin/hooks/useDeleteEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const useDeleteEntry = ({ entry, onAccept, onCancel }: UseDeleteEntryPara
title: "Trash entry",
message: (
<p>
Are you sure you want to trash <strong>{title}</strong>?
Are you sure you want to move <strong>{title}</strong> to trash?
<br />
This action will include all of its revisions?
</p>
Expand All @@ -44,11 +44,11 @@ export const useDeleteEntry = ({ entry, onAccept, onCancel }: UseDeleteEntryPara
});

if (error) {
showDialog(error.message, { title: `Could not trash ${title}!` });
showDialog(error.message, { title: `Could not move ${title} to trash!` });
return;
}

showSnackbar(`${title} has been trashed successfully!`);
showSnackbar(`${title} has been moved to trash successfully!`);
removeRecordFromCache(entry.id);
navigateToLatestFolder();

Expand Down

0 comments on commit 3dd7ab7

Please sign in to comment.