Skip to content

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

web: disable reveal in list option when focus mode active (#8297)

01zulfi9e72f5185190
diff --git a/apps/web/__e2e__/models/tab-item.model.ts b/apps/web/__e2e__/models/tab-item.model.ts
index a328102be..4c9afd74b 100644
--- a/apps/web/__e2e__/models/tab-item.model.ts
+++ b/apps/web/__e2e__/models/tab-item.model.ts
@@ -69,4 +69,9 @@ class TabContextMenuModel {
async open() {
await this.menu.open(this.tabLocator);
}
+
+ async getRevealInListItem() {
+ await this.open();
+ return this.menu.getItem("reveal-in-list");
+ }
}
diff --git a/apps/web/__e2e__/tabs.test.ts b/apps/web/__e2e__/tabs.test.ts
index 231ef26ee..016d1f644 100644
--- a/apps/web/__e2e__/tabs.test.ts
+++ b/apps/web/__e2e__/tabs.test.ts
@@ -501,5 +501,22 @@ test("if note is active in a tab and present in other tab's history, moving the
await expect(tabs[0].locator).toHaveText("Note 2");
});
+test("if focus mode active, reveal in list option should be disabled", async ({
+ page
+}) => {
+ const app = new AppModel(page);
+ await app.goto();
+ const notes = await app.goToNotes();
+ await notes.createNote({
+ title: "Note 1"
+ });
+
+ await notes.editor.enterFocusMode();
+
+ const tabs = await notes.editor.getTabs();
+ const revealInList = await tabs[0].contextMenu.getRevealInListItem();
+ expect(await revealInList.isDisabled()).toBe(true);
+});
+
test.skip("TODO: open a locked note, switch to another note and navigate back", () => {});
test.skip("TODO: open a locked note, switch to another note, unlock the note and navigate back", () => {});
diff --git a/apps/web/src/components/editor/action-bar.tsx b/apps/web/src/components/editor/action-bar.tsx
index 3786f80ac..56a247d8d 100644
--- a/apps/web/src/components/editor/action-bar.tsx
+++ b/apps/web/src/components/editor/action-bar.tsx
@@ -272,6 +272,7 @@ const TabStrip = React.memo(function TabStrip() {
const currentTab = useEditorStore((store) => store.activeTabId);
const canGoBack = useEditorStore((store) => store.canGoBack);
const canGoForward = useEditorStore((store) => store.canGoForward);
+ const isFocusMode = useAppStore((store) => store.isFocusMode);
return (
<Flex sx={{ flex: 1 }}>
@@ -399,6 +400,7 @@ const TabStrip = React.memo(function TabStrip() {
isActive={tab.id === currentTab}
isPinned={!!tab.pinned}
isLocked={isLockedSession(session)}
+ isRevealInListDisabled={isFocusMode}
type={session.type}
onFocus={() => {
if (tab.id !== currentTab) {
@@ -471,6 +473,7 @@ type TabProps = {
isPinned: boolean;
isLocked: boolean;
isUnsaved: boolean;
+ isRevealInListDisabled: boolean;
type: SessionType;
onFocus: () => void;
onClose: () => void;
@@ -489,6 +492,7 @@ function Tab(props: TabProps) {
isPinned,
isLocked,
isUnsaved,
+ isRevealInListDisabled,
type,
onFocus,
onClose,
@@ -608,7 +612,8 @@ function Tab(props: TabProps) {
title: strings.revealInList(),
key: "reveal-in-list",
onClick: onRevealInList,
- isHidden: !onRevealInList
+ isHidden: !onRevealInList,
+ isDisabled: isRevealInListDisabled
},
{ type: "separator", key: "sep2", isHidden: !onRevealInList },
{