using Gtk 4.0;
using Adw 1;

template $HistoryPage : Adw.NavigationPage {
  tag: "history";
  title: _("History");
  child: Adw.ToolbarView {
    [top]
    Adw.HeaderBar {
      centering-policy: strict;
      title-widget: Adw.WindowTitle {
        title: _("History");
      };

      [end]
      ToggleButton search_button {
        icon-name: "edit-find-symbolic";
        tooltip-text: _("Search");
      }
    }

    content: Box {
      orientation: vertical;

      Adw.Clamp {
        maximum-size: 768;
        margin-end: 12;
        margin-start: 12;

        SearchBar searchbar {
          SearchEntry searchentry {
            hexpand: true;
          }

          styles [
            "inline",
          ]
        }
      }

      Separator searchbar_separator {
      }

      ScrolledWindow {
        vexpand: true;
        child: Viewport {
          scroll-to-focus: true;

          Adw.Clamp {
            maximum-size: 768;
            margin-top: 12;
            margin-end: 12;
            margin-bottom: 24;
            margin-start: 12;

            Stack stack {
              StackPage {
                name: "list";
                child: Box dates_box {
                  orientation: vertical;
                  spacing: 24;
                };
              }

              StackPage {
                name: "empty";
                child: Adw.StatusPage empty_status_page {
                  icon-name: "document-open-recent-symbolic";
                  title: _("No History");
                };
              }
            }
          }
        };
      }
    };
  };
}
