mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Added chart widgets for statistic of supergroups.
This commit is contained in:
parent
cf82e12bf4
commit
17fdef7d9e
2 changed files with 85 additions and 4 deletions
|
@ -4087,6 +4087,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_chart_title_message_interaction" = "Interactions";
|
||||
"lng_chart_title_instant_view_interaction" = "IV Interactions";
|
||||
|
||||
"lng_chart_title_group_join" = "Group members";
|
||||
"lng_chart_title_group_join_by_source" = "New members by source";
|
||||
"lng_chart_title_group_language" = "Members's primary language";
|
||||
"lng_chart_title_group_message_content" = "Messages";
|
||||
"lng_chart_title_group_action" = "Actions";
|
||||
"lng_chart_title_group_day" = "Views by hours";
|
||||
"lng_chart_title_group_week" = "Top days of week";
|
||||
|
||||
// Wnd specific
|
||||
|
||||
"lng_wnd_choose_program_menu" = "Choose Default Program...";
|
||||
|
|
|
@ -166,6 +166,76 @@ void FillChannelStatistic(
|
|||
addSkip();
|
||||
}
|
||||
|
||||
void FillSupergroupStatistic(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
const Descriptor &descriptor,
|
||||
const Data::SupergroupStatistics &stats) {
|
||||
using Type = Statistic::ChartViewType;
|
||||
const auto &padding = st::statisticsChartEntryPadding;
|
||||
const auto addSkip = [&] {
|
||||
Settings::AddSkip(box->verticalLayout(), padding.bottom());
|
||||
Settings::AddDivider(box->verticalLayout());
|
||||
Settings::AddSkip(box->verticalLayout(), padding.top());
|
||||
};
|
||||
addSkip();
|
||||
ProcessChart(
|
||||
descriptor,
|
||||
box->addRow(object_ptr<Statistic::ChartWidget>(box)),
|
||||
stats.memberCountGraph,
|
||||
tr::lng_chart_title_member_count(),
|
||||
Type::Linear);
|
||||
addSkip();
|
||||
ProcessChart(
|
||||
descriptor,
|
||||
box->addRow(object_ptr<Statistic::ChartWidget>(box)),
|
||||
stats.joinGraph,
|
||||
tr::lng_chart_title_group_join(),
|
||||
Type::Linear);
|
||||
addSkip();
|
||||
ProcessChart(
|
||||
descriptor,
|
||||
box->addRow(object_ptr<Statistic::ChartWidget>(box)),
|
||||
stats.joinBySourceGraph,
|
||||
tr::lng_chart_title_group_join_by_source(),
|
||||
Type::Stack);
|
||||
addSkip();
|
||||
ProcessChart(
|
||||
descriptor,
|
||||
box->addRow(object_ptr<Statistic::ChartWidget>(box)),
|
||||
stats.languageGraph,
|
||||
tr::lng_chart_title_group_language(),
|
||||
Type::StackLinear);
|
||||
addSkip();
|
||||
ProcessChart(
|
||||
descriptor,
|
||||
box->addRow(object_ptr<Statistic::ChartWidget>(box)),
|
||||
stats.messageContentGraph,
|
||||
tr::lng_chart_title_group_message_content(),
|
||||
Type::Stack);
|
||||
addSkip();
|
||||
ProcessChart(
|
||||
descriptor,
|
||||
box->addRow(object_ptr<Statistic::ChartWidget>(box)),
|
||||
stats.actionGraph,
|
||||
tr::lng_chart_title_group_action(),
|
||||
Type::DoubleLinear);
|
||||
addSkip();
|
||||
ProcessChart(
|
||||
descriptor,
|
||||
box->addRow(object_ptr<Statistic::ChartWidget>(box)),
|
||||
stats.dayGraph,
|
||||
tr::lng_chart_title_group_day(),
|
||||
Type::Linear);
|
||||
addSkip();
|
||||
// ProcessChart(
|
||||
// descriptor,
|
||||
// box->addRow(object_ptr<Statistic::ChartWidget>(box)),
|
||||
// stats.weekGraph,
|
||||
// tr::lng_chart_title_group_week(),
|
||||
// Type::StackLinear);
|
||||
// addSkip();
|
||||
}
|
||||
|
||||
void FillLoading(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
rpl::producer<bool> toggleOn) {
|
||||
|
@ -338,12 +408,15 @@ void StatisticsBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
|||
descriptor.api->request(
|
||||
descriptor.peer
|
||||
) | rpl::start_with_done([=] {
|
||||
const auto stats = descriptor.api->channelStats();
|
||||
if (!stats) {
|
||||
if (const auto stats = descriptor.api->supergroupStats(); stats) {
|
||||
// FillSupergroupOverview(box, descriptor, stats);
|
||||
FillSupergroupStatistic(box, descriptor, stats);
|
||||
} else if (const auto stats = descriptor.api->channelStats(); stats) {
|
||||
FillChannelOverview(box, descriptor, stats);
|
||||
FillChannelStatistic(box, descriptor, stats);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
FillChannelOverview(box, descriptor, stats);
|
||||
FillChannelStatistic(box, descriptor, stats);
|
||||
loaded->fire(true);
|
||||
box->verticalLayout()->resizeToWidth(box->width());
|
||||
box->showChildren();
|
||||
|
|
Loading…
Add table
Reference in a new issue