diff --git a/src/locales/en.json b/src/locales/en.json index 473ebba..36f1693 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1301,7 +1301,16 @@ "title": "Notifications", "all": "All", "retentionNotice": "※ Notifications are kept for 90 days and then deleted.", - "goTo": "Go to {{category}}" + "goTo": "Go to {{category}}", + "categories": { + "benefits": "Benefits/Events", + "notice": "Notice", + "serviceGuide": "Service Guide", + "etc": "Others", + "settlement": "Settlement", + "settlementStatus": "Settlement Status", + "settlementLimit": "Settlement Limit" + } }, "faceAuth": { "title": "Face Authentication" diff --git a/src/locales/ko.json b/src/locales/ko.json index d3b1ab0..186a22a 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -1278,7 +1278,16 @@ "title": "알림함", "all": "전체", "retentionNotice": "※ 알림은 90일간 보관 후 삭제됩니다.", - "goTo": "{{category}} 바로가기" + "goTo": "{{category}} 바로가기", + "categories": { + "benefits": "혜택/이벤트", + "notice": "공지사항", + "serviceGuide": "서비스안내", + "etc": "기타", + "settlement": "정산", + "settlementStatus": "정산 현황", + "settlementLimit": "정산 한도" + } }, "faceAuth": { "title": "안면인증" diff --git a/src/pages/alarm/list/list-page.tsx b/src/pages/alarm/list/list-page.tsx index a115720..cf06a78 100644 --- a/src/pages/alarm/list/list-page.tsx +++ b/src/pages/alarm/list/list-page.tsx @@ -20,11 +20,32 @@ export const ListPage = () => { const [appNotificationCategory, setAppNotificationCategory] = useState(''); + const getCategoryLabel = (code1: string) => { + const categoryMap: { [key: string]: string } = { + '10': t('alarm.categories.benefits'), + '20': t('alarm.categories.notice'), + '30': t('alarm.categories.serviceGuide'), + '40': t('alarm.categories.etc'), + '60': t('alarm.categories.settlement'), + '61': t('alarm.categories.settlementStatus'), + '62': t('alarm.categories.settlementLimit') + }; + return categoryMap[code1] || ''; + }; + const resetAlarmCategories = () => { if(appNotificationCategories){ let newAppNotificationCategories = appNotificationCategories.filter((value, index) => { return value.code1 !== '****' && value.code2 === '*'; }); + + // '기타' 카테고리(code1 === '40')를 맨 마지막으로 이동 + newAppNotificationCategories.sort((a, b) => { + if (a.code1 === '40') return 1; + if (b.code1 === '40') return -1; + return 0; + }); + console.log(newAppNotificationCategories) setAppNotificationCategories(newAppNotificationCategories); } @@ -33,6 +54,10 @@ export const ListPage = () => { useEffect(() => { resetAlarmCategories(); }, [totalAppNotificationCategories]) + + useEffect(() => { + console.log('totalAppNotificationCategories', totalAppNotificationCategories); + }, [totalAppNotificationCategories]); return ( <> @@ -45,10 +70,11 @@ export const ListPage = () => { >{t('alarm.all')} { !!appNotificationCategories && appNotificationCategories.map((value, index) => ( - + >{ getCategoryLabel(value.code1) } )) }