GPUI Box GitHub

Scenes

offering-catalog

Builds OfferingCatalog

offering-catalog in the dark theme
studio-dark
offering-catalog in the light theme
studio-light

The code that drew it

A still frame holds a repeating animation at its first frame and a one-shot at its last, because a still of a moving thing is not reproducible. Run the gallery to review motion.

fn offering_catalog(_window: &mut Window, cx: &mut App) -> AnyElement {
    let theme = cx.theme().clone();
    let workspace = OfferingSource::new(
        "workspace",
        "Workspace tools",
        OfferingSourceState::Ready(vec![
            SearchableOffering::new(
                Offering::tool("read", "Read a file")
                    .summary("Returns the contents of one file")
                    .qualifier("path, max_bytes"),
                "read file contents path workspace",
            ),
            SearchableOffering::new(
                Offering::skill("review", "Review a change")
                    .summary("Reads a diff and reports what it finds"),
                "review change diff findings",
            ),
        ]),
    );
    let archive = OfferingSource::new(
        "archive",
        "Archive tools",
        OfferingSourceState::Stale {
            offerings: vec![
                SearchableOffering::new(
                    Offering::tool("read", "Read a file").summary("Reads one archived file"),
                    "read archived file contents",
                ),
                SearchableOffering::new(
                    Offering::resource("changelog", "Changelog").qualifier("archive:/CHANGELOG.md"),
                    "changelog changes release history",
                ),
            ],
            reason: "Archive refresh failed; showing the last verified results.".into(),
        },
    );
    stack(&theme)
        .w(px(560.0))
        .child(
            OfferingCatalog::new("scene.offering-catalog")
                .sources([workspace, archive])
                .selected(OfferingIdentity::new("workspace", "read"))
                .on_activate(|_, _, _| {}),
        )
        .into_any_element()
}