style(feed): highlight insert/delete events
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="realtime-event">
|
||||
<div :class="['realtime-event', eventBgClass]">
|
||||
<p class="text-xs text-gray-500 mb-1">
|
||||
{{ event.operation }} · {{ event.table }} • {{ formatTimestamp(event.receivedAt) }}
|
||||
</p>
|
||||
@@ -78,11 +78,19 @@ const formatTimestamp = (ts) => {
|
||||
if (!ts) return ''
|
||||
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>
|
||||
|
||||
<style scoped>
|
||||
.realtime-event {
|
||||
margin-bottom: 1rem;
|
||||
padding: 0.5rem;
|
||||
border-radius: 0.375rem;
|
||||
}
|
||||
|
||||
.old-card,
|
||||
|
||||
@@ -16,7 +16,12 @@ onMounted(() => {
|
||||
<h1>Feed en Tiempo Real</h1>
|
||||
</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
|
||||
v-for="(ev, idx) in realtime.events"
|
||||
:key="ev.receivedAt + idx"
|
||||
@@ -32,7 +37,7 @@ onMounted(() => {
|
||||
<style scoped>
|
||||
.realtime-feed-container {
|
||||
padding: 20px;
|
||||
max-width: 1200px;
|
||||
max-width: 1500px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@@ -63,4 +68,13 @@ onMounted(() => {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.feed-list {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
scrollbar-width: none; /* Firefox */
|
||||
}
|
||||
.feed-list::-webkit-scrollbar {
|
||||
display: none; /* Chrome, Safari */
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user