Skip to content

Commit 7ba07ad

Browse files
committed
feat: zen mode and hide extra badge
Signed-off-by: Innei <tukon479@gmail.com>
1 parent dcbae89 commit 7ba07ad

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

apps/renderer/src/atoms/settings/ui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export const createDefaultSettings = (): UISettings => ({
88
// Sidebar
99
entryColWidth: 356,
1010
feedColWidth: 256,
11+
hideExtraBadge: false,
1112

1213
opaqueSidebar: false,
1314
sidebarShowUnreadCount: true,
14-
hideExtraBadge: false,
1515

1616
// Global UI
1717
uiTextSize: 16,

apps/renderer/src/modules/feed-column/item.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { memo, useCallback, useState } from "react"
1616
import { useTranslation } from "react-i18next"
1717

1818
import { getMainContainerElement } from "~/atoms/dom"
19+
import { useUISettingKey } from "~/atoms/settings/ui"
1920
import { useFeedActions, useInboxActions, useListActions } from "~/hooks/biz/useFeedActions"
2021
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
2122
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
@@ -94,6 +95,7 @@ const FeedItemImpl = ({ view, feedId, className }: FeedItemProps) => {
9495
useAnyPointDown(() => {
9596
isContextMenuOpen && setIsContextMenuOpen(false)
9697
})
98+
const hideExtraBadge = useUISettingKey("hideExtraBadge")
9799
if (!feed) return null
98100

99101
const isFeed = feed.type === "feed" || !feed.type
@@ -160,8 +162,8 @@ const FeedItemImpl = ({ view, feedId, className }: FeedItemProps) => {
160162
>
161163
<FeedIcon fallback feed={feed} size={16} />
162164
<div className="truncate">{getPreferredTitle(feed)}</div>
163-
{isFeed && <FeedCertification feed={feed} className="text-[15px]" />}
164-
{isFeed && <BoostCertification feed={feed} className="text-[15px]" />}
165+
{isFeed && !hideExtraBadge && <FeedCertification feed={feed} className="text-[15px]" />}
166+
{isFeed && !hideExtraBadge && <BoostCertification feed={feed} className="text-[15px]" />}
165167
{isFeed && feed.errorAt && (
166168
<Tooltip delayDuration={300}>
167169
<TooltipTrigger asChild>

apps/renderer/src/modules/settings/tabs/apperance.tsx

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ import {
1717
useUISettingSelector,
1818
useUISettingValue,
1919
} from "~/atoms/settings/ui"
20+
import { setFeedColumnShow, useFeedColumnShow } from "~/atoms/sidebar"
2021
import { isElectronBuild } from "~/constants"
2122
import { useSetTheme } from "~/hooks/common"
2223

23-
import { SettingTabbedSegment } from "../control"
24+
import { SettingDescription, SettingSwitch, SettingTabbedSegment } from "../control"
2425
import { createDefineSettingItem } from "../helper/builder"
2526
import { createSettingBuilder } from "../helper/setting-builder"
27+
import { SettingItemGroup } from "../section"
2628
import { ContentFontSelector, UIFontSelector } from "../sections/fonts"
2729

2830
const SettingBuilder = createSettingBuilder(useUISettingValue)
@@ -59,6 +61,16 @@ export const SettingAppearance = () => {
5961
label: t("appearance.sidebar_show_unread_count.label"),
6062
}),
6163

64+
{
65+
type: "title",
66+
value: t("appearance.sidebar"),
67+
},
68+
defineItem("hideExtraBadge", {
69+
label: t("appearance.hide_extra_badge.label"),
70+
description: t("appearance.hide_extra_badge.description"),
71+
}),
72+
ZenMode,
73+
6274
{
6375
type: "title",
6476
value: t("appearance.fonts"),
@@ -217,3 +229,28 @@ export const AppThemeSegment = () => {
217229
/>
218230
)
219231
}
232+
233+
const ZenMode = () => {
234+
const { t } = useTranslation("settings")
235+
const feedColumnShow = useFeedColumnShow()
236+
const isWideMode = useUISettingKey("wideMode")
237+
return (
238+
<SettingItemGroup>
239+
<SettingSwitch
240+
checked={!feedColumnShow && isWideMode}
241+
className="mt-4"
242+
onCheckedChange={(checked) => {
243+
if (checked) {
244+
setFeedColumnShow(false)
245+
setUISetting("wideMode", true)
246+
} else {
247+
setFeedColumnShow(true)
248+
setUISetting("wideMode", false)
249+
}
250+
}}
251+
label={t("appearance.zen_mode.label")}
252+
/>
253+
<SettingDescription>{t("appearance.zen_mode.description")}</SettingDescription>
254+
</SettingItemGroup>
255+
)
256+
}

locales/settings/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
"appearance.general": "General",
5959
"appearance.guess_code_language.description": "Major programming languages that use models to infer unlabeled code blocks",
6060
"appearance.guess_code_language.label": "Guess code language",
61+
"appearance.hide_extra_badge.description": "Hide the special badge of the feed in the sidebar, e.g. Boost,Claimed",
62+
"appearance.hide_extra_badge.label": "Hide special badge",
6163
"appearance.hide_recent_reader.description": "Hide the recent reader in the entry header.",
6264
"appearance.hide_recent_reader.label": "Hide recent reader",
6365
"appearance.misc": "Misc",
@@ -70,6 +72,7 @@
7072
"appearance.reduce_motion.label": "Reduce motion",
7173
"appearance.save": "Save",
7274
"appearance.show_dock_badge.label": "Show as Dock badge",
75+
"appearance.sidebar": "Sidebar",
7376
"appearance.sidebar_show_unread_count.label": "Show in sidebar",
7477
"appearance.sidebar_title": "Appearance",
7578
"appearance.text_size": "Text size",
@@ -82,6 +85,8 @@
8285
"appearance.unread_count": "Unread count",
8386
"appearance.use_pointer_cursor.description": "Change the cursor to a pointer when hovering over any interactive element.",
8487
"appearance.use_pointer_cursor.label": "Use pointer cursors",
88+
"appearance.zen_mode.description": "Zen mode is an undisturbed reading mode that allows you to focus on the content without any interference. Enabling Zen mode will hide the sidebar.",
89+
"appearance.zen_mode.label": "Zen mode",
8590
"common.give_star": "<HeartIcon />Love our product? <Link>Give us a star on GitHub!</Link>",
8691
"feeds.claimTips": "To claim your feeds and receive tips, right-click on the feed in your subscription list and select Claim.",
8792
"feeds.noFeeds": "No claimed feeds",

0 commit comments

Comments
 (0)