voelin-ui: the phone's bottom navigation shows where you are
Home could be on screen while the bar marked Chats and the top bar named the server: opening Home other than by its tab (the desktop's logo before the window narrowed, VOELIN_OPEN=home) left the phone's tab where it was. Nav.show now keeps the tab and the page together, also while the window is wide, so the tab is right when it narrows. The tabs go through Nav.show-tab, which also closes the pins, topics or members page that was over the last tab, instead of leaving it over the next one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ef976cf31e
commit
5da3f94479
2 files changed
+22
-7
No files matched your search
@@ -85,13 +85,28 @@ export global Nav {
|
||||
settings-active = false;
|
||||
Bridge.close-settings();
|
||||
}
|
||||
// The phone shows Home on its own tab: a server goes to Servers.
|
||||
if narrow && p == Page.server && mobile-tab == MobileTab.home {
|
||||
// The phone shows Home on its own tab: a server goes to Servers,
|
||||
// and Home from anywhere (the desktop's logo, a switch) is that tab.
|
||||
// Also while wide, so the tab is right when the window narrows.
|
||||
if p == Page.server && mobile-tab == MobileTab.home {
|
||||
mobile-tab = MobileTab.servers;
|
||||
}
|
||||
if p == Page.home {
|
||||
mobile-tab = MobileTab.home;
|
||||
}
|
||||
page = p;
|
||||
}
|
||||
|
||||
// A tab of the phone's bottom navigation, without the pages that were
|
||||
// over the last one (pins, topics, members).
|
||||
public function show-tab(tab: MobileTab) {
|
||||
pins-open = false;
|
||||
topics-open = false;
|
||||
members-open = false;
|
||||
show(tab == MobileTab.home ? Page.home : Page.server);
|
||||
mobile-tab = tab;
|
||||
}
|
||||
|
||||
public function open-settings(section: SettingsSection) {
|
||||
if !settings-active {
|
||||
settings-active = true;
|
||||
|
||||
@@ -265,34 +265,34 @@ export component MobileShell inherits Rectangle {
|
||||
icon: Icons.home;
|
||||
text: @tr("Home");
|
||||
selected: Nav.mobile-tab == MobileTab.home && Nav.page != Page.settings;
|
||||
clicked => { Nav.show(Page.home); Nav.mobile-tab = MobileTab.home; }
|
||||
clicked => { Nav.show-tab(MobileTab.home); }
|
||||
}
|
||||
NavTab {
|
||||
icon: Icons.server;
|
||||
text: @tr("Servers");
|
||||
selected: Nav.mobile-tab == MobileTab.servers && Nav.page != Page.settings;
|
||||
dot: Bridge.voice-connected;
|
||||
clicked => { Nav.show(Page.server); Nav.mobile-tab = MobileTab.servers; }
|
||||
clicked => { Nav.show-tab(MobileTab.servers); }
|
||||
}
|
||||
NavTab {
|
||||
icon: Icons.message-circle;
|
||||
text: @tr("Chats");
|
||||
selected: Nav.mobile-tab == MobileTab.chat && Nav.page != Page.settings;
|
||||
badge: root.unread;
|
||||
clicked => { Nav.show(Page.server); Nav.mobile-tab = MobileTab.chat; }
|
||||
clicked => { Nav.show-tab(MobileTab.chat); }
|
||||
}
|
||||
NavTab {
|
||||
icon: Icons.activity;
|
||||
text: @tr("Activity");
|
||||
selected: Nav.mobile-tab == MobileTab.activity && Nav.page != Page.settings;
|
||||
badge: Bridge.share-requests;
|
||||
clicked => { Nav.show(Page.server); Nav.mobile-tab = MobileTab.activity; }
|
||||
clicked => { Nav.show-tab(MobileTab.activity); }
|
||||
}
|
||||
NavTab {
|
||||
icon: Icons.user;
|
||||
text: @tr("You");
|
||||
selected: Nav.mobile-tab == MobileTab.you || Nav.page == Page.settings;
|
||||
clicked => { Nav.show(Page.server); Nav.mobile-tab = MobileTab.you; }
|
||||
clicked => { Nav.show-tab(MobileTab.you); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user