Skip to content

Commit

Permalink
Improve description of deleted_time for not-deleted notes
Browse files Browse the repository at this point in the history
  • Loading branch information
personalizedrefrigerator committed May 6, 2024
1 parent 0329095 commit c047640
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dialog/components/makeItemPropertyDescription.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ModelType } from 'api/types';
import localization from '../../localization';

/** Shows and describes the value of a property of some Joplin item. */
const makeItemPropertyDescription = (key: string, value: string | number) => {
Expand All @@ -24,6 +25,10 @@ const makeItemPropertyDescription = (key: string, value: string | number) => {
key === 'deleted_time'
) {
description = new Date(value).toLocaleString();

if (key === 'deleted_time' && value === 0) {
description = localization.notDeleted;
}
} else if (key === 'size' && typeof value === 'number') {
if (value > 1024 * 1024) {
description = `${value / 1024 / 1024} MiB`;
Expand Down
2 changes: 2 additions & 0 deletions src/localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ interface AppLocalization {
go: string;
toggleNoteInfo: string;
noteInfoHeader: string;
notDeleted: string;
continueDangerousAction: (actionName: string, itemTitle: string) => string;
}

Expand All @@ -13,6 +14,7 @@ const defaultStrings: AppLocalization = {
go: 'Go',
toggleNoteInfo: 'Show/hide note info',
noteInfoHeader: 'Note info plugin',
notDeleted: 'Not deleted',
continueDangerousAction: (actionName, itemTitle) =>
`${actionName} ${itemTitle}.\nContiue? This may lead to data loss.`,
};
Expand Down

0 comments on commit c047640

Please sign in to comment.