🏡 index : quine-global-labs/bazaar.git

using Gtk 4.0;
using Adw 1;

template $BzCuratedView: Adw.Bin {
  child: Adw.BreakpointBin {
    width-request: 360;
    height-request: 100;

    Adw.Breakpoint {
      condition ("max-width: 700px")

      setters {
        content_box.margin-start: 10;
        content_box.margin-end: 10;
      }
    }

    child: Adw.ViewStack stack {
      enable-transitions: true;
      transition-duration: 400;

      Adw.ViewStackPage {
        name: "empty";

        child: Adw.StatusPage {
          icon-name: "star-outline-rounded-symbolic";
          title: _("No Curation");
          description: _(
            "There is no curation information provided on this system. You can still browse apps on Flathub"
          );

          child: Button {
            label: _("Browse Flathub");
            halign: center;
            clicked => $browse_flathub_cb(template);

            styles [
              "pill",
            ]
          };
        };
      }

      Adw.ViewStackPage {
        name: "offline";

        child: Adw.StatusPage {
          icon-name: "connected-squares-x";
          title: _("Offline");
        };
      }

      Adw.ViewStackPage {
        name: "content";

        child: ScrolledWindow {

          child: Adw.Clamp {
            maximum-size: 1500;
            tightening-threshold: 1400;

            child: $BzDynamicListView content_box {
              css-name: "curated-list-view";
              hexpand: true;
              margin-start: 30;
              margin-end: 30;
              margin-bottom: 50;

              scroll: false;
              noscroll-kind: list-box;

              child-type: "BzDynamicListView";
              object-prop: "rows";
              child-prop: "model";

              model: bind template.state as <$BzStateInfo>.curated-provider;
              bind-widget => $bind_cb(template);
              unbind-widget => $unbind_cb(template);
            };
          };
        };
      }
    };
  };
}