[feat] negodata: 알림함 — 견적 마감 결과(낙찰/재생성/결렬) 자동 통지
- company.notifications 테이블 + NotificationType(SUCCESS/REGENERATED/FAILURE) - 백엔드 알림 조회/읽음 API + close_and_decide 결과 분기마다 알림 생성 - 헤더 알림 벨(안읽음 배지) + 알림 페이지(읽음·딥링크) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b42cc41b5e
commit
1d111a031e
30 files changed
+995
-3
No files matched your search
@@ -11,6 +11,7 @@ const PAGE_TO_PATH: Record<PageType, string> = {
|
||||
QUOTATION: '/quotation',
|
||||
CARDS: '/cards',
|
||||
MEMBERS: '/members',
|
||||
NOTIFICATIONS: '/notifications',
|
||||
};
|
||||
|
||||
export default function AuthenticatedLayout() {
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Typography } from '@/components/ui/typography';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { NotificationBell } from './NotificationBell';
|
||||
import {
|
||||
LayoutDashboard,
|
||||
Briefcase,
|
||||
@@ -49,6 +50,7 @@ const pageLabelMap: Record<PageType, string> = {
|
||||
QUOTATION: '견적관리',
|
||||
CARDS: '협상카드관리',
|
||||
MEMBERS: '회원관리',
|
||||
NOTIFICATIONS: '알림',
|
||||
};
|
||||
|
||||
export default function Layout({ children, currentPage, setPage, onLogout }: LayoutProps) {
|
||||
@@ -215,7 +217,10 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
|
||||
</Typography>
|
||||
</div>
|
||||
|
||||
<HeaderMeta user={user} today={today} />
|
||||
<div className="flex items-center gap-3 md:gap-4">
|
||||
<NotificationBell />
|
||||
<HeaderMeta user={user} today={today} />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{/* Content Body Area */}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Bell } from 'lucide-react';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { useListNotifications } from '@/api/generated/notification/notification';
|
||||
|
||||
// 헤더 알림벨. 안읽음 수를 빨간 배지(빨콩이)로 표시하고, 클릭 시 알림 페이지로 이동.
|
||||
// 30초마다 안읽음 수 재조회(가벼운 폴링).
|
||||
export function NotificationBell() {
|
||||
const navigate = useNavigate();
|
||||
const { data } = useListNotifications({ size: 1 }, { query: { refetchInterval: 30000 } });
|
||||
const unread = data?.unread ?? 0;
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => navigate('/notifications')}
|
||||
title="알림"
|
||||
aria-label={unread > 0 ? `알림 ${unread}건 안읽음` : '알림'}
|
||||
className="relative p-1.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors cursor-pointer"
|
||||
>
|
||||
<Bell size={18} />
|
||||
{unread > 0 && (
|
||||
<span className="absolute -top-0.5 -right-0.5 min-w-4 h-4 px-1 flex items-center justify-center rounded-full bg-destructive text-destructive-foreground text-[10px] font-bold leading-none">
|
||||
{unread > 99 ? '99+' : unread}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user