Skip to content

Commit 3571188

Browse files
committed
feat(web): add Focus Mode UI entry in Insert Menu
Add discoverable UI entry point for Focus Mode via Insert Menu submenu: UI Changes: - Add "View" submenu to Insert Menu (+ button dropdown) - Nested menu with Focus Mode option (ChatGPT-style pattern) - Display keyboard shortcut hint (⌘⇧F) next to menu item - Uses DropdownMenuSub components from Radix UI User Access Methods: 1. Keyboard: Cmd/Ctrl+Shift+F (primary, power users) 2. Mouse: + menu → View → Focus Mode (discoverable) 3. Mobile: Touch-friendly menu access Benefits: - Improves discoverability for new users - Doesn't clutter main editor UI - Educates users about keyboard shortcut - Extensible for future view options (typewriter, reading mode, etc.) - Follows familiar UI patterns (ChatGPT, Notion) Files Modified: - web/src/components/MemoEditor/ActionButton/InsertMenu.tsx * Add DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent * Add View submenu with Focus Mode entry * Add onToggleFocusMode prop - web/src/components/MemoEditor/index.tsx * Pass toggleFocusMode to InsertMenu component - web/src/locales/en.json * Add "editor.view" translation key
1 parent c8162ff commit 3571188

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

web/src/components/MemoEditor/ActionButton/InsertMenu.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import { LatLng } from "leaflet";
22
import { uniqBy } from "lodash-es";
3-
import { FileIcon, LinkIcon, LoaderIcon, MapPinIcon, PlusIcon } from "lucide-react";
3+
import { FileIcon, LinkIcon, LoaderIcon, MapPinIcon, Maximize2Icon, MoreHorizontalIcon, PlusIcon } from "lucide-react";
44
import { observer } from "mobx-react-lite";
55
import { useContext, useState } from "react";
66
import { Button } from "@/components/ui/button";
7-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
7+
import {
8+
DropdownMenu,
9+
DropdownMenuContent,
10+
DropdownMenuItem,
11+
DropdownMenuSub,
12+
DropdownMenuSubContent,
13+
DropdownMenuSubTrigger,
14+
DropdownMenuTrigger,
15+
} from "@/components/ui/dropdown-menu";
816
import { Attachment } from "@/types/proto/api/v1/attachment_service";
917
import { Location, MemoRelation } from "@/types/proto/api/v1/memo_service";
1018
import { useTranslate } from "@/utils/i18n";
@@ -19,6 +27,7 @@ interface Props {
1927
isUploading?: boolean;
2028
location?: Location;
2129
onLocationChange: (location?: Location) => void;
30+
onToggleFocusMode?: () => void;
2231
}
2332

2433
const InsertMenu = observer((props: Props) => {
@@ -124,6 +133,20 @@ const InsertMenu = observer((props: Props) => {
124133
<MapPinIcon className="w-4 h-4" />
125134
{t("tooltip.select-location")}
126135
</DropdownMenuItem>
136+
{/* View submenu with Focus Mode */}
137+
<DropdownMenuSub>
138+
<DropdownMenuSubTrigger>
139+
<MoreHorizontalIcon className="w-4 h-4" />
140+
{t("common.more")}
141+
</DropdownMenuSubTrigger>
142+
<DropdownMenuSubContent>
143+
<DropdownMenuItem onClick={props.onToggleFocusMode}>
144+
<Maximize2Icon className="w-4 h-4" />
145+
{t("editor.focus-mode")}
146+
<span className="ml-auto text-xs text-muted-foreground opacity-60">⌘⇧F</span>
147+
</DropdownMenuItem>
148+
</DropdownMenuSubContent>
149+
</DropdownMenuSub>
127150
</DropdownMenuContent>
128151
</DropdownMenu>
129152

web/src/components/MemoEditor/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ const MemoEditor = observer((props: Props) => {
591591
location,
592592
}))
593593
}
594+
onToggleFocusMode={toggleFocusMode}
594595
/>
595596
</div>
596597
<div className="shrink-0 flex flex-row justify-end items-center">

web/src/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@
102102
"username": "Username",
103103
"version": "Version",
104104
"visibility": "Visibility",
105-
"yourself": "Yourself"
105+
"yourself": "Yourself",
106+
"more": "More"
106107
},
107108
"days": {
108109
"fri": "Fri",

0 commit comments

Comments
 (0)