Skip to content

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

fix: fixed note taking in menus

alihamuh014146982e81
diff --git a/apps/web/src/components/navigation-menu/index.js b/apps/web/src/components/navigation-menu/index.js
index dfca820db..9a38a7b13 100644
--- a/apps/web/src/components/navigation-menu/index.js
+++ b/apps/web/src/components/navigation-menu/index.js
@@ -74,7 +74,11 @@ function NavigationMenu(props) {
setSelectedRoute(undefined);
RootNavigator.navigate("color", {
title: toTitleCase(color.title),
- context: { type: "color", colors: [color.title] },
+ context: {
+ type: "color",
+ colors: [color.title],
+ value: color.title,
+ },
});
}}
key={color.title}
diff --git a/apps/web/src/navigation/index.js b/apps/web/src/navigation/index.js
index 57d2430e1..ad0b0e7d8 100644
--- a/apps/web/src/navigation/index.js
+++ b/apps/web/src/navigation/index.js
@@ -115,7 +115,7 @@ function NavigationContainer(props) {
{props.canGoBack && (
<Box
onClick={props.backAction}
- ml={-5}
+ ml={-2}
height={38}
width={38}
>
diff --git a/apps/web/src/navigation/navigators/rootnavigator.js b/apps/web/src/navigation/navigators/rootnavigator.js
index b5abb14be..a1d564fb0 100644
--- a/apps/web/src/navigation/navigators/rootnavigator.js
+++ b/apps/web/src/navigation/navigators/rootnavigator.js
@@ -54,7 +54,7 @@ export const routes = {
options: SelectionModeOptions.FavoritesOptions,
},
{
- context: { type: "favorites" },
+ context: { type: "favorites", favorite: true },
}
),
...createNormalRoute("trash", Trash, Icon.Trash, {
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index 720623169..3a219a2b0 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -74,12 +74,17 @@ class EditorStore extends BaseStore {
saveSession = (oldSession) => {
this.set((state) => (state.session.isSaving = true));
- this._saveFn()(this.get().session).then((id) => {
+ this._saveFn()(this.get().session).then(async (id) => {
if (oldSession) {
if (oldSession.tags.length !== this.get().session.tags.length)
tagStore.refresh();
if (oldSession.colors.length !== this.get().session.colors.length)
appStore.refreshColors();
+
+ if (oldSession.notebook)
+ if (oldSession.state === "new" && oldSession.notebook.topic) {
+ await db.notes.move(oldSession.notebook, id);
+ }
}
if (!this.get().session.id) {
@@ -115,12 +120,14 @@ class EditorStore extends BaseStore {
clearTimeout(this.get().session.timeout);
const oldSession = { ...this.get().session };
this.set((state) => {
- state.session.state = SESSION_STATES.stale;
set(state);
state.session.timeout = setTimeout(
() => {
this.session = this.get().session;
+ this.set((state) => {
+ state.session.state = SESSION_STATES.stale;
+ });
this.saveSession(oldSession);
},
immediate ? 0 : 500
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index b926e6069..405c45c79 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -36,6 +36,7 @@ class NoteStore extends BaseStore {
break;
case "color":
notes = db.notes.colored(context.value);
+ //console.log(context.value, " I am in notesStore");
break;
case "topic":
notes = db.notebooks
diff --git a/apps/web/src/views/Notebooks.js b/apps/web/src/views/Notebooks.js
index ebdb0cde2..cbc79a2b8 100644
--- a/apps/web/src/views/Notebooks.js
+++ b/apps/web/src/views/Notebooks.js
@@ -10,8 +10,8 @@ import NotebooksPlaceholder from "../components/placeholders/notebooks-placehold
function Notebooks(props) {
const [open, setOpen] = useState(false);
useEffect(() => store.refresh(), []);
- const notebooks = useStore(state => state.notebooks);
- const add = useStore(state => state.add);
+ const notebooks = useStore((state) => state.notebooks);
+ const add = useStore((state) => state.add);
return (
<>
<ListContainer
@@ -25,7 +25,7 @@ function Notebooks(props) {
props.navigator.navigate("topics", {
title: item.title,
topics: item.topics,
- notebook: item
+ notebook: item,
});
}}
onTopicClick={(notebook, topic) =>
@@ -34,7 +34,10 @@ function Notebooks(props) {
subtitle: topic.title,
notes: db.notebooks
.notebook(notebook.id)
- .topics.topic(topic.title).all
+ .topics.topic(topic.title).all,
+ context: {
+ notebook: { id: notebook.id, topic: topic.title },
+ },
})
}
/>
@@ -44,12 +47,12 @@ function Notebooks(props) {
content: "Create a notebook",
onClick: async () => {
setOpen(true);
- }
+ },
}}
/>
<AddNotebookDialog
isOpen={open}
- onDone={async nb => {
+ onDone={async (nb) => {
await add(nb);
setOpen(false);
}}
diff --git a/apps/web/src/views/Notes.js b/apps/web/src/views/Notes.js
index c54655e1c..b403908be 100644
--- a/apps/web/src/views/Notes.js
+++ b/apps/web/src/views/Notes.js
@@ -16,6 +16,7 @@ function Notes(props) {
}
}, [props.context, setContext]);
+ console.log(context);
if (!context) return null;
return (
<ListContainer
diff --git a/apps/web/src/views/Topics.js b/apps/web/src/views/Topics.js
index e2df01e77..bf44a5c27 100644
--- a/apps/web/src/views/Topics.js
+++ b/apps/web/src/views/Topics.js
@@ -7,12 +7,12 @@ import { useStore as useNbStore } from "../stores/notebook-store";
import { showTopicDialog } from "../components/dialogs/topicdialog";
function Topics(props) {
- const setContext = useNoteStore(store => store.setContext);
+ const setContext = useNoteStore((store) => store.setContext);
const setSelectedNotebookTopics = useNbStore(
- store => store.setSelectedNotebookTopics
+ (store) => store.setSelectedNotebookTopics
);
const selectedNotebookTopics = useNbStore(
- store => store.selectedNotebookTopics
+ (store) => store.selectedNotebookTopics
);
const [topics, setTopics] = useState([]);
@@ -37,11 +37,14 @@ function Topics(props) {
setContext({
type: "topic",
value: topic.title,
- notebook: props.notebook
+ notebook: props.notebook,
});
props.navigator.navigate("notes", {
title: props.notebook.title,
- subtitle: topic.title
+ subtitle: topic.title,
+ context: {
+ notebook: { id: props.notebook.id, topic: topic.title },
+ },
});
}}
/>
@@ -51,7 +54,7 @@ function Topics(props) {
content: "Add more topics",
onClick: async () => {
await showTopicDialog(props.notebook.id);
- }
+ },
}}
/>
);
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index b4d354887..28c22b15c 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -7274,9 +7274,9 @@ normalize-url@^3.0.0, normalize-url@^3.0.1:
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559"
integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==
-"notes-core@git+ssh://[email protected]:streetwriters/notesnook-core.git":
+"notes-core@https://github.com/streetwriters/notesnook-core.git":
version "1.3.0"
- resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#ed5ead55bed5ff5ec976ed46dc517854b407aff7"
+ resolved "https://github.com/streetwriters/notesnook-core.git#ed5ead55bed5ff5ec976ed46dc517854b407aff7"
dependencies:
fast-sort "^2.0.1"
fuzzysearch "^1.0.3"