fix(w7): always show the Recent Rooms card, with an empty state
The card was hidden entirely when there was no history, so on a fresh build it appeared to be missing. Always render it (with a "No recent rooms yet" hint when empty), mirroring the Friends card, so the feature is discoverable before the first join. Drops the has_recents gating in the home layout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+16
-18
@@ -1396,13 +1396,10 @@ fn connect_card(state: &AppState) -> Element<'_, AppMessage> {
|
||||
}
|
||||
|
||||
/// The "Recent rooms" card (W7 P5): a one-click rejoin list, in its own card so a
|
||||
/// growing history never reflows the Connect card's Create/Join controls. Returns
|
||||
/// an empty element when there are no recents, so the home screen can omit it
|
||||
/// entirely on a fresh install. Mirrors `friends_panel`'s self-contained styling.
|
||||
/// growing history never reflows the Connect card's Create/Join controls. Always
|
||||
/// shown (with an empty-state hint when there's no history yet), mirroring the
|
||||
/// Friends card so the feature is discoverable on a fresh install.
|
||||
fn recents_card(state: &AppState) -> Element<'_, AppMessage> {
|
||||
if state.config.recents.is_empty() {
|
||||
return column![].into();
|
||||
}
|
||||
let pal = state.config.theme.palette();
|
||||
let color_crust = pal.crust;
|
||||
let color_mantle = pal.mantle;
|
||||
@@ -1443,6 +1440,13 @@ fn recents_card(state: &AppState) -> Element<'_, AppMessage> {
|
||||
.map(|d| d.as_secs())
|
||||
.unwrap_or(0);
|
||||
let mut rows = column![].spacing(6).width(iced::Length::Fill);
|
||||
if state.config.recents.is_empty() {
|
||||
rows = rows.push(
|
||||
text("No recent rooms yet — they'll appear here after you join one.")
|
||||
.size(12)
|
||||
.color(color_subtext),
|
||||
);
|
||||
}
|
||||
for r in &state.config.recents {
|
||||
let label = {
|
||||
let n = crate::sanitize::sanitize_name(&r.name);
|
||||
@@ -2302,24 +2306,18 @@ fn view(state: &AppState) -> Element<'_, AppMessage> {
|
||||
// The Recent-rooms card lives in the LEFT column under the Connect card
|
||||
// (both are about getting into a room), so it has its own card and a
|
||||
// growing history can't reflow the Create/Join controls. Friends stays on
|
||||
// the right. Recents is omitted entirely (no stray gap) when empty.
|
||||
// the right. Always shown (empty-state hint when no history) for parity
|
||||
// with the Friends card and so the feature is discoverable.
|
||||
let body = responsive(move |size| {
|
||||
let has_recents = !state.config.recents.is_empty();
|
||||
let cards: Element<AppMessage> = if size.width < 900.0 {
|
||||
let mut col = column![connect_card(state)]
|
||||
column![connect_card(state), recents_card(state), friends_panel(state)]
|
||||
.spacing(20)
|
||||
.align_x(iced::alignment::Horizontal::Center);
|
||||
if has_recents {
|
||||
col = col.push(recents_card(state));
|
||||
}
|
||||
col.push(friends_panel(state)).into()
|
||||
.align_x(iced::alignment::Horizontal::Center)
|
||||
.into()
|
||||
} else {
|
||||
let mut left = column![connect_card(state)]
|
||||
let left = column![connect_card(state), recents_card(state)]
|
||||
.spacing(20)
|
||||
.align_x(iced::alignment::Horizontal::Center);
|
||||
if has_recents {
|
||||
left = left.push(recents_card(state));
|
||||
}
|
||||
row![left, friends_panel(state)]
|
||||
.spacing(20)
|
||||
.align_y(iced::alignment::Vertical::Top)
|
||||
|
||||
Reference in New Issue
Block a user