Skip to content

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

web: bring back title in context menu

Abdullah Atta060952697a49
diff --git a/apps/web/__e2e__/models/context-menu.model.ts b/apps/web/__e2e__/models/context-menu.model.ts
index ea81d880a..346965abb 100644
--- a/apps/web/__e2e__/models/context-menu.model.ts
+++ b/apps/web/__e2e__/models/context-menu.model.ts
@@ -22,8 +22,14 @@ import { getTestId } from "../utils";
export class ContextMenuModel {
readonly menuContainer: Locator;
+ readonly titleText: Locator;
constructor(private readonly page: Page) {
this.menuContainer = this.page.locator(getTestId(`menu-container`));
+ this.titleText = this.page.locator(getTestId(`menu-title`));
+ }
+
+ async title() {
+ return await this.titleText.textContent();
}
async open(
diff --git a/apps/web/__e2e__/models/note-properties.model.ts b/apps/web/__e2e__/models/note-properties.model.ts
index c6ea79ea1..ae2125bf0 100644
--- a/apps/web/__e2e__/models/note-properties.model.ts
+++ b/apps/web/__e2e__/models/note-properties.model.ts
@@ -303,6 +303,10 @@ export class NoteContextMenuModel extends BaseProperties {
async close() {
await this.menu.close();
}
+
+ title() {
+ return this.menu.title();
+ }
}
class SessionHistoryItemModel {
diff --git a/apps/web/src/components/menu/index.js b/apps/web/src/components/menu/index.js
index 0a1a44f57..ac6621c1a 100644
--- a/apps/web/src/components/menu/index.js
+++ b/apps/web/src/components/menu/index.js
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { useCallback, useRef, useEffect, useState } from "react";
-import { Flex } from "@theme-ui/components";
+import { Flex, Text } from "@theme-ui/components";
import { getPosition } from "../../hooks/use-menu";
import { FlexScrollContainer } from "../scroll-container";
import MenuItem from "./menu-item";
@@ -211,7 +211,7 @@ function Menu({ items, data, title, closeMenu }) {
}
export default React.memo(Menu);
-function MenuContainer({ children }) {
+function MenuContainer({ title, children }) {
return (
<Flex
className="menuContainer"
@@ -229,6 +229,23 @@ function MenuContainer({ children }) {
flexDirection: "column"
}}
>
+ {title && (
+ <Text
+ py={"8px"}
+ px={3}
+ sx={{
+ borderBottom: "1px solid",
+ borderBottomColor: "border",
+ wordWrap: "break-word",
+ fontSize: "subtitle",
+ fontFamily: "body",
+ color: "primary"
+ }}
+ data-test-id="menu-title"
+ >
+ {title}
+ </Text>
+ )}
<FlexScrollContainer>{children}</FlexScrollContainer>
</Flex>
);
diff --git a/apps/web/src/components/navigation-menu/navigation-item.tsx b/apps/web/src/components/navigation-menu/navigation-item.tsx
index ba00a93f5..a814f4460 100644
--- a/apps/web/src/components/navigation-menu/navigation-item.tsx
+++ b/apps/web/src/components/navigation-menu/navigation-item.tsx
@@ -90,7 +90,7 @@ function NavigationItem(props: PropsWithChildren<NavigationItemProps>) {
onContextMenu={(e) => {
if (!menuItems) return;
e.preventDefault();
- openMenu(menuItems, { title });
+ openMenu(menuItems);
}}
onClick={() => {
if (isMobile) toggleSideMenu(false);