@@ -23,7 +23,13 @@ import SidebarTrigger from "./SidebarTrigger.jsx"
23
23
import CustomTooltip from "@/components/ui/CustomTooltip"
24
24
import { polyglotState } from "@/hooks/useLanguage"
25
25
import useScreenWidth from "@/hooks/useScreenWidth"
26
- import { contentState , setFilterDate , setFilterString , setFilterType } from "@/store/contentState"
26
+ import {
27
+ contentState ,
28
+ dynamicCountState ,
29
+ setFilterDate ,
30
+ setFilterString ,
31
+ setFilterType ,
32
+ } from "@/store/contentState"
27
33
import { categoriesState , feedsState } from "@/store/dataState"
28
34
import { settingsState , updateSettings } from "@/store/settingsState"
29
35
import { getStartOfToday } from "@/utils/date"
@@ -134,11 +140,12 @@ const ActiveButton = ({ active, icon, tooltip, onClick }) => (
134
140
)
135
141
136
142
const SearchAndSortBar = ( ) => {
137
- const { filterDate, filterString, infoFrom, isArticleListReady, total } = useStore ( contentState )
143
+ const { filterDate, filterString, infoFrom, isArticleListReady } = useStore ( contentState )
138
144
const { orderDirection, showStatus } = useStore ( settingsState )
139
145
const { polyglot } = useStore ( polyglotState )
140
146
const feeds = useStore ( feedsState )
141
147
const categories = useStore ( categoriesState )
148
+ const dynamicCount = useStore ( dynamicCountState )
142
149
143
150
const location = useLocation ( )
144
151
const { id } = useParams ( )
@@ -152,24 +159,24 @@ const SearchAndSortBar = () => {
152
159
if ( id ) {
153
160
if ( infoFrom === "category" ) {
154
161
const category = categories . find ( ( c ) => c . id === Number ( id ) )
155
- return { title : category ?. title , count : total }
162
+ return { title : category ?. title , count : dynamicCount }
156
163
}
157
164
if ( infoFrom === "feed" ) {
158
165
const feed = feeds . find ( ( f ) => f . id === Number ( id ) )
159
- return { title : feed ?. title , count : total }
166
+ return { title : feed ?. title , count : dynamicCount }
160
167
}
161
168
}
162
169
163
170
const infoMap = {
164
- all : { key : "sidebar.all" , count : total } ,
165
- today : { key : "sidebar.today" , count : total } ,
166
- starred : { key : "sidebar.starred" , count : total } ,
167
- history : { key : "sidebar.history" , count : total } ,
171
+ all : { key : "sidebar.all" , count : dynamicCount } ,
172
+ today : { key : "sidebar.today" , count : dynamicCount } ,
173
+ starred : { key : "sidebar.starred" , count : dynamicCount } ,
174
+ history : { key : "sidebar.history" , count : dynamicCount } ,
168
175
}
169
176
170
177
const info = infoMap [ infoFrom ] || { key : "" , count : 0 }
171
178
return { title : info . key ? polyglot . t ( info . key ) : "" , count : info . count }
172
- } , [ infoFrom , id , categories , feeds , total , polyglot ] )
179
+ } , [ infoFrom , id , categories , feeds , dynamicCount , polyglot ] )
173
180
174
181
const toggleOrderDirection = ( ) => {
175
182
const newOrderDirection = orderDirection === "desc" ? "asc" : "desc"
0 commit comments