Skip to content

Commit b5d7340

Browse files
committed
fix(layout): allow flex content to shrink so panels and rows do not clip
The middle column wrapping the header and view content had flex_1 but no min_w_0, so it refused to shrink below intrinsic content width and pushed side detail panels and right aligned actions past the window edge on narrow windows. Adds min_w_0 down the chain through render content, each view's scroll container, and the manifest row wrappers. Side detail panels in Browse and Manifest now flex_shrink with a min width so they compress instead of clipping.
1 parent 4184934 commit b5d7340

7 files changed

Lines changed: 43 additions & 5 deletions

File tree

src/app.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2330,6 +2330,7 @@ impl Render for App {
23302330
div()
23312331
.flex_1()
23322332
.min_h_0()
2333+
.min_w_0()
23332334
.flex()
23342335
.flex_col()
23352336
.child(self.render_header(&theme, cx))
@@ -3443,7 +3444,7 @@ impl App {
34433444
}
34443445

34453446
fn render_content(&mut self, theme: &theme::Theme, cx: &mut Context<Self>) -> Div {
3446-
let wrapper = div().flex_1().min_h_0().flex().flex_col();
3447+
let wrapper = div().flex_1().min_h_0().min_w_0().flex().flex_col();
34473448

34483449
match self.current_view {
34493450
View::Dashboard => wrapper.child(self.render_dashboard(theme, cx)),

src/views/browse.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ impl App {
237237
.id("browse-scroll")
238238
.flex_1()
239239
.min_h_0()
240+
.min_w_0()
240241
.w_full()
241242
.overflow_y_scroll()
242243
.child(
@@ -245,6 +246,7 @@ impl App {
245246
.flex()
246247
.flex_col()
247248
.w_full()
249+
.min_w_0()
248250
.child(browse_list),
249251
);
250252

@@ -524,7 +526,9 @@ impl App {
524526
});
525527

526528
let mut content = div()
529+
.flex_shrink()
527530
.w(px(320.0))
531+
.min_w(px(220.0))
528532
.h_full()
529533
.bg(surface)
530534
.border_l_1()

src/views/dashboard.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ impl App {
216216
.id("dashboard-scroll")
217217
.flex_1()
218218
.min_h_0()
219+
.min_w_0()
219220
.w_full()
220221
.overflow_y_scroll()
221222
.child(
@@ -224,6 +225,7 @@ impl App {
224225
.flex()
225226
.flex_col()
226227
.w_full()
228+
.min_w_0()
227229
.child(content),
228230
)
229231
}

src/views/installed.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ impl App {
195195
.id("installed-scroll")
196196
.flex_1()
197197
.min_h_0()
198+
.min_w_0()
198199
.w_full()
199200
.overflow_y_scroll()
200201
.child(
@@ -203,6 +204,7 @@ impl App {
203204
.flex()
204205
.flex_col()
205206
.w_full()
207+
.min_w_0()
206208
.child(main_col),
207209
)
208210
}

src/views/manifest.rs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,15 @@ impl App {
486486
.id("manifest-scroll")
487487
.flex_1()
488488
.min_h_0()
489+
.min_w_0()
489490
.overflow_y_scroll()
490491
.child(
491492
div()
492493
.p(px(styles::spacing::XL))
493494
.flex()
494495
.flex_col()
495496
.w_full()
497+
.min_w_0()
496498
.child(content),
497499
);
498500

@@ -676,7 +678,7 @@ fn diff_section(
676678
}
677679

678680
let count = entries.len();
679-
let mut body = div().flex().flex_col();
681+
let mut body = div().flex().flex_col().w_full();
680682
for (i, entry) in entries.iter().enumerate() {
681683
let missing_profile = invalid_profiles.get(&entry.name).cloned();
682684
let row = entry_row(entry, kind, accent, theme, i, missing_profile, cx);
@@ -686,7 +688,12 @@ fn diff_section(
686688
}
687689
body = body.child(row);
688690
}
689-
card.child(div().px(px(styles::spacing::LG)).child(body))
691+
card.child(
692+
div()
693+
.w_full()
694+
.px(px(styles::spacing::LG))
695+
.child(body),
696+
)
690697
}
691698

692699
fn entry_row(
@@ -714,11 +721,15 @@ fn entry_row(
714721
let mut row = div()
715722
.flex()
716723
.flex_row()
724+
.w_full()
725+
.min_w_0()
717726
.gap(px(styles::spacing::SM))
718727
.items_center()
719728
.child(
720729
div()
721730
.flex_1()
731+
.min_w_0()
732+
.overflow_hidden()
722733
.text_size(px(styles::font_size::BODY))
723734
.font_weight(FontWeight::MEDIUM)
724735
.child(entry.name.clone()),
@@ -828,6 +839,8 @@ fn entry_row(
828839
let _ = text_muted;
829840
div()
830841
.id(SharedString::from(format!("manifest-row-{kind_prefix}-{idx}")))
842+
.w_full()
843+
.min_w_0()
831844
.cursor_pointer()
832845
.on_click(select_listener)
833846
.child(row)
@@ -934,7 +947,7 @@ fn name_section_with_actions(
934947

935948
let warning = theme.warning;
936949
let count = names.len();
937-
let mut body = div().flex().flex_col();
950+
let mut body = div().flex().flex_col().w_full();
938951
for (i, name) in names.iter().enumerate() {
939952
// Soar suffixes in_sync entries with " (local)" or similar source labels.
940953
// The manifest key is just the bare name, so strip the suffix before
@@ -960,11 +973,15 @@ fn name_section_with_actions(
960973
let mut row = div()
961974
.flex()
962975
.flex_row()
976+
.w_full()
977+
.min_w_0()
963978
.items_center()
964979
.gap(px(styles::spacing::SM))
965980
.child(
966981
div()
967982
.flex_1()
983+
.min_w_0()
984+
.overflow_hidden()
968985
.text_size(px(styles::font_size::BODY))
969986
.child(name.clone()),
970987
);
@@ -1017,6 +1034,7 @@ fn name_section_with_actions(
10171034
});
10181035
let mut clickable = div()
10191036
.id(SharedString::from(format!("manifest-row-{id_prefix}-{i}")))
1037+
.w_full()
10201038
.py(px(styles::spacing::SM))
10211039
.cursor_pointer()
10221040
.on_click(select_listener)
@@ -1026,7 +1044,12 @@ fn name_section_with_actions(
10261044
}
10271045
body = body.child(clickable);
10281046
}
1029-
card.child(div().px(px(styles::spacing::LG)).child(body))
1047+
card.child(
1048+
div()
1049+
.w_full()
1050+
.px(px(styles::spacing::LG))
1051+
.child(body),
1052+
)
10301053
}
10311054

10321055
fn summary_chip(label: &str, count: usize, color: Hsla, theme: &theme::Theme) -> Div {
@@ -1185,7 +1208,9 @@ fn render_manifest_detail(
11851208

11861209
div()
11871210
.id("manifest-detail")
1211+
.flex_shrink()
11881212
.w(px(360.0))
1213+
.min_w(px(220.0))
11891214
.min_h_0()
11901215
.border_l_1()
11911216
.border_color(border)

src/views/settings.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ impl App {
228228
.id("settings-scroll")
229229
.flex_1()
230230
.min_h_0()
231+
.min_w_0()
231232
.w_full()
232233
.overflow_y_scroll()
233234
.child(
@@ -237,6 +238,7 @@ impl App {
237238
.flex_col()
238239
.gap(px(styles::spacing::XL))
239240
.w_full()
241+
.min_w_0()
240242
.child(header)
241243
.child(aeris_section)
242244
.child(div().w_full().h(px(1.0)).bg(border))

src/views/updates.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ impl App {
266266
.id("updates-scroll")
267267
.flex_1()
268268
.min_h_0()
269+
.min_w_0()
269270
.w_full()
270271
.overflow_y_scroll()
271272
.child(
@@ -274,6 +275,7 @@ impl App {
274275
.flex()
275276
.flex_col()
276277
.w_full()
278+
.min_w_0()
277279
.child(main_col),
278280
)
279281
}

0 commit comments

Comments
 (0)