From 08dd8893ffa04bfb04efbe998dd5af12a361b4c8 Mon Sep 17 00:00:00 2001 From: Zakk Date: Fri, 25 Sep 2026 22:51:11 +1000 Subject: [PATCH] feat(shell): move language and appearance into an overflow menu on phones Below 1024px the top bar keeps search and refresh or apply, and one More options menu at the end holds language, theme, palette and wordmark. The desktop top bar is unchanged. --- src/i18n/locales/en.ts | 2 ++ src/i18n/locales/zh-CN.ts | 2 ++ src/i18n/locales/zh-TW.ts | 2 ++ src/shell/TopBar.tsx | 52 +++++++++++++++++++++------------- src/shell/messages.ts | 6 ++++ src/shell/view.ts | 5 ++++ src/ui/icons/MoreVertical.tsx | 23 +++++++++++++++ src/ui/styles/shell-search.css | 11 +++++++ 8 files changed, 84 insertions(+), 19 deletions(-) create mode 100644 src/ui/icons/MoreVertical.tsx diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 1e3c086d..534801c9 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -1147,6 +1147,8 @@ export const messages = { 'wordmark.gradient': 'Gradient', 'wordmark.plain': 'Plain', lang: 'Language', + theme: 'Theme', + moreOptions: 'More options', hubs: 'Sections', github: 'GitHub repository', 'search.nodes': 'Nodes', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index eacf2d1c..690ed3db 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -1121,6 +1121,8 @@ export const messages = { 'wordmark.gradient': '渐变', 'wordmark.plain': '纯色', lang: '语言', + theme: '主题', + moreOptions: '更多选项', hubs: '页面分区', github: 'GitHub 仓库', 'search.nodes': '节点', diff --git a/src/i18n/locales/zh-TW.ts b/src/i18n/locales/zh-TW.ts index f38817f7..d1d0b0a5 100644 --- a/src/i18n/locales/zh-TW.ts +++ b/src/i18n/locales/zh-TW.ts @@ -1120,6 +1120,8 @@ export const messages = { 'wordmark.gradient': '漸層', 'wordmark.plain': '純色', lang: '語言', + theme: '主題', + moreOptions: '更多選項', hubs: '頁面分區', github: 'GitHub 儲存庫', 'search.nodes': '節點', diff --git a/src/shell/TopBar.tsx b/src/shell/TopBar.tsx index 08ce5688..cb927b52 100644 --- a/src/shell/TopBar.tsx +++ b/src/shell/TopBar.tsx @@ -4,6 +4,7 @@ import {About} from './About'; import Color from '../ui/icons/Color'; import Contrast from '../ui/icons/Contrast'; import Lighten from '../ui/icons/Lighten'; +import MoreVertical from '../ui/icons/MoreVertical'; import Refresh from '../ui/icons/Refresh'; import Search from '../ui/icons/Search'; import Translate from '../ui/icons/Translate'; @@ -11,7 +12,7 @@ import logo from '../logo.svg'; import {useT, type Lang} from '../i18n'; import {Button, ChoiceMenu} from '../ui/ui'; import type {SettingsContext} from './preferences'; -import type {PaletteId, Wordmark} from './preferences'; +import type {PaletteId, Scheme, Wordmark} from './preferences'; import type {AppearanceMenu, PaletteSection} from './view'; import {languageItems} from './view'; import {preloadSearch} from './search/load'; @@ -65,6 +66,10 @@ export const TopBar = memo(function TopBar({ const t = useT(); // The language and palette icons turn in when their value changes, like the scheme icon; not on first paint. const [first] = useState({lang, palette: ap.palette}); + const paletteMenu = [ + ...paletteSections.map(section => ({...section, value: ap.palette, onChange: (k: string) => ap.pickPalette(k as PaletteId)})), + {title: t('wordmark'), items: menu.wordmarks, value: ap.wordmark, onChange: (k: string) => ap.pickWordmark(k as Wordmark)} + ]; return (
{!!held && {held}} - - pickLang(k as Lang)} items={languageItems}> - - - ({...section, value: ap.palette, onChange: (k: string) => ap.pickPalette(k as PaletteId)})), - {title: t('wordmark'), items: menu.wordmarks, value: ap.wordmark, onChange: (k: string) => ap.pickWordmark(k as Wordmark)} - ]} - > - - - + {/* Below the side navigation's breakpoint, language and appearance share one overflow menu. */} + + + pickLang(k as Lang)} items={languageItems}> + + + + + + + + + pickLang(k as Lang)}, + {title: t('theme'), items: menu.schemes, value: ap.scheme, onChange: k => ap.pickScheme(k as Scheme)}, + ...paletteMenu + ]} + > + + +
); diff --git a/src/shell/messages.ts b/src/shell/messages.ts index 3c726d90..833fff64 100644 --- a/src/shell/messages.ts +++ b/src/shell/messages.ts @@ -83,6 +83,8 @@ export const messages = defineMessages({ 'wordmark.gradient': '漸層', 'wordmark.plain': '純色', lang: '語言', + theme: '主題', + moreOptions: '更多選項', hubs: '頁面分區', github: 'GitHub 儲存庫', 'search.nodes': '節點', @@ -210,6 +212,8 @@ export const messages = defineMessages({ 'wordmark.gradient': '渐变', 'wordmark.plain': '纯色', lang: '语言', + theme: '主题', + moreOptions: '更多选项', hubs: '页面分区', github: 'GitHub 仓库', 'search.nodes': '节点', @@ -337,6 +341,8 @@ export const messages = defineMessages({ 'wordmark.gradient': 'Gradient', 'wordmark.plain': 'Plain', lang: 'Language', + theme: 'Theme', + moreOptions: 'More options', hubs: 'Sections', github: 'GitHub repository', 'search.nodes': 'Nodes', diff --git a/src/shell/view.ts b/src/shell/view.ts index ededcaa4..f7b0b55f 100644 --- a/src/shell/view.ts +++ b/src/shell/view.ts @@ -186,6 +186,11 @@ export function appearanceMenu(t: Translator, scheme: Scheme, dark: boolean) { {id: 'gradient', label: t('wordmark.gradient')}, {id: 'plain', label: t('wordmark.plain')} ], + schemes: [ + {id: 'system', label: t('theme.system')}, + {id: 'light', label: t('theme.light')}, + {id: 'dark', label: t('theme.dark')} + ], themeLabel: t('shell.theme', {theme: t(scheme === 'system' ? 'theme.system' : dark ? 'theme.dark' : 'theme.light')}) }; } diff --git a/src/ui/icons/MoreVertical.tsx b/src/ui/icons/MoreVertical.tsx new file mode 100644 index 00000000..f9849cfd --- /dev/null +++ b/src/ui/icons/MoreVertical.tsx @@ -0,0 +1,23 @@ +// Three stacked dots on the Spectrum 20px grid: the overflow menu of a top bar. +import type {SVGProps} from 'react'; +import {cx} from '../cx'; + +export default function MoreVertical({className, ...props}: SVGProps) { + return ( + + ); +} diff --git a/src/ui/styles/shell-search.css b/src/ui/styles/shell-search.css index d0be64a7..dee637f0 100644 --- a/src/ui/styles/shell-search.css +++ b/src/ui/styles/shell-search.css @@ -239,6 +239,17 @@ display: none; } } +.rp-top-wide { + display: none; +} +@media (min-width: 1024px) { + .rp-top-wide { + display: contents; + } + .rp-top-more { + display: none; + } +} .rp-vrule { width: 2px; height: 32px;