Files
katelyatv/src/components/HubBell.tsx
T
3970260761 54fdea4f84
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / docker (push) Canceled after 0s
fixed73: 通知切授权公告+右上角版本号全页显示
- 首页旧公告弹窗彻底拆除(page.tsx: 删JSX/useSite/showAnnouncement/handleCloseAnnouncement残留)
- layout授权覆盖顺序修复: 先getConfig再hub.getNotice覆盖, 授权公告优先
- HubBell只发open-hub-notice事件, 不再清hasSeenAnnouncement/跳首页
- HubNotice支持铃铛手动打开: 公告/首条/版本兜底, 空指针修复
- 版本号三处补齐: TopRightButtons bar+float, MobileHeader移动端, 对齐fixed73
2026-11-08 00:19:48 +08:00

50 lines
1.6 KiB
TypeScript

'use client';
import { useEffect } from 'react';
export default function HubBell({ forceShow = false }: { forceShow?: boolean }) {
useEffect(() => {
const t = setTimeout(() => {
fetch('/api/license-config', { cache: 'no-store' })
.then((r) => r.json())
.then((j) => {
try {
const a = j && j.data && j.data.announcement;
if (!a) return;
const seen = JSON.parse(
localStorage.getItem('hub_seen') || '{}'
);
if (!seen['a' + a.id]) {
const d = document.querySelector('.mv-bell-dot');
if (d) (d as HTMLElement).style.display = 'block';
}
} catch {}
})
.catch(() => {});
}, 1500);
return () => clearTimeout(t);
}, []);
return (
<button
onClick={() => {
try {
window.dispatchEvent(new CustomEvent('open-hub-notice'));
} catch {}
}}
title='公告通知'
className={
forceShow
? 'relative flex items-center justify-center w-8 h-8 rounded-lg text-base text-gray-200 hover:text-white hover:bg-white/10 transition-colors duration-200'
: 'relative hidden md:flex items-center justify-center w-8 h-8 rounded-lg text-base text-gray-500 hover:text-purple-600 hover:bg-purple-500/10 dark:text-gray-400 dark:hover:text-purple-400 transition-colors duration-200'
}
>
<span className='leading-none'>🔔</span>
<span
className='mv-bell-dot absolute top-1.5 right-1.5 w-2 h-2 bg-red-500 rounded-full'
style={{ display: 'none' }}
/>
</button>
);
}