using Gtk 4.0; using Adw 1; template $BzStatsDialog: Adw.BreakpointBin { width-request: 360; height-request: 450; child: Adw.ToolbarView { bottom-bar-style: raised_border; [top] Adw.HeaderBar { title-widget: Adw.ViewSwitcher switcher_title { visible: bind $model_has_items(template.country-model) as ; stack: stack; policy: wide; }; } content: Box { orientation: vertical; Adw.ViewStack stack { vexpand: true; enable-transitions: true; transition-duration: 150; Adw.ViewStackPage { name: "graph"; // TRANSLATORS: page in the statistics dialog title: _("Timeline"); icon-name: "graph2-symbolic"; child: Box graph_page { orientation: vertical; margin-top: 12; margin-start: 24; margin-end: 24; margin-bottom: 24; Grid { margin-start: 12; margin-end: 12; column-spacing: 60; hexpand: true; halign: start; Label total_label { // TRANSLATORS: total number of installs of an app, shown in the statistics dialog label: _("Total"); halign: start; layout { column: 0; row: 0; } } Label { label: bind $format_installs(template.total-downloads) as ; halign: start; layout { column: 0; row: 1; } styles [ "stats-value", ] accessibility { labelled-by: [ total_label, ]; } } Label week_label { // TRANSLATORS: installs in the last 7 days, shown in the statistics dialog label: _("This Week"); halign: start; layout { column: 1; row: 0; } } Label { label: bind $format_last_week(template.model) as ; halign: start; layout { column: 1; row: 1; } styles [ "stats-value", ] accessibility { labelled-by: [ week_label, ]; } } } $BzDataGraph { model: bind template.model; vexpand: true; hexpand: true; margin-top: 12; accessibility { label: _("Installs per day"); } } }; } Adw.ViewStackPage { name: "map"; // TRANSLATORS: page in the statistics dialog title: _("World"); icon-name: "globe-symbolic"; child: Box { orientation: vertical; margin-top: 10; margin-bottom: 10; $BzWorldMap { model: bind template.country-model; vexpand: true; accessibility { label: _("Installs per country"); } } Label { label: _("Since 4/15/2024"); halign: center; styles [ "dimmed", "caption", ] } }; } Adw.ViewStackPage { name: "distros"; title: _("Distros"); icon-name: "penguin-alt-symbolic"; visible: bind $model_has_items(template.distro-model) as ; child: ScrolledWindow distros_scroll { hscrollbar-policy: never; propagate-natural-height: true; child: Adw.Clamp distros_clamp { maximum-size: 800; tightening-threshold: 600; valign: center; margin-top: 28; margin-bottom: 28; margin-start: 40; margin-end: 40; child: Box { orientation: vertical; spacing: 18; $BzDistroChart { model: bind template.distro-model; hexpand: true; accessibility { label: _("Installs per distro"); } } Label { label: bind $format_distros_caption(template.distro-model) as ; halign: center; justify: center; wrap: true; styles [ "dimmed", "caption", ] } }; }; }; } } Adw.ViewSwitcherBar switcher_bar { visible: bind $model_has_items(template.country-model) as ; stack: stack; } }; }; Adw.Breakpoint { condition ("max-width: 450sp") setters { switcher_title.stack: null; switcher_bar.reveal: true; graph_page.margin-start: 0; graph_page.margin-end: 0; graph_page.margin-bottom: 0; distros_clamp.margin-top: 12; distros_clamp.margin-bottom: 12; distros_clamp.margin-start: 8; distros_clamp.margin-end: 8; } } }