feat(khira): add real-time SSE live updates and Kanban drag-and-drop

This commit is contained in:
2026-10-27 18:34:24 +05:30
parent 461178b04f
commit db9c1a5840
7 changed files with 467 additions and 8 deletions
+21
View File
@@ -581,6 +581,14 @@ func (s *Store) BulkAction(ids []string, action, value string, actor *User) (map
}
}
if s.Broker != nil {
actorName := ""
if actor != nil {
actorName = actor.Username
}
s.Broker.Broadcast("tickets_bulk_updated", "", "", actorName, action, map[string]any{"updated": updated})
}
return map[string]any{
"updated": updated,
"skipped": skipped,
@@ -598,12 +606,18 @@ func (s *Store) AddTicketTag(ticketID, tag string) error {
INSERT INTO ticket_tags (ticket_id, tag) VALUES ($1, $2)
ON CONFLICT (ticket_id, tag) DO NOTHING
`, ticketID, tag)
if err == nil && s.Broker != nil {
s.Broker.Broadcast("ticket_tags_updated", ticketID, "", "", "tag_add", map[string]string{"tag": tag})
}
return err
}
func (s *Store) RemoveTicketTag(ticketID, tag string) error {
tag = strings.ToLower(strings.TrimSpace(tag))
_, err := s.primaryDB.Exec(`DELETE FROM ticket_tags WHERE ticket_id = $1 AND tag = $2`, ticketID, tag)
if err == nil && s.Broker != nil {
s.Broker.Broadcast("ticket_tags_updated", ticketID, "", "", "tag_remove", map[string]string{"tag": tag})
}
return err
}
@@ -663,6 +677,10 @@ func (s *Store) LinkTickets(ticketA, ticketB, relType string, actor *User) error
VALUES ($1, $2, $3, $4, $5, 'link', $6, NOW())
`, remID, ticketA, actor.Username, actor.Name, actor.RoleDisplay, fmt.Sprintf("Linked related ticket %s.", ticketB))
if s.Broker != nil {
s.Broker.Broadcast("ticket_relations_updated", ticketA, "", actorUser, "link", map[string]string{"target": ticketB})
}
return nil
}
@@ -671,6 +689,9 @@ func (s *Store) UnlinkTickets(ticketA, ticketB string) error {
DELETE FROM ticket_relations
WHERE (ticket_a = $1 AND ticket_b = $2) OR (ticket_a = $2 AND ticket_b = $1)
`, ticketA, ticketB)
if err == nil && s.Broker != nil {
s.Broker.Broadcast("ticket_relations_updated", ticketA, "", "", "unlink", map[string]string{"target": ticketB})
}
return err
}
+119
View File
@@ -0,0 +1,119 @@
package khira
import (
"encoding/json"
"fmt"
"net/http"
"sync"
"time"
)
type RealtimeEvent struct {
Type string `json:"type"` // "ticket_created", "ticket_updated", "ticket_deleted", "ticket_archived", "ticket_completed", "remark_added", "error_logged", "notification", etc.
TicketID string `json:"ticket_id,omitempty"` // ID of the ticket affected
ErrorID string `json:"error_id,omitempty"` // ID of the runtime error affected
Actor string `json:"actor,omitempty"` // Username who performed the action
Action string `json:"action,omitempty"` // Action verb
Payload interface{} `json:"payload,omitempty"` // Extra metadata
Timestamp time.Time `json:"timestamp"`
}
type EventBroker struct {
mu sync.RWMutex
clients map[chan RealtimeEvent]struct{}
}
func NewEventBroker() *EventBroker {
return &EventBroker{
clients: make(map[chan RealtimeEvent]struct{}),
}
}
func (b *EventBroker) Subscribe() chan RealtimeEvent {
b.mu.Lock()
defer b.mu.Unlock()
ch := make(chan RealtimeEvent, 64)
b.clients[ch] = struct{}{}
return ch
}
func (b *EventBroker) Unsubscribe(ch chan RealtimeEvent) {
b.mu.Lock()
defer b.mu.Unlock()
if _, ok := b.clients[ch]; ok {
delete(b.clients, ch)
close(ch)
}
}
func (b *EventBroker) Broadcast(eventType, ticketID, errorID, actor, action string, payload interface{}) {
if b == nil {
return
}
evt := RealtimeEvent{
Type: eventType,
TicketID: ticketID,
ErrorID: errorID,
Actor: actor,
Action: action,
Payload: payload,
Timestamp: time.Now(),
}
b.mu.RLock()
defer b.mu.RUnlock()
for ch := range b.clients {
select {
case ch <- evt:
default:
// Non-blocking drop if channel buffer full
}
}
}
// handleEventsSSE handles Server-Sent Events stream for connected clients
func (s *Server) handleEventsSSE(w http.ResponseWriter, r *http.Request) {
flusher, ok := w.(http.Flusher)
if !ok {
http.Error(w, "Streaming unsupported", http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "text/event-stream")
w.Header().Set("Cache-Control", "no-cache, no-transform")
w.Header().Set("Connection", "keep-alive")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("X-Accel-Buffering", "no")
ch := s.Store.Broker.Subscribe()
defer s.Store.Broker.Unsubscribe(ch)
// Send initial handshake
fmt.Fprintf(w, "event: connected\ndata: {\"status\":\"live\",\"time\":%d}\n\n", time.Now().Unix())
flusher.Flush()
// 15-second heartbeat ticker to maintain proxy connection
ticker := time.NewTicker(15 * time.Second)
defer ticker.Stop()
ctx := r.Context()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
fmt.Fprintf(w, ": ping\n\n")
flusher.Flush()
case evt, ok := <-ch:
if !ok {
return
}
data, err := json.Marshal(evt)
if err != nil {
continue
}
fmt.Fprintf(w, "event: message\ndata: %s\n\n", data)
flusher.Flush()
}
}
}
+3
View File
@@ -195,6 +195,9 @@ func (s *Server) RegisterRoutes(r chi.Router) {
api.Delete("/notifications/{id}", s.handleDeleteNotification)
api.Delete("/notifications", s.handleClearNotifications)
api.Post("/notifications/{id}/read", s.handleMarkNotificationReadSingle)
// Realtime Server-Sent Events (SSE) Stream
api.Get("/events", s.handleEventsSSE)
})
}
+104 -1
View File
@@ -21,6 +21,7 @@ type Store struct {
primaryDB *sql.DB
backupDB *sql.DB
dataDir string
Broker *EventBroker
mu sync.RWMutex
}
@@ -67,6 +68,7 @@ func NewStore(dataDir string) (*Store, error) {
primaryDB: primaryDB,
backupDB: backupDB,
dataDir: dataDir,
Broker: NewEventBroker(),
}
// Check if backup is empty; if so, initial sync
@@ -402,6 +404,11 @@ func (s *Store) CreateTicket(t *Ticket, actor *User) (*Ticket, error) {
return nil, err
}
// Realtime Broadcast
if s.Broker != nil {
s.Broker.Broadcast("ticket_created", t.ID, "", actor.Username, "create", map[string]string{"title": t.Title, "priority": t.Priority})
}
// Notification
if t.AssignedTo != "" && !strings.EqualFold(t.AssignedTo, actor.Username) {
s.addNotification(t.AssignedTo, t.ID, "New ticket assigned to you", fmt.Sprintf("%s: %s", t.ID, t.Title), "assignment")
@@ -556,7 +563,19 @@ func (s *Store) DeleteTicket(ticketID string, actor *User) error {
return errors.New("ticket not found")
}
return tx.Commit()
if err := tx.Commit(); err != nil {
return err
}
if s.Broker != nil {
actorName := "unknown"
if actor != nil {
actorName = actor.Username
}
s.Broker.Broadcast("ticket_deleted", ticketID, "", actorName, "delete", nil)
}
return nil
}
type AppMeta struct {
@@ -875,6 +894,10 @@ func (s *Store) AddRemark(ticketID string, actor *User, remType, text string) (*
s.addNotification(createdBy, ticketID, "New remark on ticket", fmt.Sprintf("%s: %s commented", ticketID, actor.Name), "remark")
}
if s.Broker != nil {
s.Broker.Broadcast("remark_added", ticketID, "", actor.Username, "remark", map[string]string{"text": text, "type": remType})
}
return s.GetTicket(ticketID)
}
@@ -905,6 +928,10 @@ func (s *Store) HoldTicket(ticketID string, actor *User, reason string) (*Ticket
s.addNotification(assignedTo, ticketID, "Ticket placed on hold", fmt.Sprintf("%s placed on hold by %s", ticketID, actor.Name), "hold")
}
if s.Broker != nil {
s.Broker.Broadcast("ticket_held", ticketID, "", actor.Username, "hold", map[string]string{"reason": reason})
}
return s.GetTicket(ticketID)
}
@@ -934,6 +961,10 @@ func (s *Store) ResumeTicket(ticketID string, actor *User, remarks string) (*Tic
VALUES ($1, $2, $3, $4, $5, 'resume', $6, $7)
`, remID, ticketID, actor.Username, actor.Name, actor.RoleDisplay, remText, now)
if s.Broker != nil {
s.Broker.Broadcast("ticket_resumed", ticketID, "", actor.Username, "resume", nil)
}
return s.GetTicket(ticketID)
}
@@ -964,6 +995,10 @@ func (s *Store) CompleteTicket(ticketID string, actor *User, remarks string) (*T
s.addNotification(createdBy, ticketID, "Ticket completed", fmt.Sprintf("%s was marked as completed by %s", ticketID, actor.Name), "complete")
}
if s.Broker != nil {
s.Broker.Broadcast("ticket_completed", ticketID, "", actor.Username, "complete", map[string]string{"remarks": remarks})
}
return s.GetTicket(ticketID)
}
@@ -1009,6 +1044,10 @@ func (s *Store) ArchiveTicket(ticketID string, actor *User) (*Ticket, error) {
VALUES ($1, $2, $3, $4, $5, 'archive', $6, $7)
`, remID, ticketID, actorUsername, actorName, actorRole, "Moved ticket to archive.", now)
if s.Broker != nil {
s.Broker.Broadcast("ticket_archived", ticketID, "", actorUsername, "archive", nil)
}
return s.GetTicket(ticketID)
}
@@ -1050,6 +1089,10 @@ func (s *Store) UnarchiveTicket(ticketID string, actor *User) (*Ticket, error) {
VALUES ($1, $2, $3, $4, $5, 'unarchive', $6, $7)
`, remID, ticketID, actorUsername, actorName, actorRole, "Restored ticket from archive.", now)
if s.Broker != nil {
s.Broker.Broadcast("ticket_unarchived", ticketID, "", actorUsername, "unarchive", nil)
}
return s.GetTicket(ticketID)
}
@@ -1080,6 +1123,10 @@ func (s *Store) ChangePriority(ticketID string, actor *User, priority, note stri
VALUES ($1, $2, $3, $4, $5, 'priority', $6, $7)
`, remID, ticketID, actor.Username, actor.Name, actor.RoleDisplay, remText, now)
if s.Broker != nil {
s.Broker.Broadcast("ticket_priority", ticketID, "", actor.Username, "priority", map[string]string{"priority": priority})
}
return s.GetTicket(ticketID)
}
@@ -1120,6 +1167,10 @@ func (s *Store) ReassignTicket(ticketID string, actor *User, newAssignee, note s
s.addNotification(newAssignee, ticketID, "Ticket reassigned to you", fmt.Sprintf("%s was reassigned to you by %s", ticketID, actor.Name), "assignment")
}
if s.Broker != nil {
s.Broker.Broadcast("ticket_reassigned", ticketID, "", actor.Username, "reassign", map[string]string{"assigned_to": newAssignee})
}
return s.GetTicket(ticketID)
}
@@ -1138,6 +1189,11 @@ func (s *Store) AddAttachment(ticketID string, actor *User, att Attachment) (*Ti
}
_, _ = s.primaryDB.Exec(`UPDATE tickets SET updated_at = $1 WHERE id = $2`, att.CreatedAt, ticketID)
if s.Broker != nil {
s.Broker.Broadcast("ticket_updated", ticketID, "", actor.Username, "attachment", nil)
}
return s.GetTicket(ticketID)
}
@@ -1155,6 +1211,11 @@ func (s *Store) AddLink(ticketID string, actor *User, link string) (*Ticket, err
}
_, _ = s.primaryDB.Exec(`UPDATE tickets SET updated_at = $1 WHERE id = $2`, now, ticketID)
if s.Broker != nil {
s.Broker.Broadcast("ticket_updated", ticketID, "", actor.Username, "link", nil)
}
return s.GetTicket(ticketID)
}
@@ -1168,6 +1229,10 @@ func (s *Store) addNotification(userID, ticketID, title, msg, notifType string)
INSERT INTO notifications (id, user_id, ticket_id, title, message, type, read, created_at)
VALUES ($1, $2, $3, $4, $5, $6, FALSE, $7)
`, id, strings.ToLower(userID), ticketID, title, msg, notifType, time.Now())
if s.Broker != nil {
s.Broker.Broadcast("notification", ticketID, "", strings.ToLower(userID), notifType, map[string]string{"title": title, "message": msg})
}
}
func (s *Store) GetNotifications(username string) []Notification {
@@ -1256,6 +1321,10 @@ func (s *Store) IngestError(errItem *AppError, actor *User) (*AppError, error) {
return nil, fmt.Errorf("failed to insert error: %w", err)
}
if s.Broker != nil {
s.Broker.Broadcast("error_logged", "", errItem.ID, "", "log", map[string]string{"app": errItem.AppName, "severity": errItem.Severity})
}
return errItem, nil
}
@@ -1411,6 +1480,14 @@ func (s *Store) UpdateErrorStatus(id string, status ErrorStatus, notes string, a
return nil, errors.New("error not found")
}
if s.Broker != nil {
actorName := "unknown"
if actor != nil {
actorName = actor.Username
}
s.Broker.Broadcast("error_updated", "", id, actorName, string(status), nil)
}
return s.GetError(id)
}
@@ -1429,6 +1506,15 @@ func (s *Store) ArchiveError(errorID string, actor *User) (*AppError, error) {
if err != nil {
return nil, err
}
if s.Broker != nil {
actorName := "unknown"
if actor != nil {
actorName = actor.Username
}
s.Broker.Broadcast("error_archived", "", errorID, actorName, "archive", nil)
}
return s.GetError(errorID)
}
@@ -1440,6 +1526,15 @@ func (s *Store) UnarchiveError(errorID string, actor *User) (*AppError, error) {
if n, _ := res.RowsAffected(); n == 0 {
return nil, errors.New("error not found")
}
if s.Broker != nil {
actorName := "unknown"
if actor != nil {
actorName = actor.Username
}
s.Broker.Broadcast("error_unarchived", "", errorID, actorName, "unarchive", nil)
}
return s.GetError(errorID)
}
@@ -1541,6 +1636,14 @@ func (s *Store) EscalateErrorToTicket(errorID, title, assignedTo, priority, note
// Link error
_, _ = s.primaryDB.Exec(`UPDATE errors SET linked_ticket_id = $1, status = 'investigating' WHERE id = $2`, created.ID, errorID)
if s.Broker != nil {
actorName := "unknown"
if actor != nil {
actorName = actor.Username
}
s.Broker.Broadcast("error_escalated", created.ID, errorID, actorName, "escalate", nil)
}
updatedErr, _ := s.GetError(errorID)
return created, updatedErr, nil
}
+136 -4
View File
@@ -380,7 +380,7 @@ function renderT(anim){
if(S.view==='board'){
put('#board',COLS.map(([k,c])=>{
const rows=f.filter(t=>st(t)===k||(!STAT[st(t)]&&k==='open'));
return`<section class="col"><h3><i style="--c:${c}"></i>${STAT[k]}<small>${rows.length}</small></h3>${rows.map((t,i)=>{
return`<section class="col" data-col="${k}"><h3><i style="--c:${c}"></i>${STAT[k]}<small>${rows.length}</small></h3>${rows.map((t,i)=>{
const p=pri(t),n=(t.remarks||[]).length;
const avElem=avHtml(t.assignee||{avatar:t.assigned_to_avatar||'👤',role:t.assigned_to_role,username:t.assigned_to},26);
const isSel=S.bulkSelected.has(t.id);
@@ -400,7 +400,7 @@ function renderT(anim){
const tagsHtml=(t.tags||[]).length?`<div class="tag-list" style="margin-top:6px">${t.tags.map(tg=>`<span class="tag-pill">${esc(tg)}</span>`).join('')}</div>`:'';
return`<article class="card p-${p.toLowerCase()} ${isSel?'selected':''}" tabindex="0" role="button" data-t="${esc(t.id)}" style="--i:${i}">
return`<article class="card p-${p.toLowerCase()} ${isSel?'selected':''}" draggable="true" tabindex="0" role="button" data-t="${esc(t.id)}" style="--i:${i}">
${chkBox}
<div class="r"><span class="id">${esc(t.id)}</span><span class="tag">${t.ticket_type==='general'?'General':'App'}</span><span class="pb ${p.toLowerCase()}">${p}</span></div>
<h4>${esc(t.title)}</h4>
@@ -410,6 +410,8 @@ function renderT(anim){
</article>`;
}).join('')||'<div class="empty">No tickets</div>'}</section>`;
}).join(''));
initBoardDragDrop();
}else{
const dateGroups=['Today','Yesterday','This Week','Earlier this Month','Older'];
const grouped={};
@@ -438,6 +440,63 @@ function renderT(anim){
put('#title','Tickets');
}
function initBoardDragDrop(){
const cards = $$('#board .card');
const cols = $$('#board .col');
cards.forEach(card => {
card.addEventListener('dragstart', e => {
e.dataTransfer.setData('text/plain', card.dataset.t);
e.dataTransfer.effectAllowed = 'move';
card.classList.add('dragging');
});
card.addEventListener('dragend', () => {
card.classList.remove('dragging');
});
});
cols.forEach(col => {
col.addEventListener('dragover', e => {
e.preventDefault();
e.dataTransfer.dropEffect = 'move';
col.classList.add('drop-hover');
});
col.addEventListener('dragleave', e => {
if (!col.contains(e.relatedTarget)) {
col.classList.remove('drop-hover');
}
});
col.addEventListener('drop', async e => {
e.preventDefault();
col.classList.remove('drop-hover');
const tid = e.dataTransfer.getData('text/plain');
const targetCol = col.dataset.col;
if (!tid || !targetCol) return;
const t = S.t.find(x => x.id === tid);
if (!t) return;
const curSt = st(t);
if (curSt === targetCol) return;
if (targetCol === 'completed') {
S.tid = tid;
doneD();
} else if (targetCol === 'hold') {
S.tid = tid;
holdD();
} else if (targetCol === 'progress') {
await api(`/khira/api/tickets/${encodeURIComponent(tid)}/resume`, 'POST', { remarks: 'Moved to In Progress' });
toast(`Ticket ${tid} moved to In Progress`);
await refresh(false);
} else if (targetCol === 'open') {
await api(`/khira/api/tickets/${encodeURIComponent(tid)}/resume`, 'POST', { remarks: 'Moved to Open' });
toast(`Ticket ${tid} moved to Open`);
await refresh(false);
}
});
});
}
/* ── Errors View ── */
function renderE(anim){
const s=S.es;
@@ -973,7 +1032,8 @@ async function remark(){
if(!b){toast('Write a remark first','err');return}
const r=await api(`/khira/api/tickets/${encodeURIComponent(S.tid)}/remarks`,'POST',{text:b,body:b,links:[]});
if(r._f){toast(r.error,'err');return}
toast('Remark posted');await refresh();sheet(S.tid);
ta.value='';
toast('Remark posted');await refresh(false);sheet(S.tid);
}
const holdD=()=>dlg({title:'Put ticket on hold',sub:'Say what is blocking this ticket.',body:fld('reason','Reason',{t:'area',rows:4,req:1}),ok:'Hold ticket',go:v=>act('hold',{reason:v.reason},'Ticket on hold')});
@@ -1821,6 +1881,77 @@ $('#btnForgot')?.addEventListener('click',()=>{
});
});
/* ── Realtime SSE Engine ── */
let sseSource = null;
let sseReconnectTimer = null;
function updateLiveStatus(online) {
const pill = $('#livePill');
if (!pill) return;
pill.classList.toggle('online', !!online);
pill.classList.toggle('offline', !online);
const lbl = pill.querySelector('.live-lbl');
if (lbl) lbl.textContent = online ? 'Live' : 'Reconnecting...';
}
function initRealtime() {
if (sseSource) {
try { sseSource.close(); } catch(e) {}
sseSource = null;
}
const un = S.u?.username || ls('khira_active_user');
const url = un ? `/khira/api/events?u=${encodeURIComponent(un)}` : '/khira/api/events';
sseSource = new EventSource(url);
sseSource.addEventListener('connected', () => {
updateLiveStatus(true);
});
sseSource.addEventListener('message', async (e) => {
try {
const evt = JSON.parse(e.data);
handleRealtimeEvent(evt);
} catch(err) {
console.warn('Realtime event parse error', err);
}
});
sseSource.onerror = () => {
updateLiveStatus(false);
if (sseSource && sseSource.readyState === EventSource.CLOSED) {
clearTimeout(sseReconnectTimer);
sseReconnectTimer = setTimeout(initRealtime, 3000);
}
};
}
async function handleRealtimeEvent(evt) {
const tId = evt.ticket_id;
// 1. Refresh background datasets silently without layout flicker
await refresh(false);
// 2. If the user currently has the affected ticket sheet open:
if (S.tid && tId && S.tid === tId && $('#sheet')?.open) {
sheet(S.tid);
}
// 3. If currently on Analytics view:
if (S.sec === 'analytics') {
renderA(false);
}
// 4. Subtle visual highlight on affected card
if (tId) {
const card = document.querySelector(`.card[data-t="${tId}"]`);
if (card) {
card.classList.add('live-flash');
setTimeout(() => card.classList.remove('live-flash'), 1200);
}
}
}
/* ── App Initialization ── */
async function boot(u){
S.u=u;
@@ -1828,9 +1959,10 @@ async function boot(u){
$('#app').hidden=false;
updateMe(u);
initKubeLens();
initRealtime();
await refresh(true);
clearInterval(pollId);
pollId=setInterval(()=>refresh(false),8000);
pollId=setInterval(()=>refresh(false),30000);
}
(async function init(){
+9 -3
View File
@@ -9,7 +9,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Flex:wght@400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/khira/styles.css?v=3">
<link rel="stylesheet" href="/khira/styles.css?v=4">
<script>try{document.documentElement.dataset.theme=localStorage.khira_theme||'dark'}catch(e){}</script>
</head>
<body>
@@ -71,7 +71,13 @@
<div class="main">
<header class="bar">
<h1 id="title">Tickets</h1>
<div style="display:flex;align-items:center">
<h1 id="title">Tickets</h1>
<div id="livePill" class="live-status-pill online" title="Real-time connected: Live updates streaming without refresh">
<span class="live-dot"><span class="live-pulse"></span></span>
<span class="live-lbl">Live</span>
</div>
</div>
<span class="sp"></span>
<div id="adminDbTools" class="tr" hidden>
<button class="chip db-btn sync" id="btnSyncBackup" title="Sync Primary DB to Backup DB"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-right:5px;vertical-align:middle"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg><span class="btn-txt">Backup DB</span></button>
@@ -240,6 +246,6 @@
<dialog id="sheet"></dialog>
<dialog id="dlg"></dialog>
<div class="snack" id="snack" role="status"></div>
<script src="/khira/app.js?v=3" defer></script>
<script src="/khira/app.js?v=4" defer></script>
</body>
</html>
+75
View File
@@ -2319,3 +2319,78 @@ dd { word-break: break-word; }
}
.scorecard-item .val.green { color: #10b981; }
.scorecard-item .val.red { color: #ef4444; }
/* ── Realtime Live Status Indicator ── */
.live-status-pill {
display: inline-flex;
align-items: center;
gap: 7px;
padding: 4px 10px;
border-radius: 999px;
background: rgba(16, 185, 129, 0.12);
border: 1px solid rgba(52, 211, 153, 0.3);
color: #34d399;
font-size: 11px;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
margin-left: 14px;
transition: all 0.3s ease;
user-select: none;
}
.live-status-pill.offline {
background: rgba(245, 158, 11, 0.12);
border-color: rgba(251, 191, 36, 0.3);
color: #fbbf24;
}
.live-dot {
position: relative;
width: 8px;
height: 8px;
border-radius: 50%;
background: #10b981;
}
.live-status-pill.offline .live-dot {
background: #f59e0b;
}
.live-pulse {
position: absolute;
top: -3px;
left: -3px;
right: -3px;
bottom: -3px;
border-radius: 50%;
background: rgba(16, 185, 129, 0.5);
animation: live-pulse-anim 2s infinite ease-out;
}
.live-status-pill.offline .live-pulse {
background: rgba(245, 158, 11, 0.5);
}
@keyframes live-pulse-anim {
0% { transform: scale(0.8); opacity: 0.9; }
100% { transform: scale(2.2); opacity: 0; }
}
/* ── Realtime Flash Animation on Board/List ── */
@keyframes card-flash-anim {
0% { box-shadow: 0 0 0 2px #38bdf8, 0 0 20px rgba(56, 189, 248, 0.4); transform: scale(1.02); }
100% { box-shadow: none; transform: scale(1); }
}
.card.live-flash, .li.live-flash {
animation: card-flash-anim 1.2s ease-out;
}
/* ── HTML5 Drag & Drop Styling ── */
.card[draggable="true"] {
cursor: grab;
}
.card.dragging {
opacity: 0.45;
transform: scale(0.96);
cursor: grabbing;
}
.col.drop-hover {
background: rgba(56, 189, 248, 0.08) !important;
border: 1px dashed rgba(56, 189, 248, 0.5) !important;
border-radius: 18px !important;
}