Skip to content

Commit c3ed8ee

Browse files
authored
feat: hide view count when hideRecentReader is on (#4167)
1 parent e803fa3 commit c3ed8ee

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

apps/desktop/layer/renderer/src/modules/entry-content/components/EntryTitle.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
6565

6666
const navigateEntry = useNavigateEntry()
6767

68+
const hideRecentReader = useUISettingKey("hideRecentReader")
69+
6870
if (!entry) return null
6971

7072
return compact ? (
@@ -132,7 +134,7 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
132134
(entryHistory?.readCount ?? 0) +
133135
(entryHistory?.userIds?.every((id) => id !== user?.id) ? 1 : 0)
134136

135-
return readCount > 0 ? (
137+
return readCount > 0 && !hideRecentReader ? (
136138
<div className="flex items-center gap-1.5">
137139
<i className="i-mgc-eye-2-cute-re text-base" />
138140
<span className="text-xs tabular-nums">{readCount.toLocaleString()}</span>

apps/mobile/src/screens/(stack)/entries/[entryId]/EntryDetailScreen.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FeedViewType } from "@follow/constants"
2-
import { useEntry, usePrefetchEntryDetail } from "@follow/store/entry/hooks"
2+
import { useEntry, useEntryReadHistory, usePrefetchEntryDetail } from "@follow/store/entry/hooks"
33
import { entrySyncServices } from "@follow/store/entry/store"
44
import { useFeedById } from "@follow/store/feed/hooks"
55
import { usePrefetchEntryTranslation } from "@follow/store/translation/hooks"
@@ -12,6 +12,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context"
1212
import { useColor } from "react-native-uikit-colors"
1313

1414
import { useActionLanguage, useGeneralSettingKey } from "@/src/atoms/settings/general"
15+
import { useUISettingKey } from "@/src/atoms/settings/ui"
1516
import { BottomTabBarHeightContext } from "@/src/components/layouts/tabbar/contexts/BottomTabBarHeightContext"
1617
import { SafeNavigationScrollView } from "@/src/components/layouts/views/SafeNavigationScrollView"
1718
import { EntryContentWebView } from "@/src/components/native/webview/EntryContentWebView"
@@ -181,6 +182,9 @@ const EntryInfo = ({ entryId }: { entryId: string }) => {
181182
const feed = useFeedById(entry?.feedId)
182183
const secondaryLabelColor = useColor("secondaryLabel")
183184

185+
const readCount = useEntryReadHistory(entryId)?.entryReadHistories?.readCount
186+
const hideRecentReader = useUISettingKey("hideRecentReader")
187+
184188
if (!entry) return null
185189

186190
const { publishedAt } = entry
@@ -202,6 +206,11 @@ const EntryInfo = ({ entryId }: { entryId: string }) => {
202206
className="text-secondary-label text-sm leading-tight"
203207
/>
204208
</View>
209+
{!hideRecentReader && (
210+
<View className="flex flex-row items-center gap-1">
211+
<Text className="text-secondary-label text-sm leading-tight">{readCount}</Text>
212+
</View>
213+
)}
205214
</View>
206215
)
207216
}

locales/settings/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@
120120
"appearance.guess_code_language.label": "Guess Code Language",
121121
"appearance.hide_extra_badge.description": "Hide the Special Badge of the Feed in the Sidebar, e.g. Boost, Claimed",
122122
"appearance.hide_extra_badge.label": "Hide Special Badge",
123-
"appearance.hide_recent_reader.description": "Hide the Recent Reader in the Entry Header.",
124-
"appearance.hide_recent_reader.label": "Hide Recent Reader",
123+
"appearance.hide_recent_reader.description": "Hide the Recent Reader and View Count in the Entry.",
124+
"appearance.hide_recent_reader.label": "Hide Recent Readers & View Count",
125125
"appearance.interface_window.title": "Interface & Window",
126126
"appearance.misc": "Misc",
127127
"appearance.modal_overlay.description": "Show Modal Overlay",

locales/settings/zh-CN.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@
120120
"appearance.guess_code_language.label": "代码语言检测",
121121
"appearance.hide_extra_badge.description": "将侧边栏中订阅源的特殊徽章隐藏,例如:已助力,已认证",
122122
"appearance.hide_extra_badge.label": "隐藏徽章",
123-
"appearance.hide_recent_reader.description": "隐藏条目标题显示的最近阅读者",
124-
"appearance.hide_recent_reader.label": "隐藏最近阅读者",
123+
"appearance.hide_recent_reader.description": "隐藏条目标题显示的最近阅读者与阅读数",
124+
"appearance.hide_recent_reader.label": "隐藏最近阅读者与阅读数",
125125
"appearance.interface_window.title": "界面与窗口",
126126
"appearance.misc": "杂项",
127127
"appearance.modal_overlay.description": "显示遮罩以获得更好的使用体验,推荐开启。",

plugins/eslint/eslint-check-i18n-json.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/** @type {import("eslint").ESLint.Plugin} */
33
import fs from "node:fs"
44

5-
import path from "pathe"
5+
import path, { normalize, sep } from "pathe"
66

77
import { cleanJsonText } from "../utils.js"
88

@@ -84,7 +84,8 @@ export default {
8484

8585
if (!filename.endsWith(".json")) return
8686

87-
const parts = filename.split(path.sep)
87+
const parts = normalize(filename).split(sep)
88+
// @ts-ignore
8889
const lang = parts.at(-1).split(".")[0]
8990
const namespace = parts.at(-2)
9091

@@ -95,6 +96,7 @@ export default {
9596

9697
try {
9798
currentJson = JSON.parse(sourceCode.text)
99+
// @ts-ignore
98100
const englishFilePath = path.join(path.dirname(filename), "../", namespace, "en.json")
99101
englishJson = JSON.parse(fs.readFileSync(englishFilePath, "utf8"))
100102
} catch (error) {

0 commit comments

Comments
 (0)