Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: move note dialog (#42)

Muhammad Ali49b46bac6705
diff --git a/apps/web/src/components/dialogs/move-note-dialog.js b/apps/web/src/components/dialogs/move-note-dialog.js
index f8d654c09..13739bd0f 100644
--- a/apps/web/src/components/dialogs/move-note-dialog.js
+++ b/apps/web/src/components/dialogs/move-note-dialog.js
@@ -133,7 +133,7 @@ export default class MoveDialog extends React.Component {
type: "notes",
title: `${this.selectedNotebook.title} - ${item.title}`,
items: db.notebooks
- .notebook(this.notebook.id)
+ .notebook(this.selectedNotebook.id)
.topics.topic(item.title).all
});
this.selectedTopic = item.title;
@@ -163,12 +163,17 @@ export default class MoveDialog extends React.Component {
}
positiveButton={{
text: "Move",
- click: async () => {
+ onClick: async () => {
try {
await db.notes.move(
{ id: this.selectedNotebook.id, topic: this.selectedTopic },
props.noteId
);
+ console.log(
+ this.selectedNotebook.id,
+ this.selectedTopic,
+ props.noteId
+ );
props.onMove();
} catch (e) {
console.log(e);
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index 9935e9b96..2f599c01a 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -43,6 +43,11 @@ function noteStore(set, get) {
case "color":
notes = db.notes.colored(context.value);
break;
+ case "topic":
+ notes = db.notebooks
+ .notebook(context.notebook.id)
+ .topics.topic(context.value).all;
+ break;
default:
return;
}
diff --git a/apps/web/src/views/Topics.js b/apps/web/src/views/Topics.js
index e947cabd6..306c5a5ba 100644
--- a/apps/web/src/views/Topics.js
+++ b/apps/web/src/views/Topics.js
@@ -1,9 +1,10 @@
import React from "react";
import Topic from "../components/topic";
-import { db } from "../common";
import ListContainer from "../components/list-container";
+import { useStore } from "../stores/note-store";
const Topics = props => {
+ const setSelectedContext = useStore(store => store.setSelectedContext);
return (
<ListContainer
itemsLength={props.topics.length}
@@ -13,12 +14,14 @@ const Topics = props => {
item={props.topics[index]}
onClick={() => {
let topic = props.topics[index];
+ setSelectedContext({
+ type: "topic",
+ value: topic.title,
+ notebook: props.notebook
+ });
props.navigator.navigate("notes", {
title: props.notebook.title,
- subtitle: topic.title,
- notes: db.notebooks
- .notebook(props.notebook.id)
- .topics.topic(topic.title).all
+ subtitle: topic.title
});
}}
/>
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index 57ffd943d..b257cb7d0 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -6194,6 +6194,18 @@ levn@^0.3.0, levn@~0.3.0:
prelude-ls "~1.1.2"
type-check "~0.3.2"
+libsodium-wrappers@^0.7.6:
+ version "0.7.6"
+ resolved "https://registry.yarnpkg.com/libsodium-wrappers/-/libsodium-wrappers-0.7.6.tgz#baed4c16d4bf9610104875ad8a8e164d259d48fb"
+ integrity sha512-OUO2CWW5bHdLr6hkKLHIKI4raEkZrf3QHkhXsJ1yCh6MZ3JDA7jFD3kCATNquuGSG6MjjPHQIQms0y0gBDzjQg==
+ dependencies:
+ libsodium "0.7.6"
+
+ version "0.7.6"
+ resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.6.tgz#018b80c5728054817845fbffa554274441bda277"
+ integrity sha512-hPb/04sEuLcTRdWDtd+xH3RXBihpmbPCsKW/Jtf4PsvdyKh+D6z2D2gvp/5BfoxseP+0FCOg66kE+0oGUE/loQ==
+
version "3.1.1"
resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e"
@@ -6813,10 +6825,11 @@ normalize-url@^3.0.0, normalize-url@^3.0.1:
"notes-core@https://github.com/thecodrr/notes-core.git":
version "1.2.0"
- resolved "https://github.com/thecodrr/notes-core.git#f9b8bc23e4fe779cd569f7e58c2f5fc2ae92729f"
+ resolved "https://github.com/thecodrr/notes-core.git#d26b1dd3c78b7cc845869d115895b101bf8d4fc2"
dependencies:
fast-sort "^2.0.1"
fuzzysearch "^1.0.3"
+ libsodium-wrappers "^0.7.6"
qclone "^1.0.4"
transfun "^1.0.2"