Skip to content

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

web: remove more usages of `session.id` where noteId was expected

Abdullah Attabc44e28e1e49
diff --git a/apps/web/src/components/editor/action-bar.tsx b/apps/web/src/components/editor/action-bar.tsx
index b09ac4226..03e90a10d 100644
--- a/apps/web/src/components/editor/action-bar.tsx
+++ b/apps/web/src/components/editor/action-bar.tsx
@@ -100,7 +100,9 @@ export function EditorActionBar() {
const isLoggedIn = useUserStore((store) => store.isLoggedIn);
const monographs = useMonographStore((store) => store.monographs);
const isNotePublished =
- activeSession && db.monographs.isPublished(activeSession.id);
+ activeSession &&
+ "note" in activeSession &&
+ db.monographs.isPublished(activeSession.note.id);
const isMobile = useMobile();
const isTablet = useTablet();
@@ -419,12 +421,15 @@ function TabStrip() {
.map((s) => s.id)
)
}
- onRevealInList={() =>
- AppEventManager.publish(
- AppEvents.revealItemInList,
- "note" in session ? session.note.id : session.id,
- true
- )
+ onRevealInList={
+ "note" in session
+ ? () =>
+ AppEventManager.publish(
+ AppEvents.revealItemInList,
+ session.note.id,
+ true
+ )
+ : undefined
}
onPin={() => {
useEditorStore.setState((state) => {
@@ -466,8 +471,8 @@ type TabProps = {
onCloseToTheRight: () => void;
onCloseToTheLeft: () => void;
onCloseAll: () => void;
- onRevealInList: () => void;
onPin: () => void;
+ onRevealInList?: () => void;
};
function Tab(props: TabProps) {
const {
@@ -580,7 +585,8 @@ function Tab(props: TabProps) {
type: "button",
title: strings.revealInList(),
key: "reveal-in-list",
- onClick: onRevealInList
+ onClick: onRevealInList,
+ isHidden: !onRevealInList
},
{ type: "separator", key: "sep" },
{
diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx
index e589d91df..b99f6dda6 100644
--- a/apps/web/src/components/editor/index.tsx
+++ b/apps/web/src/components/editor/index.tsx
@@ -888,7 +888,7 @@ function UnlockNoteView(props: UnlockNoteViewProps) {
subtitle={strings.enterPasswordToUnlockNote()}
title={session.note.title}
unlock={async (password) => {
- const note = await db.vault.open(session.id, password);
+ const note = await db.vault.open(session.note.id, password);
if (!note || !note.content)
throw new Error("note with this id does not exist.");