show unread count on mobile only

This commit is contained in:
Athou
2026-02-21 22:52:32 +01:00
parent b0579a70d8
commit 824c38f8ce

View File

@@ -12,6 +12,7 @@ import { useAppDispatch, useAppSelector } from "@/app/store"
import { categoryHasNewEntries, categoryUnreadCount, flattenCategoryTree } from "@/app/utils" import { categoryHasNewEntries, categoryUnreadCount, flattenCategoryTree } from "@/app/utils"
import { FeedEntries } from "@/components/content/FeedEntries" import { FeedEntries } from "@/components/content/FeedEntries"
import { UnreadCount } from "@/components/sidebar/UnreadCount" import { UnreadCount } from "@/components/sidebar/UnreadCount"
import { useMobile } from "@/hooks/useMobile"
import { tss } from "@/tss" import { tss } from "@/tss"
function NoSubscriptionHelp() { function NoSubscriptionHelp() {
@@ -49,6 +50,8 @@ export function FeedEntriesPage(props: Readonly<FeedEntriesPageProps>) {
const sourceLabel = useAppSelector(state => state.entries.sourceLabel) const sourceLabel = useAppSelector(state => state.entries.sourceLabel)
const sourceWebsiteUrl = useAppSelector(state => state.entries.sourceWebsiteUrl) const sourceWebsiteUrl = useAppSelector(state => state.entries.sourceWebsiteUrl)
const hasMore = useAppSelector(state => state.entries.hasMore) const hasMore = useAppSelector(state => state.entries.hasMore)
const mobile = useMobile()
const sidebarVisible = useAppSelector(state => state.tree.sidebarVisible)
const unreadCount = useAppSelector(state => { const unreadCount = useAppSelector(state => {
const root = state.tree.rootCategory const root = state.tree.rootCategory
if (!root) return 0 if (!root) return 0
@@ -83,6 +86,7 @@ export function FeedEntriesPage(props: Readonly<FeedEntriesPageProps>) {
} }
return false return false
}) })
const showUnreadCount = mobile || !sidebarVisible
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
let title: React.ReactNode = sourceLabel let title: React.ReactNode = sourceLabel
@@ -124,19 +128,17 @@ export function FeedEntriesPage(props: Readonly<FeedEntriesPageProps>) {
return ( return (
// add some room at the bottom of the page in order to be able to scroll the current entry at the top of the page when expanding // add some room at the bottom of the page in order to be able to scroll the current entry at the top of the page when expanding
<Box mb={viewport.height * 0.7}> <Box mb={viewport.height * 0.7}>
<Group gap="xl" className="cf-entries-title"> <Group className="cf-entries-title">
<Group gap="xs">
{sourceWebsiteUrl && ( {sourceWebsiteUrl && (
<a href={sourceWebsiteUrl} target="_blank" rel="noreferrer" className={classes.sourceWebsiteLink}> <a href={sourceWebsiteUrl} target="_blank" rel="noreferrer" className={classes.sourceWebsiteLink}>
<Title order={3}>{title}</Title> <Title order={3}>{title}</Title>
</a> </a>
)} )}
{!sourceWebsiteUrl && <Title order={3}>{title}</Title>} {!sourceWebsiteUrl && <Title order={3}>{title}</Title>}
<UnreadCount unreadCount={unreadCount} showIndicator={hasNewEntries} />
</Group>
<ActionIcon onClick={titleClicked} variant="subtle" color={theme.primaryColor}> <ActionIcon onClick={titleClicked} variant="subtle" color={theme.primaryColor}>
<TbEdit size={18} /> <TbEdit size={18} />
</ActionIcon> </ActionIcon>
{showUnreadCount && <UnreadCount unreadCount={unreadCount} showIndicator={hasNewEntries} />}
</Group> </Group>
<FeedEntries /> <FeedEntries />