mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
add trash
This commit is contained in:
@@ -344,6 +344,8 @@ export const ActionSheetComponent = ({
|
||||
} else {
|
||||
noteColors.push(color);
|
||||
}
|
||||
|
||||
//db.notes.note(note.id).
|
||||
// TODO
|
||||
/* db.addNote({
|
||||
dateCreated: note.dateCreated,
|
||||
|
||||
@@ -112,7 +112,6 @@ export class AddNotebookDialog extends React.Component {
|
||||
|
||||
let id = toEdit && toEdit.id ? toEdit.id : null;
|
||||
|
||||
// TODO
|
||||
await db.notebooks.add({
|
||||
title: this.title,
|
||||
description: this.description,
|
||||
|
||||
@@ -60,9 +60,7 @@ export class Dialog extends Component {
|
||||
break;
|
||||
}
|
||||
case dialogActions.ACTION_EMPTY_TRASH: {
|
||||
// TODO
|
||||
//await db.clearTrash();
|
||||
|
||||
await db.trash.clear();
|
||||
updateEvent({type: ACTIONS.TRASH});
|
||||
ToastEvent.show('Trash cleared', 'error', 1000, () => {}, '');
|
||||
this.setState({
|
||||
@@ -79,8 +77,7 @@ export class Dialog extends Component {
|
||||
});
|
||||
}
|
||||
case dialogActions.ACTION_TRASH: {
|
||||
// TODO
|
||||
//db.restoreItem(item.dateCreated);
|
||||
db.trash.restore(item.id);
|
||||
ToastEvent.show(
|
||||
item.type.slice(0, 1).toUpperCase() +
|
||||
item.type.slice(1) +
|
||||
@@ -98,6 +95,7 @@ export class Dialog extends Component {
|
||||
let {template, item} = this.props;
|
||||
if (dialogActions.ACTION_TRASH === template.action) {
|
||||
// delete item forever.
|
||||
db.trash.delete(item.id);
|
||||
}
|
||||
this.setState({
|
||||
visible: false,
|
||||
|
||||
@@ -26,8 +26,8 @@ export const reducer = (state, action) => {
|
||||
};
|
||||
}
|
||||
case ACTIONS.TRASH: {
|
||||
let trash = [];
|
||||
// TODO
|
||||
let trash = db.trash.all;
|
||||
|
||||
return {
|
||||
...state,
|
||||
trash: trash,
|
||||
|
||||
@@ -194,7 +194,6 @@ const Editor = ({navigation, noMenu}) => {
|
||||
if (id) {
|
||||
let lockednote = db.notes.note(id);
|
||||
if (lockNote && lockednote.locked) {
|
||||
// TODO
|
||||
await db.notes.note(id).lock('password');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user