feat(web): service-worker notifications and composer/scroll UX fixes
Some checks failed
CI / test (push) Failing after 21s
Some checks failed
CI / test (push) Failing after 21s
- register notifications service worker and handle click-to-open chat/message - route realtime notifications through service worker with fallback - support ?chat=&message= deep-link navigation in chats page - enforce 1s minimum voice message length - lift scroll-to-bottom button to avoid overlap with composer action
This commit is contained in:
@@ -52,6 +52,30 @@ export function ChatsPage() {
|
||||
}
|
||||
}, [activeChatId, loadMessages]);
|
||||
|
||||
useEffect(() => {
|
||||
const applyNotificationNavigation = () => {
|
||||
const url = new URL(window.location.href);
|
||||
const chatParam = url.searchParams.get("chat");
|
||||
const messageParam = url.searchParams.get("message");
|
||||
const chatId = Number(chatParam);
|
||||
const messageId = Number(messageParam);
|
||||
if (!Number.isFinite(chatId) || chatId <= 0) {
|
||||
return;
|
||||
}
|
||||
setActiveChatId(chatId);
|
||||
if (Number.isFinite(messageId) && messageId > 0) {
|
||||
setFocusedMessage(chatId, messageId);
|
||||
}
|
||||
url.searchParams.delete("chat");
|
||||
url.searchParams.delete("message");
|
||||
window.history.replaceState({}, "", url.toString());
|
||||
};
|
||||
|
||||
applyNotificationNavigation();
|
||||
window.addEventListener("popstate", applyNotificationNavigation);
|
||||
return () => window.removeEventListener("popstate", applyNotificationNavigation);
|
||||
}, [setActiveChatId, setFocusedMessage]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!searchOpen) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user