diff --git a/localization/locales/en/translation.json b/localization/locales/en/translation.json index 10e65db3..696b24ae 100644 --- a/localization/locales/en/translation.json +++ b/localization/locales/en/translation.json @@ -277,7 +277,7 @@ "DefaultUserName": "User Name", "DefaultUserNameDetail": "The user name in the Wiki, this only take effect after restart, this will fill in the creator field of the newly created or edited tiddlers. Can be override by user name set in the workspace setting.", "ShowSideBarDetail": "Sidebar lets you switch easily between workspaces.", - "ShowSideBarShortcut": "Show keyboard shortcut hints on sidebar", + "ShowSideBarText": "Show button label on sidebar", "ShowNavigationBar": "Show navigation bar", "ShowNavigationBarDetail": "Navigation bar on the top lets you go back, forward, home, reload and see the URL.", "ShowTitleBar": "Show title bar", @@ -364,7 +364,7 @@ "SyncOnlyWhenNoDraftDescription": "Check if there are drafts before synchronizing, if so, it will not be synchronized this time, preventing the drafts from being synchronized to your blog. \n(Not working for sync-before-shutdown, for you may want to bring drafts from one computer to another to continue editing)", "MoreWorkspaceSyncSettingsDescription": "Please right-click the workspace icon, open its workspace setting by click on \"Edit Workspace\" context menu item, and configure its independent synchronization settings in it.", "MoreWorkspaceSyncSettings": "More Workspace Sync Settings", - "HideSideBarIcon": "Hide sidebar workspace icons", + "ShowSideBarIcon": "Show sidebar workspace icons", "HideSideBarIconDetail": "Hide the icon and only display the name of the workspace to make the workspace list more compact", "OpenV8CacheFolder": "Open the V8 cache folder", "OpenV8CacheFolderDetail": "The V8 cache folder stores cached files that accelerate application startup", diff --git a/localization/locales/zh_CN/translation.json b/localization/locales/zh_CN/translation.json index 451256b1..c58ef7ce 100644 --- a/localization/locales/zh_CN/translation.json +++ b/localization/locales/zh_CN/translation.json @@ -316,7 +316,7 @@ "SyncIntervalDescription": "每经过这段长度的时间后,就会自动开始备份到 Github,如果工作区是本地工作区则会创建本地备份(重启后生效)", "General": "界面和交互", "ShowSideBarDetail": "侧边栏让你可以在工作区之间快速切换", - "ShowSideBarShortcut": "展示侧边栏的快捷方式", + "ShowSideBarText": "展示侧边栏上按钮的文本", "OpenLogFolder": "打开Log文件夹", "OpenLogFolderDetail": "上报问题时,请打开日期最新的一个 .log 文件,将其内容发送给开发者,或黏贴到 pastebin.com 后将 URL 黏贴到 Github Issue 里", "OpenMetaDataFolder": "打开太记工作区元信息文件夹", @@ -337,7 +337,7 @@ "LightTheme": "亮色主题", "ShowSideBar": "显示侧边栏", "HideSideBar": "隐藏侧边栏", - "HideSideBarIcon": "隐藏侧边栏工作区图标", + "ShowSideBarIcon": "展示侧边栏工作区图标", "HideSideBarIconDetail": "隐藏图标只显示工作区的名字,让工作区列表更紧凑", "SystemDefaultTheme": "系统默认主题色", "Theme": "主题色", diff --git a/src/components/PageIconAndSelector/PageSelectorBase.tsx b/src/components/PageIconAndSelector/PageSelectorBase.tsx index d9158d03..91da10b7 100644 --- a/src/components/PageIconAndSelector/PageSelectorBase.tsx +++ b/src/components/PageIconAndSelector/PageSelectorBase.tsx @@ -120,7 +120,6 @@ const Badge = styled(BadgeRaw)` interface Props { active?: boolean; badgeCount?: number; - hideSideBarIcon: boolean; icon: React.ReactNode; id: string; index?: number; @@ -129,15 +128,16 @@ interface Props { pageCount?: number; pageName?: string; picturePath?: string | null; - showSidebarShortcutHints?: boolean; + showSideBarIcon: boolean; + showSidebarTexts?: boolean; } export function PageSelectorBase({ active = false, badgeCount = 0, - hideSideBarIcon = false, + showSideBarIcon = true, id, index = 0, - showSidebarShortcutHints = false, + showSidebarTexts = false, pageName, pageClickedLoading = false, onClick = () => {}, @@ -159,20 +159,20 @@ export function PageSelectorBase({ pageCount={pageCount} > - {!hideSideBarIcon && ( + {showSideBarIcon && ( - + {icon} )} - {(showSidebarShortcutHints || hideSideBarIcon) && ( + {(showSidebarTexts || showSideBarIcon) && ( {id === 'add' ? t('WorkspaceSelector.Add') : (id === 'guide' ? t('WorkspaceSelector.Guide') : shortPageName)} diff --git a/src/components/PageIconAndSelector/SortablePageSelectorButton.tsx b/src/components/PageIconAndSelector/SortablePageSelectorButton.tsx index 21a43c8e..a4af7a12 100644 --- a/src/components/PageIconAndSelector/SortablePageSelectorButton.tsx +++ b/src/components/PageIconAndSelector/SortablePageSelectorButton.tsx @@ -9,14 +9,14 @@ import { getBuildInPageIcon } from './getBuildInPageIcon'; import { PageSelectorBase } from './PageSelectorBase'; export interface ISortableItemProps { - hideSideBarIcon: boolean; + showSideBarIcon: boolean; index: number; page: IPage; pageCount: number; - showSidebarShortcutHints: boolean; + showSidebarTexts: boolean; } -export function SortablePageSelectorButton({ index, page, showSidebarShortcutHints, pageCount, hideSideBarIcon }: ISortableItemProps): JSX.Element { +export function SortablePageSelectorButton({ index, page, showSidebarTexts, pageCount, showSideBarIcon }: ISortableItemProps): JSX.Element { const { t } = useTranslation(); const { active, id, type } = page; const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id }); @@ -48,14 +48,14 @@ export function SortablePageSelectorButton({ index, page, showSidebarShortcutHin icon={icon} pageClickedLoading={pageClickedLoading} pageCount={pageCount} - hideSideBarIcon={hideSideBarIcon} + showSideBarIcon={showSideBarIcon} onClick={onPageClick} active={active} id={id} key={id} pageName={name} index={index} - showSidebarShortcutHints={showSidebarShortcutHints} + showSidebarTexts={showSidebarTexts} /> ); diff --git a/src/components/PageIconAndSelector/SortablePageSelectorList.tsx b/src/components/PageIconAndSelector/SortablePageSelectorList.tsx index 75c3d9e1..4cb1c781 100644 --- a/src/components/PageIconAndSelector/SortablePageSelectorList.tsx +++ b/src/components/PageIconAndSelector/SortablePageSelectorList.tsx @@ -5,12 +5,12 @@ import { IPage } from '@services/pages/interface'; import { SortablePageSelectorButton } from './SortablePageSelectorButton'; export interface ISortableListProps { - hideSideBarIcon: boolean; + showSideBarIcon: boolean; pagesList: IPage[]; - sidebarShortcutHints: boolean; + showSideBarText: boolean; } -export function SortablePageSelectorList({ pagesList, sidebarShortcutHints, hideSideBarIcon }: ISortableListProps): JSX.Element { +export function SortablePageSelectorList({ pagesList, showSideBarText, showSideBarIcon }: ISortableListProps): JSX.Element { const dndSensors = useSensors( useSensor(PointerSensor, { activationConstraint: { @@ -48,8 +48,8 @@ export function SortablePageSelectorList({ pagesList, sidebarShortcutHints, hide key={`item-${page.id}`} index={index} page={page} - showSidebarShortcutHints={sidebarShortcutHints} - hideSideBarIcon={hideSideBarIcon} + showSidebarTexts={showSideBarText} + showSideBarIcon={showSideBarIcon} pageCount={pageIDs.length} /> ))} diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index ca57987e..ba7772d7 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -91,28 +91,28 @@ export function SideBar(): JSX.Element { const updaterMetaData = useUpdaterObservable(); if (preferences === undefined) return
{t('Loading')}
; - const { sidebarShortcutHints, hideSideBarIcon } = preferences; + const { showSideBarText, showSideBarIcon } = preferences; return ( {workspacesList === undefined ?
{t('Loading')}
- : } + : } void window.service.window.open(WindowNames.addWorkspace)} /> {pagesList === undefined ?
{t('Loading')}
: ( )}
diff --git a/src/components/WorkspaceIconAndSelector/SortableWorkspaceSelector.tsx b/src/components/WorkspaceIconAndSelector/SortableWorkspaceSelector.tsx index 3bc4cb04..2fe6c89e 100644 --- a/src/components/WorkspaceIconAndSelector/SortableWorkspaceSelector.tsx +++ b/src/components/WorkspaceIconAndSelector/SortableWorkspaceSelector.tsx @@ -9,14 +9,14 @@ import { WorkspaceSelector } from './WorkspaceSelector'; import defaultIcon from '@/images/default-icon.png'; export interface ISortableItemProps { - hideSideBarIcon: boolean; + showSideBarIcon: boolean; index: number; - showSidebarShortcutHints: boolean; + showSidebarTexts: boolean; workspace: IWorkspace; workspaceCount: number; } -export function SortableWorkspaceSelector({ index, workspace, showSidebarShortcutHints, workspaceCount, hideSideBarIcon }: ISortableItemProps): JSX.Element { +export function SortableWorkspaceSelector({ index, workspace, showSidebarTexts, workspaceCount, showSideBarIcon }: ISortableItemProps): JSX.Element { const { t } = useTranslation(); const { active, id, name, picturePath, hibernated, transparentBackground } = workspace; const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id }); @@ -50,7 +50,7 @@ export function SortableWorkspaceSelector({ index, workspace, showSidebarShortcu ); diff --git a/src/components/WorkspaceIconAndSelector/SortableWorkspaceSelectorList.tsx b/src/components/WorkspaceIconAndSelector/SortableWorkspaceSelectorList.tsx index 37be8006..6ab74fa4 100644 --- a/src/components/WorkspaceIconAndSelector/SortableWorkspaceSelectorList.tsx +++ b/src/components/WorkspaceIconAndSelector/SortableWorkspaceSelectorList.tsx @@ -5,12 +5,12 @@ import { IWorkspace, IWorkspaceWithMetadata } from '@services/workspaces/interfa import { SortableWorkspaceSelector } from './SortableWorkspaceSelector'; export interface ISortableListProps { - hideSideBarIcon: boolean; - sidebarShortcutHints: boolean; + showSideBarIcon: boolean; + showSideBarText: boolean; workspacesList: IWorkspaceWithMetadata[]; } -export function SortableWorkspaceSelectorList({ workspacesList, sidebarShortcutHints, hideSideBarIcon }: ISortableListProps): JSX.Element { +export function SortableWorkspaceSelectorList({ workspacesList, showSideBarText, showSideBarIcon }: ISortableListProps): JSX.Element { const dndSensors = useSensors( useSensor(PointerSensor, { activationConstraint: { @@ -48,8 +48,8 @@ export function SortableWorkspaceSelectorList({ workspacesList, sidebarShortcutH key={`item-${workspace.id}`} index={index} workspace={workspace} - showSidebarShortcutHints={sidebarShortcutHints} - hideSideBarIcon={hideSideBarIcon} + showSidebarTexts={showSideBarText} + showSideBarIcon={showSideBarIcon} workspaceCount={workspaceIDs.length} /> ))} diff --git a/src/components/WorkspaceIconAndSelector/WorkspaceSelector.tsx b/src/components/WorkspaceIconAndSelector/WorkspaceSelector.tsx index fad39400..04ed3e69 100644 --- a/src/components/WorkspaceIconAndSelector/WorkspaceSelector.tsx +++ b/src/components/WorkspaceIconAndSelector/WorkspaceSelector.tsx @@ -133,12 +133,12 @@ interface Props { active?: boolean; badgeCount?: number; hibernated?: boolean; - hideSideBarIcon: boolean; + showSideBarIcon: boolean; id: string; index?: number; onClick?: () => void; picturePath?: string | null; - showSidebarShortcutHints?: boolean; + showSidebarTexts?: boolean; transparentBackground?: boolean; workspaceClickedLoading?: boolean; workspaceCount?: number; @@ -148,11 +148,11 @@ export function WorkspaceSelector({ active = false, badgeCount = 0, hibernated = false, - hideSideBarIcon = false, + showSideBarIcon = true, id, index = 0, picturePath, - showSidebarShortcutHints = false, + showSidebarTexts = false, transparentBackground = false, workspaceName, workspaceClickedLoading = false, @@ -175,9 +175,9 @@ export function WorkspaceSelector({ workspaceCount={workspaceCount} > - {!hideSideBarIcon && ( + {showSideBarIcon && ( )} + : )} )} - {(showSidebarShortcutHints || hideSideBarIcon) && ( + {(showSidebarTexts || showSideBarIcon) && ( {id === 'add' ? t('WorkspaceSelector.Add') : (id === 'guide' ? t('WorkspaceSelector.Guide') : shortWorkspaceName)} diff --git a/src/pages/Preferences/sections/General.tsx b/src/pages/Preferences/sections/General.tsx index 810c809b..7b9a738d 100644 --- a/src/pages/Preferences/sections/General.tsx +++ b/src/pages/Preferences/sections/General.tsx @@ -95,28 +95,35 @@ export function General(props: Required): JSX.Element { - + { - await window.service.preference.set('hideSideBarIcon', event.target.checked); + await window.service.preference.set('showSideBarIcon', event.target.checked); + // when you hide icon, show the text + if (!event.target.checked && !preference.showSideBarText) { + await window.service.preference.set('showSideBarText', true); + } }} /> - - + { - await window.service.preference.set('sidebarShortcutHints', event.target.checked); + await window.service.preference.set('showSideBarText', event.target.checked); + // when you hide text, show the icon + if (!event.target.checked && !preference.showSideBarIcon) { + await window.service.preference.set('showSideBarIcon', true); + } }} /> diff --git a/src/services/preferences/defaultPreferences.ts b/src/services/preferences/defaultPreferences.ts index 9ca81f7f..7df80719 100644 --- a/src/services/preferences/defaultPreferences.ts +++ b/src/services/preferences/defaultPreferences.ts @@ -11,7 +11,7 @@ export const defaultPreferences: IPreferences = { downloadPath: DEFAULT_DOWNLOADS_PATH, hibernateUnusedWorkspacesAtLaunch: false, hideMenuBar: false, - hideSideBarIcon: false, + showSideBarIcon: true, ignoreCertificateErrors: false, language: 'zh_CN', languageModel: { @@ -31,7 +31,7 @@ export const defaultPreferences: IPreferences = { rememberLastPageVisited: true, shareWorkspaceBrowsingData: false, sidebar: true, - sidebarShortcutHints: true, + showSideBarText: true, spellcheck: true, spellcheckLanguages: ['en-US'], swipeToNavigate: true, diff --git a/src/services/preferences/interface.ts b/src/services/preferences/interface.ts index 29ab789f..2c03d49d 100644 --- a/src/services/preferences/interface.ts +++ b/src/services/preferences/interface.ts @@ -13,7 +13,7 @@ export interface IPreferences { downloadPath: string; hibernateUnusedWorkspacesAtLaunch: boolean; hideMenuBar: boolean; - hideSideBarIcon: boolean; + showSideBarIcon: boolean; ignoreCertificateErrors: boolean; language: string; languageModel: ILanguageModelPreferences; @@ -26,7 +26,7 @@ export interface IPreferences { rememberLastPageVisited: boolean; shareWorkspaceBrowsingData: boolean; sidebar: boolean; - sidebarShortcutHints: boolean; + showSideBarText: boolean; spellcheck: boolean; spellcheckLanguages: HunspellLanguages[]; swipeToNavigate: boolean;