feat: hide view count when hideRecentReader is on (#4167)

This commit is contained in:
Cason Kervis 2025-07-14 17:08:38 +08:00 committed by GitHub
parent e803fa3d21
commit c3ed8eeb2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 8 deletions

View File

@ -65,6 +65,8 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
const navigateEntry = useNavigateEntry()
const hideRecentReader = useUISettingKey("hideRecentReader")
if (!entry) return null
return compact ? (
@ -132,7 +134,7 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
(entryHistory?.readCount ?? 0) +
(entryHistory?.userIds?.every((id) => id !== user?.id) ? 1 : 0)
return readCount > 0 ? (
return readCount > 0 && !hideRecentReader ? (
<div className="flex items-center gap-1.5">
<i className="i-mgc-eye-2-cute-re text-base" />
<span className="text-xs tabular-nums">{readCount.toLocaleString()}</span>

View File

@ -1,5 +1,5 @@
import { FeedViewType } from "@follow/constants"
import { useEntry, usePrefetchEntryDetail } from "@follow/store/entry/hooks"
import { useEntry, useEntryReadHistory, usePrefetchEntryDetail } from "@follow/store/entry/hooks"
import { entrySyncServices } from "@follow/store/entry/store"
import { useFeedById } from "@follow/store/feed/hooks"
import { usePrefetchEntryTranslation } from "@follow/store/translation/hooks"
@ -12,6 +12,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context"
import { useColor } from "react-native-uikit-colors"
import { useActionLanguage, useGeneralSettingKey } from "@/src/atoms/settings/general"
import { useUISettingKey } from "@/src/atoms/settings/ui"
import { BottomTabBarHeightContext } from "@/src/components/layouts/tabbar/contexts/BottomTabBarHeightContext"
import { SafeNavigationScrollView } from "@/src/components/layouts/views/SafeNavigationScrollView"
import { EntryContentWebView } from "@/src/components/native/webview/EntryContentWebView"
@ -181,6 +182,9 @@ const EntryInfo = ({ entryId }: { entryId: string }) => {
const feed = useFeedById(entry?.feedId)
const secondaryLabelColor = useColor("secondaryLabel")
const readCount = useEntryReadHistory(entryId)?.entryReadHistories?.readCount
const hideRecentReader = useUISettingKey("hideRecentReader")
if (!entry) return null
const { publishedAt } = entry
@ -202,6 +206,11 @@ const EntryInfo = ({ entryId }: { entryId: string }) => {
className="text-secondary-label text-sm leading-tight"
/>
</View>
{!hideRecentReader && (
<View className="flex flex-row items-center gap-1">
<Text className="text-secondary-label text-sm leading-tight">{readCount}</Text>
</View>
)}
</View>
)
}

View File

@ -120,8 +120,8 @@
"appearance.guess_code_language.label": "Guess Code Language",
"appearance.hide_extra_badge.description": "Hide the Special Badge of the Feed in the Sidebar, e.g. Boost, Claimed",
"appearance.hide_extra_badge.label": "Hide Special Badge",
"appearance.hide_recent_reader.description": "Hide the Recent Reader in the Entry Header.",
"appearance.hide_recent_reader.label": "Hide Recent Reader",
"appearance.hide_recent_reader.description": "Hide the Recent Reader and View Count in the Entry.",
"appearance.hide_recent_reader.label": "Hide Recent Readers & View Count",
"appearance.interface_window.title": "Interface & Window",
"appearance.misc": "Misc",
"appearance.modal_overlay.description": "Show Modal Overlay",

View File

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

View File

@ -2,7 +2,7 @@
/** @type {import("eslint").ESLint.Plugin} */
import fs from "node:fs"
import path from "pathe"
import path, { normalize, sep } from "pathe"
import { cleanJsonText } from "../utils.js"
@ -84,7 +84,8 @@ export default {
if (!filename.endsWith(".json")) return
const parts = filename.split(path.sep)
const parts = normalize(filename).split(sep)
// @ts-ignore
const lang = parts.at(-1).split(".")[0]
const namespace = parts.at(-2)
@ -95,6 +96,7 @@ export default {
try {
currentJson = JSON.parse(sourceCode.text)
// @ts-ignore
const englishFilePath = path.join(path.dirname(filename), "../", namespace, "en.json")
englishJson = JSON.parse(fs.readFileSync(englishFilePath, "utf8"))
} catch (error) {