CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 16s
CI & Build / integration (push) Successful in 23s
CI & Build / TypeScript typecheck (push) Successful in 25s
CI & Build / Python tests (push) Successful in 57s
CI & Build / Build & push image (push) Successful in 43s
#2277 counted ~150 "raw colour literals bypassing the tokens". Measuring them told a different story: 184 sat in `var(--token, #fallback)` position, and a check against theme.css shows every one of those tokens IS declared. So the fallbacks could not render. Not drift — vestigial. They were also not this palette. The most common were Tailwind and Flat-UI defaults — #6366f1 indigo, #22c55e green, #f59e0b amber, #3b82f6 blue, #e74c3c and #27ae60 — a second, unsanctioned colour scheme sitting in the codebase looking like the app's colours to anyone reading it. Removing them is not tidying. #2319's lesson is that a fallback is WORSE than a missing token: a missing token renders as nothing and someone eventually notices, while a fallback renders something plausible forever. These 184 were one token rename away from silently repainting the app in Tailwind. The design token check would catch the rename — but the fallback is precisely the thing that would make it invisible if the check were ever bypassed. Literal count 152 -> 45, which matters beyond the number: a report that is mostly unreachable noise is one people stop reading, and then it stops working while still passing. What remains should be genuinely worth looking at. Done with a paren-aware transform, not a regex — `var(--x, rgba(0,0,0,.5))` nests parens and `[^)]+` would cut at the first one and leave `))` behind. Verified after: every changed line is a fallback strip and nothing else, and every var() reference still resolves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UaYUaouG9jjhATyuxCKrQs
99 lines
2.3 KiB
Vue
99 lines
2.3 KiB
Vue
<script setup lang="ts">
|
|
import { ref, onMounted, onUnmounted } from 'vue'
|
|
import { useNotificationsStore } from '@/stores/notifications'
|
|
import NotificationsPanel from './NotificationsPanel.vue'
|
|
import { Bell } from 'lucide-vue-next'
|
|
|
|
const store = useNotificationsStore()
|
|
const open = ref(false)
|
|
const wrapRef = ref<HTMLElement | null>(null)
|
|
|
|
let pollInterval: ReturnType<typeof setInterval> | null = null
|
|
|
|
function toggle() {
|
|
open.value = !open.value
|
|
if (open.value) store.fetchAll()
|
|
}
|
|
|
|
function close() {
|
|
open.value = false
|
|
}
|
|
|
|
function onDocClick(e: MouseEvent) {
|
|
if (open.value && wrapRef.value && !wrapRef.value.contains(e.target as Node)) {
|
|
close()
|
|
}
|
|
}
|
|
|
|
onMounted(() => {
|
|
store.fetchCount()
|
|
pollInterval = setInterval(() => store.fetchCount(), 60_000)
|
|
document.addEventListener('click', onDocClick, true)
|
|
})
|
|
|
|
onUnmounted(() => {
|
|
if (pollInterval) clearInterval(pollInterval)
|
|
document.removeEventListener('click', onDocClick, true)
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div class="bell-wrap" ref="wrapRef">
|
|
<button
|
|
class="btn-bell"
|
|
:class="{ active: open }"
|
|
@click="toggle"
|
|
aria-label="Notifications"
|
|
:title="`${store.count} unread notification${store.count !== 1 ? 's' : ''}`"
|
|
>
|
|
<Bell :size="16" aria-hidden="true" />
|
|
<span v-if="store.count > 0" class="bell-badge" aria-live="polite">{{ store.count > 99 ? '99+' : store.count }}</span>
|
|
</button>
|
|
<NotificationsPanel v-if="open" @close="close" />
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.bell-wrap {
|
|
position: relative;
|
|
}
|
|
|
|
.btn-bell {
|
|
background: none;
|
|
border: 1px solid var(--color-border);
|
|
border-radius: var(--radius-sm);
|
|
padding: 0.25rem 0.45rem;
|
|
cursor: pointer;
|
|
color: var(--color-text-muted);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: relative;
|
|
}
|
|
.btn-bell:hover,
|
|
.btn-bell.active {
|
|
background: var(--color-bg-card);
|
|
color: var(--color-text);
|
|
border-color: var(--color-primary);
|
|
}
|
|
|
|
.bell-badge {
|
|
position: absolute;
|
|
top: -5px;
|
|
right: -5px;
|
|
background: var(--color-danger);
|
|
color: var(--fs-text-on-action);
|
|
font-size: 0.6rem;
|
|
font-weight: 700;
|
|
min-width: 16px;
|
|
height: 16px;
|
|
border-radius: 8px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 0 3px;
|
|
line-height: 1;
|
|
pointer-events: none;
|
|
}
|
|
</style>
|