forked from 1b-agent/fieldcraft-upstream
Start card: every sample as a card with its thumbnail, flagship first, scrolling (#245)
The Start card and File › Samples show a grid of sample cards (thumbnail, name, one-line description, the full text on hover) in a scroll area with a solid scrollbar; Help › Samples keeps rows in the same order. The card stays clear of the view cube and the navigation bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
072139353f
commit
d3ed8ffb05
7 files changed
+265
-27
No files matched your search
@@ -976,8 +976,9 @@ pub fn show(app: &mut ModelApp, ctx: &egui::Context) {
|
||||
}
|
||||
Some(Prompt::Samples) => {
|
||||
let (mut open, mut close) = (None, false);
|
||||
crate::frame::window(ctx, "Samples", crate::frame::Width::Normal).id(egui::Id::new("fc_samples")).show(ctx, |ui| {
|
||||
sample_rows(ui, &t, &mut open);
|
||||
crate::frame::window(ctx, "Samples", crate::frame::Width::Wide).id(egui::Id::new("fc_samples")).show(ctx, |ui| {
|
||||
ui.set_width(crate::frame::WINDOW_WIDE_MAX_W.min(ctx.content_rect().width() - 48.0));
|
||||
crate::samples::grid(ui, &t, (ctx.content_rect().height() * 0.6).max(160.0), &mut open);
|
||||
ui.add_space(6.0);
|
||||
close = ui.button("Close").clicked();
|
||||
});
|
||||
@@ -992,28 +993,6 @@ pub fn show(app: &mut ModelApp, ctx: &egui::Context) {
|
||||
}
|
||||
}
|
||||
|
||||
/// One row per sample: its name, what it shows and an Open button; `open` gets the one clicked.
|
||||
pub fn sample_rows(ui: &mut egui::Ui, t: &crate::theme::Tokens, open: &mut Option<&'static str>) {
|
||||
let width = ui.available_width().clamp(280.0, 420.0);
|
||||
egui::ScrollArea::vertical().auto_shrink([false, true]).show(ui, |ui| sample_list(ui, t, open, width));
|
||||
}
|
||||
|
||||
fn sample_list(ui: &mut egui::Ui, t: &crate::theme::Tokens, open: &mut Option<&'static str>, width: f32) {
|
||||
for sample in fieldcraft_engine::sample::SAMPLES {
|
||||
ui.horizontal(|ui| {
|
||||
ui.vertical(|ui| {
|
||||
ui.set_width(width - 70.0);
|
||||
ui.label(egui::RichText::new(sample.label).strong());
|
||||
ui.add(egui::Label::new(egui::RichText::new(sample.about).small().color(t.text_dim)).wrap());
|
||||
});
|
||||
if ui.button("Open").clicked() {
|
||||
*open = Some(sample.name);
|
||||
}
|
||||
});
|
||||
ui.add_space(4.0);
|
||||
}
|
||||
}
|
||||
|
||||
impl ModelApp {
|
||||
/// The recover window's entries, read from disk once while it is open.
|
||||
fn recover_list(&mut self, ctx: &egui::Context) -> Vec<Value> {
|
||||
|
||||
Reference in new issue
Block a user