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(ui): add icons to context menu
thecodrr5ef320e48b21
diff --git a/apps/web/src/components/icons/index.js b/apps/web/src/components/icons/index.jsindex 4e7b4eb1a..0c215b623 100644--- a/apps/web/src/components/icons/index.js+++ b/apps/web/src/components/icons/index.js@@ -54,7 +54,7 @@ export const Topic = createIcon(Icons.mdiFormatTitle);export const Alert = createIcon(Icons.mdiAlert);export const Vault = createIcon(Icons.mdiShieldOutline);export const Unlock = createIcon(Icons.mdiLockOpenOutline);-export const Lock = createIcon(Icons.mdiLock);+export const Lock = createIcon(Icons.mdiLockOutline);export const Star = createIcon(Icons.mdiStar);export const StarOutline = createIcon(Icons.mdiStarOutline);export const Circle = createIcon(Icons.mdiCircle);@@ -64,6 +64,7 @@ export const Check = createIcon(Icons.mdiCheck);export const Cross = createIcon(Icons.mdiClose);export const MoreVertical = createIcon(Icons.mdiDotsVertical);export const Trash = createIcon(Icons.mdiTrashCanOutline);+export const TopicRemove = createIcon(Icons.mdiBookRemoveOutline);export const Search = createIcon(Icons.mdiMagnify);export const Menu = createIcon(Icons.mdiMenu);export const Login = createIcon(Icons.mdiLoginVariant);@@ -140,3 +141,10 @@ export const Fullscreen = createIcon(Icons.mdiFullscreen);export const ExitFullscreen = createIcon(Icons.mdiFullscreenExit);export const Announcement = createIcon(Icons.mdiBullhorn);++export const Copy = createIcon(Icons.mdiContentCopy);++export const Select = createIcon(Icons.mdiCheckboxMultipleMarkedCircleOutline);+export const NotebookEdit = createIcon(Icons.mdiBookEditOutline);+export const DeleteForver = createIcon(Icons.mdiDeleteForeverOutline);+diff --git a/apps/web/src/components/list-item/index.js b/apps/web/src/components/list-item/index.jsindex 243379a16..41d070bd3 100644--- a/apps/web/src/components/list-item/index.js+++ b/apps/web/src/components/list-item/index.js@@ -11,6 +11,7 @@ function selectMenuItem(isSelected, toggleSelection) {return {key: "select",title: () => (isSelected ? "Unselect" : "Select"),+ icon: Icon.Select,onClick: () => {const selectionState = selectionStore.get();if (!selectionState.isSelectionMode) {diff --git a/apps/web/src/components/menu/index.js b/apps/web/src/components/menu/index.jsindex b6a9e9b60..73f2c21b1 100644--- a/apps/web/src/components/menu/index.js+++ b/apps/web/src/components/menu/index.js@@ -1,6 +1,6 @@import { useAnimation } from "framer-motion";import React, { useEffect, useMemo } from "react";-import { Flex, Box, Text } from "rebass";+import { Flex, Box, Text, Button } from "rebass";import { isUserPremium } from "../../common";import useMobile from "../../utils/use-mobile";import Animated from "../animated";@@ -16,8 +16,22 @@ function Menu(props) {return (<Container id={id} style={style} sx={sx} state={state}>{menuItems.map(- ({ title, key, onClick, component: Component, color, isPro }) => (- <Flex+ ({+ title,+ key,+ onClick,+ component: Component,+ color,+ isPro,+ isNew,+ disabled,+ disableReason,+ icon: Icon,+ }) => (+ <Button+ variant="anchor"+ title={disableReason || title(data)}+ disabled={disabled && disabled(data)}data-test-id={`menuitem-${title(data).split(" ").join("")@@ -33,29 +47,36 @@ function Menu(props) {onClick(data);}}}+ display="flex"flexDirection="row"alignItems="center"- justifyContent="space-between"py={"8px"}px={3}sx={{color: color || "text",cursor: "pointer",- ":hover": {+ ":hover:not(:disabled)": {backgroundColor: "shade",},}}>+ {Icon && <Icon color={color || "text"} size={16} sx={{ mr: 1 }} />}{Component ? (<Component data={data} />) : (- <Text as="span" fontFamily="body" fontSize="menu">+ <Text+ as="span"+ textAlign="left"+ fontFamily="body"+ fontSize="menu"+ flex={1}+ >{title(data)}</Text>)}{isPro && !isUserPremium() && (<Text- fontSize="body"+ fontSize="subBody"bg="primary"color="static"px={1}@@ -64,7 +85,18 @@ function Menu(props) {Pro</Text>)}- </Flex>+ {isNew && (+ <Text+ fontSize="subBody"+ bg="primary"+ color="static"+ px={1}+ sx={{ borderRadius: "default" }}+ >+ NEW+ </Text>+ )}+ </Button>))}</Container>@@ -90,7 +122,7 @@ function MenuContainer({ id, style, sx, children }) {...sx,}}>- <Box width="100%">+ <Flex flexDirection="column" width="100%"><TextfontFamily="body"fontSize="subtitle"@@ -102,7 +134,7 @@ function MenuContainer({ id, style, sx, children }) {Properties</Text>{children}- </Box>+ </Flex></Flex>);}diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.jsindex ced5430c5..b7cd9c1a1 100644--- a/apps/web/src/components/note/index.js+++ b/apps/web/src/components/note/index.js@@ -164,6 +164,7 @@ const menuItems = [{key: "addtonotebook",title: () => "Add to notebook(s)",+ icon: Icon.AddToNotebook,onClick: async ({ note }) => {await showMoveNoteDialog([note.id]);},@@ -171,6 +172,7 @@ const menuItems = [{key: "pin",title: ({ note }) => (note.pinned ? "Unpin" : "Pin"),+ icon: Icon.Pin,onClick: async ({ note }) => {await pin(note);},@@ -178,11 +180,13 @@ const menuItems = [{key: "favorite",title: ({ note }) => (note.favorite ? "Unfavorite" : "Favorite"),+ icon: Icon.StarOutline,onClick: ({ note }) => store.favorite(note),},{key: "export",title: () => "Export",+ icon: Icon.Export,onClick: async ({ note }) => {if (note.locked) {alert("Locked notes cannot be exported currently.");@@ -196,6 +200,7 @@ const menuItems = [{key: "unlocknote",title: ({ note }) => (note.locked ? "Unlock" : "Lock"),+ icon: Icon.Lock,onClick: async ({ note }) => {const { unlock, lock } = store.get();if (!note.locked) {@@ -212,6 +217,9 @@ const menuItems = [key: "movetotrash",title: () => "Move to Trash",color: "red",+ icon: Icon.Trash,+ disabled: ({ note }) => db.monographs.isPublished(note.id),+ disableReason: "Please unpublish this note to move it to trash",onClick: async ({ note }) => {if (note.locked) {const res = await showPasswordDialog("unlock_note", (password) => {@@ -232,6 +240,7 @@ const topicNoteMenuItems = [{key: "removefromtopic",title: () => "Remove from topic",+ icon: Icon.TopicRemove,color: "red",onClick: async ({ note, context }) => {await db.notebooksdiff --git a/apps/web/src/components/notebook/index.js b/apps/web/src/components/notebook/index.jsindex db6174e25..143b8c434 100644--- a/apps/web/src/components/notebook/index.js+++ b/apps/web/src/components/notebook/index.js@@ -87,15 +87,18 @@ const pin = async (notebook) => {const menuItems = [{title: () => "Edit",+ icon: Icon.NotebookEdit,onClick: ({ notebook }) => hashNavigate(`/notebooks/${notebook.id}/edit`),},{key: "pinnotebook",+ icon: Icon.Pin,title: ({ notebook }) => (notebook.pinned ? "Unpin" : "Pin"),onClick: ({ notebook }) => pin(notebook),},{key: "shortcut",+ icon: Icon.Shortcut,title: ({ notebook }) =>db.settings.isPinned(notebook.id) ? "Remove shortcut" : "Create shortcut",onClick: ({ notebook }) => appStore.pinItemToMenu(notebook),@@ -103,6 +106,7 @@ const menuItems = [{title: () => "Move to trash",color: "red",+ icon: Icon.Trash,onClick: async ({ notebook }) => {await store.delete(notebook.id)diff --git a/apps/web/src/components/tag/index.js b/apps/web/src/components/tag/index.jsindex fec14f86f..47388baf9 100644--- a/apps/web/src/components/tag/index.js+++ b/apps/web/src/components/tag/index.js@@ -4,11 +4,13 @@ import { navigate } from "../../navigation";import { Text } from "rebass";import { store as appStore } from "../../stores/app-store";import { db } from "../../common/db";+import * as Icon from "../icons";const menuItems = [{title: ({ tag }) =>db.settings.isPinned(tag.id) ? "Remove shortcut" : "Create shortcut",+ icon: Icon.Shortcut,onClick: ({ tag }) => appStore.pinItemToMenu(tag),},];diff --git a/apps/web/src/components/topic/index.js b/apps/web/src/components/topic/index.jsindex 8864d857b..ad071e760 100644--- a/apps/web/src/components/topic/index.js+++ b/apps/web/src/components/topic/index.js@@ -5,6 +5,7 @@ import { store } from "../../stores/notebook-store";import { store as appStore } from "../../stores/app-store";import { hashNavigate } from "../../navigation";import { Text } from "rebass";+import * as Icon from "../icons";function Topic({ item, index, onClick }) {const topic = item;@@ -40,6 +41,7 @@ const generalTopicMenuItems = [key: "shortcut",title: ({ topic }) =>db.settings.isPinned(topic.id) ? "Remove shortcut" : "Create shortcut",+ icon: Icon.Shortcut,onClick: ({ topic }) => appStore.pinItemToMenu(topic),},];@@ -48,6 +50,7 @@ const menuItems = [{key: "edit",title: () => "Edit",+ icon: Icon.Edit,onClick: ({ topic }) =>hashNavigate(`/notebooks/${topic.notebookId}/topics/${topic.id}/edit`),},@@ -55,6 +58,7 @@ const menuItems = [{key: "delete",title: () => "Delete",+ icon: Icon.Trash,color: "red",onClick: async ({ topic }) => {await db.notebooks.notebook(topic.notebookId).topics.delete(topic.id);diff --git a/apps/web/src/components/trash-item/index.js b/apps/web/src/components/trash-item/index.jsindex ee10120db..eb2479f9a 100644--- a/apps/web/src/components/trash-item/index.js+++ b/apps/web/src/components/trash-item/index.js@@ -35,6 +35,7 @@ export default TrashItem;const menuItems = [{title: () => "Restore",+ icon: Icon.Restore,onClick: ({ item }) => {store.restore(item.id);showToast(@@ -47,6 +48,7 @@ const menuItems = [},{title: () => "Delete",+ icon: Icon.DeleteForver,color: "red",onClick: ({ item }) => {confirm(Icon.Trash, {