v0.12.31 multiple UI changes

This commit is contained in:
2026-03-27 10:19:52 -04:00
parent d6a37d5948
commit 97f1dace4f
10 changed files with 174 additions and 69 deletions

View File

@@ -447,27 +447,50 @@ export default function Chat() {
setActiveGroupId(id);
if (isMobile) {
setShowSidebar(false);
// Push a history entry so swipe-back returns to sidebar instead of exiting the app
window.history.pushState({ rosterchirpChatOpen: true }, '');
// The mount sentinel covers the first back gesture — no extra push needed here
}
// Clear notifications and unread count for this group
setNotifications(prev => prev.filter(n => n.groupId !== id));
setUnreadGroups(prev => { const next = new Map(prev); next.delete(id); return next; });
};
// Handle browser back gesture on mobile — return to sidebar instead of exiting
// Establish one history sentinel on mount (mobile only) so back gestures are
// always interceptable without accumulating extra entries.
useEffect(() => {
const handlePopState = (e) => {
if (isMobile && activeGroupId) {
if (window.innerWidth < 768) {
window.history.replaceState({ rc: 'chat' }, '');
}
}, []);
// Handle browser back gesture on mobile — step through the navigation hierarchy:
// chat open → list view for the current page → Messages → exit app
useEffect(() => {
const handlePopState = () => {
if (!isMobile) return;
if (activeGroupId) {
// Close the open chat, stay on the current page's list (chat or groupmessages)
setShowSidebar(true);
setActiveGroupId(null);
// Push another entry so subsequent back gestures are also intercepted
window.history.pushState({ rosterchirpChatOpen: true }, '');
setChatHasText(false);
window.history.pushState({ rc: 'chat' }, '');
return;
}
if (page !== 'chat') {
// On a secondary page (groupmessages / users / groups / schedule / hostpanel)
// — return to the default Messages page
setPage('chat');
window.history.pushState({ rc: 'chat' }, '');
return;
}
// Already at root (Messages list, no chat open) — let the browser handle
// it so the next gesture actually exits the PWA. Don't re-push.
};
window.addEventListener('popstate', handlePopState);
return () => window.removeEventListener('popstate', handlePopState);
}, [isMobile, activeGroupId]);
}, [isMobile, activeGroupId, page]);
// Update page title AND PWA app badge with total unread count
useEffect(() => {