feat: 신규거래처 알림에 신용등급 배지 추가

- TodayIssueListBadgeType에 '신규거래처' 타입 추가
- 신규거래처 뱃지 색상 추가 (emerald)
- 신용등급 배지 버튼 추가 (A~D 랜덤, 색상: A=녹색, B=노랑, C=주황, D=빨강)
- VALID_BADGE_TYPES에 '신규거래처' 추가
- 필터 옵션에 '신규거래처' 추가
This commit is contained in:
2026-01-23 14:11:10 +09:00
parent e098fea558
commit e3043a3f0d
4 changed files with 48 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ const ISSUE_BADGE_COLORS: Record<TodayIssueListBadgeType, string> = {
'지출예상내역서': 'bg-green-100 text-green-700',
'세금 신고': 'bg-red-100 text-red-700',
'결재 요청': 'bg-yellow-100 text-yellow-700',
'신규거래처': 'bg-emerald-100 text-emerald-700',
'기타': 'bg-gray-100 text-gray-700',
};

View File

@@ -23,9 +23,25 @@ const BADGE_COLORS: Record<TodayIssueListBadgeType, string> = {
'지출예상내역서': 'bg-green-100 text-green-700 hover:bg-green-100',
'세금 신고': 'bg-red-100 text-red-700 hover:bg-red-100',
'결재 요청': 'bg-yellow-100 text-yellow-700 hover:bg-yellow-100',
'신규거래처': 'bg-emerald-100 text-emerald-700 hover:bg-emerald-100',
'기타': 'bg-gray-100 text-gray-700 hover:bg-gray-100',
};
// 신용등급 색상 매핑 (A=녹색, B=노랑, C=주황, D=빨강)
type CreditRating = 'A' | 'B' | 'C' | 'D';
const CREDIT_RATING_COLORS: Record<CreditRating, string> = {
A: 'bg-green-500 hover:bg-green-600 text-white',
B: 'bg-yellow-500 hover:bg-yellow-600 text-white',
C: 'bg-orange-500 hover:bg-orange-600 text-white',
D: 'bg-red-500 hover:bg-red-600 text-white',
};
// 랜덤 신용등급 생성 (A~D)
const getRandomCreditRating = (): CreditRating => {
const ratings: CreditRating[] = ['A', 'B', 'C', 'D'];
return ratings[Math.floor(Math.random() * ratings.length)];
};
// 필터 옵션 키
const FILTER_KEYS = [
'all',
@@ -35,6 +51,7 @@ const FILTER_KEYS = [
'지출예상내역서',
'세금 신고',
'결재 요청',
'신규거래처',
] as const;
interface TodayIssueSectionProps {
@@ -49,6 +66,17 @@ export function TodayIssueSection({ items }: TodayIssueSectionProps) {
// 확인되지 않은 아이템만 필터링
const activeItems = items.filter((item) => !dismissedIds.has(item.id));
// 신규거래처 아이템별 랜덤 신용등급 생성 (세션 동안 유지)
const creditRatings = useMemo(() => {
const ratings: Record<string, CreditRating> = {};
items.forEach((item) => {
if (item.badge === '신규거래처') {
ratings[item.id] = getRandomCreditRating();
}
});
return ratings;
}, [items]);
// 항목별 수량 계산
const itemCounts = useMemo(() => {
const counts: Record<string, number> = { all: activeItems.length };
@@ -150,6 +178,23 @@ export function TodayIssueSection({ items }: TodayIssueSectionProps) {
{item.content}
</span>
{/* 신용등급 배지 (신규거래처인 경우) */}
{item.badge === '신규거래처' && creditRatings[item.id] && (
<Button
size="sm"
className={`h-6 px-2 text-xs shrink-0 ${CREDIT_RATING_COLORS[creditRatings[item.id]]}`}
onClick={(e) => {
e.stopPropagation();
// API에서 이미 ?modal=credit 포함된 path 사용
if (item.path) {
router.push(item.path);
}
}}
>
{creditRatings[item.id]}
</Button>
)}
{/* 시간 */}
<span className="text-xs text-gray-500 whitespace-nowrap shrink-0">
{item.time}

View File

@@ -64,6 +64,7 @@ export type TodayIssueListBadgeType =
| '지출예상내역서'
| '세금 신고'
| '결재 요청'
| '신규거래처'
| '기타';
// 오늘의 이슈 리스트 아이템 (리스트 형태 - 새로운 오늘의 이슈용)

View File

@@ -577,6 +577,7 @@ const VALID_BADGE_TYPES: TodayIssueListBadgeType[] = [
'지출예상내역서',
'세금 신고',
'결재 요청',
'신규거래처',
'기타',
];