Port modular features into boursecu and fix desktop login UX.
Add support chat, piggy funds, PWA banner, notification/SSE sync, and messenger legacy guards while keeping boursecu theme; also balance login panels and unblock login navigation. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -384,6 +384,15 @@ function handleAppNotificationPayload(payload: unknown) {
|
||||
void applyAppNotificationFromStream(payload as Record<string, unknown>)
|
||||
}
|
||||
|
||||
function handleUnreadCountPayload(payload: unknown) {
|
||||
if (!payload || typeof payload !== 'object') {
|
||||
return
|
||||
}
|
||||
|
||||
touchStreamActivity()
|
||||
void applyUnreadCountFromStreamPayload(payload as Record<string, unknown>)
|
||||
}
|
||||
|
||||
async function applyAppNotificationFromStream(payload: Record<string, unknown>) {
|
||||
try {
|
||||
const { bumpUnreadFromStream } = await import('@/composables/useAppNotificationBadge')
|
||||
@@ -393,6 +402,15 @@ async function applyAppNotificationFromStream(payload: Record<string, unknown>)
|
||||
}
|
||||
}
|
||||
|
||||
async function applyUnreadCountFromStreamPayload(payload: Record<string, unknown>) {
|
||||
try {
|
||||
const { applyUnreadCountFromStream } = await import('@/composables/useAppNotificationBadge')
|
||||
applyUnreadCountFromStream(payload)
|
||||
} catch (error) {
|
||||
console.warn('Unread-count SSE apply failed', error)
|
||||
}
|
||||
}
|
||||
|
||||
function bindStreamEvents(source: EventSource) {
|
||||
source.addEventListener('last', (event) => {
|
||||
try {
|
||||
@@ -426,6 +444,14 @@ function bindStreamEvents(source: EventSource) {
|
||||
}
|
||||
})
|
||||
|
||||
source.addEventListener('unread-count', (event) => {
|
||||
try {
|
||||
handleUnreadCountPayload(JSON.parse(event.data))
|
||||
} catch (error) {
|
||||
console.warn('Unread-count SSE parse failed', error)
|
||||
}
|
||||
})
|
||||
|
||||
source.addEventListener('ping', () => {
|
||||
touchStreamActivity()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user