Skip to content

Commit 42365df

Browse files
authored
settings_ui: Fix content page title (#39987)
Follow up to #39979. The previous PR made it the title would change even if you were on a non-root tree view item. This PR fixes that by fixating the title to show only the root tree view item. Release Notes: - N/A
1 parent 201124e commit 42365df

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

crates/settings_ui/src/settings_ui.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,14 +1793,17 @@ impl SettingsWindow {
17931793
.find(|(_, (_, item))| !matches!(item, SettingsPageItem::SectionHeader(_)))
17941794
.map(|(index, _)| index);
17951795

1796+
let root_nav_label = self
1797+
.navbar_entries
1798+
.iter()
1799+
.find(|entry| entry.is_root && entry.page_index == self.current_page_index())
1800+
.map(|entry| entry.title);
1801+
17961802
page_content = page_content
17971803
.when(sub_page_stack().is_empty(), |this| {
1798-
this.when_some(
1799-
self.navbar_entries
1800-
.get(self.navbar_entry)
1801-
.map(|entry| entry.title),
1802-
|this, title| this.child(Label::new(title).size(LabelSize::Large).mb_3()),
1803-
)
1804+
this.when_some(root_nav_label, |this, title| {
1805+
this.child(Label::new(title).size(LabelSize::Large).mt_2().mb_3())
1806+
})
18041807
})
18051808
.children(items.clone().into_iter().enumerate().map(
18061809
|(index, (actual_item_index, item))| {

0 commit comments

Comments
 (0)