diff --git a/ui/src/components/realtime/RealtimeEventCard.vue b/ui/src/components/realtime/RealtimeEventCard.vue index be49024..9f2223c 100644 --- a/ui/src/components/realtime/RealtimeEventCard.vue +++ b/ui/src/components/realtime/RealtimeEventCard.vue @@ -114,6 +114,7 @@ const operationClass = computed(() => { .realtime-event { margin-bottom: 1rem; padding: 0.5rem; + view-transition-name: auto; } .old-card, diff --git a/ui/src/stores/useRealtime.js b/ui/src/stores/useRealtime.js index bf3f8b3..cf34662 100644 --- a/ui/src/stores/useRealtime.js +++ b/ui/src/stores/useRealtime.js @@ -27,15 +27,33 @@ export const useRealtimeStore = defineStore('realtime', { }; this._sse.onmessage = (e) => { - console.log('๐Ÿ“ฉ SSE message raw:', e.data); + // console.log('๐Ÿ“ฉ SSE message raw:', e.data); try { const payload = JSON.parse(e.data); - console.log('๐Ÿ“ฆ Payload parseado:', payload); - console.log('๐Ÿงช Tabla recibida:', payload.table); + // console.log('๐Ÿ“ฆ Payload parseado:', payload); + // console.log('๐Ÿงช Tabla recibida:', payload.table); + console.log('๐Ÿ“ฌ Evento SSE recibido:'); + - // store event for feed - this.events.unshift({ ...payload, receivedAt: new Date().toISOString() }); + // store event for feed with View Transition if available + const addEvent = () => { + const event = { + id: crypto.randomUUID ? crypto.randomUUID() : Date.now().toString(36) + Math.random().toString(36).slice(2), + ...payload, + receivedAt: new Date().toISOString(), + }; + // console.log('๐Ÿ”„ Adding realtime event', event); + this.events.unshift(event); + // console.log('๐Ÿ“Š Events in feed:', this.events.length); + }; + if (document.startViewTransition) { + console.log('๐ŸŽฌ Using View Transition API for new event'); + document.startViewTransition(addEvent); + } else { + console.log('โš ๏ธ View Transition API not supported'); + addEvent(); + } // mark badge for module and operation if (this.badges[payload.table]) { @@ -64,7 +82,7 @@ export const useRealtimeStore = defineStore('realtime', { this._sse.onerror = () => { console.warn('SSE connection lost, reloading...'); }; - } + }, clearBadgesForTable(table) { if (this.badges[table]) { this.badges[table].INSERT = false; diff --git a/ui/src/views/RealtimeFeedView.vue b/ui/src/views/RealtimeFeedView.vue index 2392f31..e822db2 100644 --- a/ui/src/views/RealtimeFeedView.vue +++ b/ui/src/views/RealtimeFeedView.vue @@ -1,10 +1,17 @@