Files
FabledScribe/frontend/src/components/NotificationBell.vue
T
bvandeusenandClaude Opus 5 4c9a637507
CI & Build / Python lint (push) Successful in 4s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / integration (push) Successful in 29s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Successful in 55s
CI & Build / Build & push image (push) Successful in 41s
fix(theme): text on a filled colour needs its own token — the old one inverts
76 hardcoded `color: #fff` now resolve to --fs-text-on-action, a new token
that is parchment in BOTH modes.

The design system said they should supersede to --fs-text-primary, on the
recorded reasoning that "there is no 'text on action' colour, there is just the
text colour." That is true on dark and wrong on light. --fs-text-primary
inverts to #14171A; the surfaces underneath it do not invert at all — every one
of these 76 sits on an action colour, a semantic colour, the accent, or the CTA
gradient, all of which hold a single value across modes.

Sweeping as recorded would have put obsidian text on moss green: roughly 2.4:1,
against a house style whose stated floor is WCAG AA. It would have looked
correct to me, because I checked it in the mode where it was correct.

--color-accent-fg had the same defect independently and is repointed too.

The token check now reports zero superseded literals, down from 30 files, and
raw colour literals drop 246 -> 169.

Closes #2275.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UaYUaouG9jjhATyuxCKrQs
2026-07-31 22:40:58 -04:00

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, #ef4444);
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>