import { Nine, Theme } from "base.slint";
import { Pieces } from "pieces.slint";
import { InsetPanel, TabbedPaneFrame } from "frame.slint";
import { Tabs, TabItem } from "tabs.slint";

// The left half of the Mods window on the catalogue tabs: deep well, tab strip drawn in two layers around the
// tabbed pane (same construction as Manage), children go inside the pane. The Updates tab carries the "!" badge
// while updates exist.
export component LeftPane {
    in property <int> current;
    in property <bool> badge;
    callback tab(int);
    property <[TabItem]> tabs: [{text: "Manage", badge: false, enabled: true}, {text: "Explore", badge: false, enabled: true}, {text: "Updates", badge: root.badge, enabled: true}];
    InsetPanel { x: 0px; y: 0px; width: root.width; height: root.height; }
    Rectangle { x: 4px; y: 4px; width: root.width - 8px; height: 44px; background: Theme.list-bg; }
    Tabs { x: 12px; y: 12px; width: root.width < 384px ? 228px : 252px; compact: root.width < 384px; height: 40px; items: root.tabs; current: root.current; part: "others"; selected(i) => { root.tab(i); } }
    TabbedPaneFrame { x: 0px; y: 48px; width: root.width; height: root.height - 48px; }
    Tabs { x: 12px; y: 12px; width: root.width < 384px ? 228px : 252px; compact: root.width < 384px; height: 40px; items: root.tabs; current: root.current; part: "selected"; selected(i) => { root.tab(i); } }
    Rectangle { x: 0px; y: 48px; width: root.width; height: root.height - 48px; clip: true; Nine { x: 0px; y: -48px; width: parent.width; height: root.height; source: Pieces.inside-shallow-frame-default-shadow; } }
    @children
}
