A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
feat: show att. notes in menu (fixes streetwriters/notesnook#402)
thecodrr86e4dc65c8d2
diff --git a/apps/web/src/common/dialogcontroller.js b/apps/web/src/common/dialogcontroller.jsindex c0b47791d..f184af9a0 100644--- a/apps/web/src/common/dialogcontroller.js+++ b/apps/web/src/common/dialogcontroller.js@@ -40,7 +40,6 @@ function showDialog(dialog) {export function closeOpenedDialog() {const root = document.getElementById("dialogContainer");- if (!root.childElementCount) return;ReactDOM.unmountComponentAtNode(root);}diff --git a/apps/web/src/components/attachment/index.js b/apps/web/src/components/attachment/index.jsindex a57486c05..ee89ae17f 100644--- a/apps/web/src/components/attachment/index.js+++ b/apps/web/src/components/attachment/index.js@@ -7,7 +7,11 @@ import { reuploadAttachment } from "../editor/plugins/picker";import { store } from "../../stores/attachment-store";import { db } from "../../common/db";import { Multiselect } from "../../common/multi-select";-import { showAttachmentsDialog } from "../../common/dialog-controller";+import {+ closeOpenedDialog,+ showAttachmentsDialog,+} from "../../common/dialog-controller";+import { hashNavigate } from "../../navigation";const workStatusMap = {recheck: "Rechecking...",@@ -133,6 +137,26 @@ function Attachment({ item, isCompact, index }) {export default Attachment;const menuItems = [+ {+ key: "notes",+ title: "Notes",+ icon: Icon.References,+ items: ({ attachment }) =>+ attachment.noteIds.reduce((prev, curr) => {+ const note = db.notes.note(curr);+ if (!note) prev.push({ key: curr, title: `Note with id ${curr}` });+ else+ prev.push({+ key: note.id,+ title: note.title,+ onClick: () => {+ hashNavigate(`/notes/${curr}/edit`);+ closeOpenedDialog();+ },+ });+ return prev;+ }, []),+ },{key: "recheck",title: () => "Recheck",diff --git a/apps/web/src/components/icons/index.js b/apps/web/src/components/icons/index.jsindex 75ed585c9..670e7a6ea 100644--- a/apps/web/src/components/icons/index.js+++ b/apps/web/src/components/icons/index.js@@ -140,11 +140,11 @@ import {mdiGithub,mdiAlertCircleOutline,mdiProgressUpload,- mdiRenameBox,mdiFormTextbox,mdiCheckAll,mdiCloudOffOutline,mdiContentDuplicate,+ mdiVectorLink,} from "@mdi/js";import { useTheme } from "emotion-theming";import { AnimatedFlex } from "../animated";@@ -362,3 +362,4 @@ export const Reupload = createIcon(mdiProgressUpload);export const Rename = createIcon(mdiFormTextbox);export const Upload = createIcon(mdiCloudOffOutline);export const Uploaded = createIcon(mdiCloudCheckOutline);+export const References = createIcon(mdiVectorLink);diff --git a/apps/web/src/hooks/use-menu.js b/apps/web/src/hooks/use-menu.jsindex 94aab788d..8702eb7ed 100644--- a/apps/web/src/hooks/use-menu.js+++ b/apps/web/src/hooks/use-menu.js@@ -165,7 +165,6 @@ function mapMenuItems(items, data) {disabled,hidden,checked,- items,isPro,isNew,type,@@ -186,6 +185,7 @@ function mapMenuItems(items, data) {const icon = resolveProp(item.icon, data, item);const isChecked = resolveProp(checked, data, item);const isDisabled = resolveProp(disabled, data, item);+ const items = resolveProp(item.items, data, item);const onClick =typeof _onClick === "function" && _onClick.bind(this, data, item);