This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
The following commit(s) were added to refs/heads/dev by this push:
new b6a23d69 feat: add loading state for counts display in search results
b6a23d69 is described below
commit b6a23d69d6415e35e186b56cf3d85ca8b6bcbb0c
Author: Luffy <[email protected]>
AuthorDate: Tue Jun 3 18:27:41 2025 +0800
feat: add loading state for counts display in search results
---
i18n/en_US.yaml | 1 +
i18n/zh_CN.yaml | 1 +
ui/src/components/Header/index.tsx | 1 -
ui/src/pages/Search/components/SearchHead/index.tsx | 6 +++++-
ui/src/pages/Search/index.tsx | 2 +-
5 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml
index cb05e5e1..1791d85c 100644
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@ -1534,6 +1534,7 @@ ui:
follow: Follow
following: Following
counts: "{{count}} Results"
+ counts_loading: "... Results"
more: More
sort_btns:
relevance: Relevance
diff --git a/i18n/zh_CN.yaml b/i18n/zh_CN.yaml
index 9852ba60..6b153e0a 100644
--- a/i18n/zh_CN.yaml
+++ b/i18n/zh_CN.yaml
@@ -1501,6 +1501,7 @@ ui:
follow: 关注
following: 已关注
counts: "{{count}} 个结果"
+ counts_loading: "... 个结果"
more: 更多
sort_btns:
relevance: 相关性
diff --git a/ui/src/components/Header/index.tsx
b/ui/src/components/Header/index.tsx
index 0b015ba6..dbc7565d 100644
--- a/ui/src/components/Header/index.tsx
+++ b/ui/src/components/Header/index.tsx
@@ -87,7 +87,6 @@ const Header: FC = () => {
if (theme_config?.[theme]?.navbar_style) {
// const color = theme_config[theme].navbar_style.startsWith('#')
themeMode = isLight(theme_config[theme].navbar_style) ? 'light' : 'dark';
- console.log('isLightTheme', themeMode);
navbarStyle = `theme-${themeMode}`;
}
diff --git a/ui/src/pages/Search/components/SearchHead/index.tsx
b/ui/src/pages/Search/components/SearchHead/index.tsx
index a175d381..1bbb6b01 100644
--- a/ui/src/pages/Search/components/SearchHead/index.tsx
+++ b/ui/src/pages/Search/components/SearchHead/index.tsx
@@ -35,7 +35,11 @@ const Index: FC<Props> = ({ sort, count = 0 }) => {
return (
<div className="d-flex flex-wrap align-items-center
justify-content-between pt-2 pb-3">
- <h5 className="mb-0">{t('counts', { count, keyPrefix: 'search' })}</h5>
+ <h5 className="mb-0">
+ {count === -1
+ ? t('counts_loading', { keyPrefix: 'search' })
+ : t('counts', { count, keyPrefix: 'search' })}
+ </h5>
<QueryGroup
data={sortBtns}
currentSort={sort}
diff --git a/ui/src/pages/Search/index.tsx b/ui/src/pages/Search/index.tsx
index 3eeb0ec9..8b6cc1e2 100644
--- a/ui/src/pages/Search/index.tsx
+++ b/ui/src/pages/Search/index.tsx
@@ -106,7 +106,7 @@ const Index = () => {
<Row className="pt-4 mb-5">
<Col className="page-main flex-auto">
<Head data={extra} />
- <SearchHead sort={order} count={count} />
+ <SearchHead sort={order} count={isLoading ? -1 : count} />
<ListGroup className="rounded-0 mb-5">
{isSkeletonShow ? (
<ListLoader />