mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-04 00:25:17 +00:00
Added label to box for statistic while loading.
This commit is contained in:
BIN
Telegram/Resources/animations/stats.tgs
Normal file
BIN
Telegram/Resources/animations/stats.tgs
Normal file
Binary file not shown.
@@ -4068,6 +4068,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
"lng_stats_title" = "Statistics";
|
"lng_stats_title" = "Statistics";
|
||||||
"lng_stats_zoom_out" = "Zoom Out";
|
"lng_stats_zoom_out" = "Zoom Out";
|
||||||
|
|
||||||
|
"lng_stats_loading" = "Loading stats...";
|
||||||
|
"lng_stats_loading_subtext" = "Please wait a few moments while we generate your stats.";
|
||||||
|
|
||||||
"lng_chart_title_member_count" = "Growth";
|
"lng_chart_title_member_count" = "Growth";
|
||||||
"lng_chart_title_join" = "Followers";
|
"lng_chart_title_join" = "Followers";
|
||||||
"lng_chart_title_mute" = "Notifications";
|
"lng_chart_title_mute" = "Notifications";
|
||||||
|
@@ -10,5 +10,6 @@
|
|||||||
<file alias="cloud_password/email.tgs">../../animations/cloud_password/email.tgs</file>
|
<file alias="cloud_password/email.tgs">../../animations/cloud_password/email.tgs</file>
|
||||||
<file alias="ttl.tgs">../../animations/ttl.tgs</file>
|
<file alias="ttl.tgs">../../animations/ttl.tgs</file>
|
||||||
<file alias="discussion.tgs">../../animations/discussion.tgs</file>
|
<file alias="discussion.tgs">../../animations/discussion.tgs</file>
|
||||||
|
<file alias="stats.tgs">../../animations/stats.tgs</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -63,3 +63,7 @@ statisticsHeaderButton: RoundButton(defaultLightButton) {
|
|||||||
textTop: 2px;
|
textTop: 2px;
|
||||||
font: font(11px semibold);
|
font: font(11px semibold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
statisticsLoadingSubtext: FlatLabel(changePhoneDescription) {
|
||||||
|
minWidth: 256px;
|
||||||
|
}
|
||||||
|
@@ -10,16 +10,71 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "api/api_statistics.h"
|
#include "api/api_statistics.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
#include "lottie/lottie_icon.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
#include "settings/settings_common.h"
|
||||||
#include "statistics/chart_widget.h"
|
#include "statistics/chart_widget.h"
|
||||||
#include "statistics/statistics_common.h"
|
#include "statistics/statistics_common.h"
|
||||||
#include "ui/toast/toast.h"
|
|
||||||
#include "ui/layers/generic_box.h"
|
#include "ui/layers/generic_box.h"
|
||||||
|
#include "ui/rect.h"
|
||||||
|
#include "ui/toast/toast.h"
|
||||||
|
#include "ui/wrap/slide_wrap.h"
|
||||||
|
#include "styles/style_boxes.h"
|
||||||
|
#include "styles/style_settings.h"
|
||||||
|
#include "styles/style_statistics.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
void FillLoading(
|
||||||
|
not_null<Ui::GenericBox*> box,
|
||||||
|
rpl::producer<bool> toggleOn) {
|
||||||
|
const auto emptyWrap = box->verticalLayout()->add(
|
||||||
|
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||||
|
box->verticalLayout(),
|
||||||
|
object_ptr<Ui::VerticalLayout>(box->verticalLayout())));
|
||||||
|
emptyWrap->toggleOn(std::move(toggleOn), anim::type::instant);
|
||||||
|
|
||||||
|
const auto content = emptyWrap->entity();
|
||||||
|
auto icon = Settings::CreateLottieIcon(
|
||||||
|
content,
|
||||||
|
{ .name = u"stats"_q, .sizeOverride = Size(st::changePhoneIconSize) },
|
||||||
|
st::settingsBlockedListIconPadding);
|
||||||
|
content->add(std::move(icon.widget));
|
||||||
|
|
||||||
|
box->setShowFinishedCallback([animate = std::move(icon.animate)] {
|
||||||
|
animate(anim::repeat::loop);
|
||||||
|
});
|
||||||
|
|
||||||
|
content->add(
|
||||||
|
object_ptr<Ui::CenterWrap<>>(
|
||||||
|
content,
|
||||||
|
object_ptr<Ui::FlatLabel>(
|
||||||
|
content,
|
||||||
|
tr::lng_stats_loading(),
|
||||||
|
st::changePhoneTitle)),
|
||||||
|
st::changePhoneTitlePadding + st::boxRowPadding);
|
||||||
|
|
||||||
|
content->add(
|
||||||
|
object_ptr<Ui::CenterWrap<>>(
|
||||||
|
content,
|
||||||
|
object_ptr<Ui::FlatLabel>(
|
||||||
|
content,
|
||||||
|
tr::lng_stats_loading_subtext(),
|
||||||
|
st::statisticsLoadingSubtext)),
|
||||||
|
st::changePhoneDescriptionPadding + st::boxRowPadding);
|
||||||
|
|
||||||
|
Settings::AddSkip(content, st::settingsBlockedListIconPadding.top());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void StatisticsBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
void StatisticsBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||||
|
|
||||||
|
const auto loaded = box->lifetime().make_state<rpl::event_stream<bool>>();
|
||||||
|
FillLoading(
|
||||||
|
box,
|
||||||
|
loaded->events_starting_with(false) | rpl::map(!rpl::mappers::_1));
|
||||||
|
|
||||||
const auto chartWidget = box->addRow(
|
const auto chartWidget = box->addRow(
|
||||||
object_ptr<Statistic::ChartWidget>(box));
|
object_ptr<Statistic::ChartWidget>(box));
|
||||||
const auto chartWidget2 = box->addRow(
|
const auto chartWidget2 = box->addRow(
|
||||||
@@ -98,6 +153,7 @@ void StatisticsBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
|||||||
if (!stats) {
|
if (!stats) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
loaded->fire(true);
|
||||||
using Type = Statistic::ChartViewType;
|
using Type = Statistic::ChartViewType;
|
||||||
processChart(
|
processChart(
|
||||||
chartWidget,
|
chartWidget,
|
||||||
|
Reference in New Issue
Block a user