Skip to content

feat: add loading state for counts display in search results #1352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions i18n/en_US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,7 @@ ui:
follow: Follow
following: Following
counts: "{{count}} Results"
counts_loading: "... Results"
more: More
sort_btns:
relevance: Relevance
Expand Down
1 change: 1 addition & 0 deletions i18n/zh_CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,7 @@ ui:
follow: 关注
following: 已关注
counts: "{{count}} 个结果"
counts_loading: "... 个结果"
more: 更多
sort_btns:
relevance: 相关性
Expand Down
1 change: 0 additions & 1 deletion ui/src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}

Expand Down
6 changes: 5 additions & 1 deletion ui/src/pages/Search/components/SearchHead/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 />
Expand Down