style(feed): highlight insert/delete events
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="realtime-event">
|
<div :class="['realtime-event', eventBgClass]">
|
||||||
<p class="text-xs text-gray-500 mb-1">
|
<p class="text-xs text-gray-500 mb-1">
|
||||||
{{ event.operation }} · {{ event.table }} • {{ formatTimestamp(event.receivedAt) }}
|
{{ event.operation }} · {{ event.table }} • {{ formatTimestamp(event.receivedAt) }}
|
||||||
</p>
|
</p>
|
||||||
@@ -78,11 +78,19 @@ const formatTimestamp = (ts) => {
|
|||||||
if (!ts) return ''
|
if (!ts) return ''
|
||||||
return new Date(ts).toLocaleString('es-HN', { hour12: true })
|
return new Date(ts).toLocaleString('es-HN', { hour12: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const eventBgClass = computed(() => {
|
||||||
|
if (props.event.operation === 'DELETE') return 'bg-red-100/40'
|
||||||
|
if (props.event.operation === 'INSERT') return 'bg-green-100/40'
|
||||||
|
return ''
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.realtime-event {
|
.realtime-event {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-radius: 0.375rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.old-card,
|
.old-card,
|
||||||
|
|||||||
@@ -16,7 +16,12 @@ onMounted(() => {
|
|||||||
<h1>Feed en Tiempo Real</h1>
|
<h1>Feed en Tiempo Real</h1>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<transition-group name="feed" tag="div" class="feed-list overflow-auto pr-2" style="max-height: calc(100vh - 160px);">
|
<transition-group
|
||||||
|
name="feed"
|
||||||
|
tag="div"
|
||||||
|
class="feed-list pr-2"
|
||||||
|
style="max-height: calc(100vh - 160px);"
|
||||||
|
>
|
||||||
<RealtimeEventCard
|
<RealtimeEventCard
|
||||||
v-for="(ev, idx) in realtime.events"
|
v-for="(ev, idx) in realtime.events"
|
||||||
:key="ev.receivedAt + idx"
|
:key="ev.receivedAt + idx"
|
||||||
@@ -32,7 +37,7 @@ onMounted(() => {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.realtime-feed-container {
|
.realtime-feed-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
max-width: 1200px;
|
max-width: 1500px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,4 +68,13 @@ onMounted(() => {
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.feed-list {
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
scrollbar-width: none; /* Firefox */
|
||||||
|
}
|
||||||
|
.feed-list::-webkit-scrollbar {
|
||||||
|
display: none; /* Chrome, Safari */
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user