fix: add delete permanently option, restore icon and show alerts for locked notes
This commit is contained in:
@@ -7,6 +7,8 @@ import ArchiveIcon from '../../icons/ic-archive.svg';
|
||||
import UnarchiveIcon from '../../icons/ic-unarchive.svg';
|
||||
import HashtagIcon from '../../icons/ic-hashtag.svg';
|
||||
import ChevronRightIcon from '../../icons/ic-chevron-right.svg';
|
||||
import RestoreIcon from '../../icons/ic-restore.svg';
|
||||
import CloseIcon from '../../icons/ic-close.svg';
|
||||
import { toDirective } from './utils';
|
||||
|
||||
export enum IconType {
|
||||
@@ -19,6 +21,8 @@ export enum IconType {
|
||||
Unarchive = 'unarchive',
|
||||
Hashtag = 'hashtag',
|
||||
ChevronRight = 'chevron-right',
|
||||
Restore = 'restore',
|
||||
Close = 'close',
|
||||
}
|
||||
|
||||
const ICONS = {
|
||||
@@ -31,6 +35,8 @@ const ICONS = {
|
||||
[IconType.Unarchive]: UnarchiveIcon,
|
||||
[IconType.Hashtag]: HashtagIcon,
|
||||
[IconType.ChevronRight]: ChevronRightIcon,
|
||||
[IconType.Restore]: RestoreIcon,
|
||||
[IconType.Close]: CloseIcon,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
|
||||
@@ -44,8 +44,8 @@ export const NotesOptions = observer(
|
||||
useEffect(() => {
|
||||
const openTrashAlert = async () => {
|
||||
if (shouldTrashNotes && blurLocked) {
|
||||
await appState.notes.setTrashSelectedNotes(!trashed, trashButtonRef);
|
||||
setShouldTrashNotes(false);
|
||||
await appState.notes.setTrashSelectedNotes(!trashed, trashButtonRef);
|
||||
setLockCloseOnBlur(false);
|
||||
}
|
||||
};
|
||||
@@ -190,9 +190,23 @@ export const NotesOptions = observer(
|
||||
setLockCloseOnBlur(true);
|
||||
}}
|
||||
>
|
||||
<Icon type={IconType.Trash} className={iconClass} />
|
||||
<Icon type={trashed ? IconType.Restore : IconType.Trash} className={iconClass} />
|
||||
{trashed ? 'Restore' : 'Move to Trash'}
|
||||
</button>
|
||||
{appState.selectedTag?.isTrashTag && (
|
||||
<button
|
||||
onBlur={closeOnBlur}
|
||||
className={`${buttonClass} py-1.5`}
|
||||
onClick={async () => {
|
||||
setLockCloseOnBlur(true);
|
||||
await appState.notes.deleteNotesPermanently();
|
||||
setLockCloseOnBlur(false);
|
||||
}}
|
||||
>
|
||||
<Icon type={IconType.Close} className="fill-current color-danger mr-2" />
|
||||
<span className="color-danger">Delete Permanently</span>
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user