Skip to content

Commit b6a23d6

Browse files
sy-recordsshuashuai
authored andcommitted
feat: add loading state for counts display in search results
1 parent eddedfd commit b6a23d6

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

i18n/en_US.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,7 @@ ui:
15341534
follow: Follow
15351535
following: Following
15361536
counts: "{{count}} Results"
1537+
counts_loading: "... Results"
15371538
more: More
15381539
sort_btns:
15391540
relevance: Relevance

i18n/zh_CN.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,6 +1501,7 @@ ui:
15011501
follow: 关注
15021502
following: 已关注
15031503
counts: "{{count}} 个结果"
1504+
counts_loading: "... 个结果"
15041505
more: 更多
15051506
sort_btns:
15061507
relevance: 相关性

ui/src/components/Header/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ const Header: FC = () => {
8787
if (theme_config?.[theme]?.navbar_style) {
8888
// const color = theme_config[theme].navbar_style.startsWith('#')
8989
themeMode = isLight(theme_config[theme].navbar_style) ? 'light' : 'dark';
90-
console.log('isLightTheme', themeMode);
9190
navbarStyle = `theme-${themeMode}`;
9291
}
9392

ui/src/pages/Search/components/SearchHead/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ const Index: FC<Props> = ({ sort, count = 0 }) => {
3535

3636
return (
3737
<div className="d-flex flex-wrap align-items-center justify-content-between pt-2 pb-3">
38-
<h5 className="mb-0">{t('counts', { count, keyPrefix: 'search' })}</h5>
38+
<h5 className="mb-0">
39+
{count === -1
40+
? t('counts_loading', { keyPrefix: 'search' })
41+
: t('counts', { count, keyPrefix: 'search' })}
42+
</h5>
3943
<QueryGroup
4044
data={sortBtns}
4145
currentSort={sort}

ui/src/pages/Search/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const Index = () => {
106106
<Row className="pt-4 mb-5">
107107
<Col className="page-main flex-auto">
108108
<Head data={extra} />
109-
<SearchHead sort={order} count={count} />
109+
<SearchHead sort={order} count={isLoading ? -1 : count} />
110110
<ListGroup className="rounded-0 mb-5">
111111
{isSkeletonShow ? (
112112
<ListLoader />

0 commit comments

Comments
 (0)