2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-22 02:07:24 +00:00

Show informative empty posts search.

This commit is contained in:
John Preston 2025-08-05 16:22:02 +04:00
parent 86cffae001
commit 60f6ea3252
3 changed files with 14 additions and 1 deletions

View File

@ -117,7 +117,9 @@ void PostsSearch::pushStateUpdate(const Entry &entry) {
}
return;
}
if (!entry.pages.empty() || entry.loaded) {
const auto empty = entry.pages.empty()
|| (entry.pages.size() == 1 && entry.pages.front().empty());
if (!empty || (entry.loaded && !_query->isEmpty())) {
if (!entry.pages.empty()) {
++entry.pagesPushed;
}

View File

@ -2020,6 +2020,10 @@ void Suggestions::setupPostsIntro(const PostsSearchIntroState &intro) {
}
}, _postsSearchIntro->lifetime());
_postsScroll->heightValue() | rpl::start_with_next([=](int height) {
_postsWrap->resize(_postsWrap->width(), height);
}, _postsSearchIntro->lifetime());
_postsSearchIntro->show();
updateControlsGeometry();
}

View File

@ -198,6 +198,12 @@ void PostsSearchIntro::setup() {
_state.value(
) | rpl::start_with_next([=](const PostsSearchIntroState &state) {
if (state.query.trimmed().isEmpty()) {
_button->resize(_button->width(), 0);
_content->resizeToWidth(width());
return;
}
auto copy = _button->children();
for (const auto child : copy) {
delete child;
@ -232,6 +238,7 @@ void PostsSearchIntro::setup() {
st::resaleButtonTitle,
st::resaleButtonSubtitle);
}
_button->resize(_button->width(), st::postsSearchIntroButton.height);
_content->resizeToWidth(width());
}, _button->lifetime());
}