Apply localization to alarm category labels in alarm entities
- Update alarm-item.tsx to use locale keys for category names instead of API desc1 - Remove unused appNotificationCategories prop from alarm components - Add React key prop to AlarmItem in alarm-list.tsx - Align alarm entity category display with list-page implementation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,6 @@ export interface AlarmItemProps {
|
||||
appNotificationTitle?: string;
|
||||
appNotificationContent?: string;
|
||||
appNotificationLink?: string;
|
||||
appNotificationCategories: Array<any>;
|
||||
};
|
||||
|
||||
export const AlarmItem = ({
|
||||
@@ -24,8 +23,7 @@ export const AlarmItem = ({
|
||||
notificationReceivedDate,
|
||||
appNotificationTitle,
|
||||
appNotificationContent,
|
||||
appNotificationLink,
|
||||
appNotificationCategories
|
||||
appNotificationLink
|
||||
}: AlarmItemProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
@@ -36,10 +34,16 @@ export const AlarmItem = ({
|
||||
const [appNotificationCategoryName, setAppNotificationCategoryName] = useState<string>('');
|
||||
|
||||
const getCategoryName = () => {
|
||||
let myCategory = appNotificationCategories.filter((value, index) => {
|
||||
return value.code1 === appNotificationCategory;
|
||||
});
|
||||
return myCategory[0].desc1;
|
||||
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[appNotificationCategory || ''] || '';
|
||||
};
|
||||
const onClickToNavigate = () => {
|
||||
let path = PATHS.support.notice.list + appNotificationSequence;
|
||||
|
||||
@@ -12,12 +12,10 @@ import { DefaultRequestPagination } from '@/entities/common/model/types';
|
||||
|
||||
export interface AlarmListProps {
|
||||
appNotificationCategory: string;
|
||||
appNotificationCategories: Array<any>;
|
||||
};
|
||||
|
||||
export const AlarmList = ({
|
||||
appNotificationCategory,
|
||||
appNotificationCategories
|
||||
appNotificationCategory
|
||||
}: AlarmListProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
@@ -100,13 +98,13 @@ export const AlarmList = ({
|
||||
for(let i=0;i<resultList.length;i++){
|
||||
rs.push(
|
||||
<AlarmItem
|
||||
key={i}
|
||||
appNotificationSequence={ resultList[i]?.appNotificationSequence }
|
||||
appNotificationCategory={ resultList[i]?.appNotificationCategory }
|
||||
notificationReceivedDate={ resultList[i]?.notificationReceivedDate }
|
||||
appNotificationTitle={ resultList[i]?.appNotificationTitle }
|
||||
appNotificationContent={ resultList[i]?.appNotificationContent }
|
||||
appNotificationLink={ resultList[i]?.appNotificationLink }
|
||||
appNotificationCategories={ appNotificationCategories }
|
||||
></AlarmItem>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,6 @@ export const ListPage = () => {
|
||||
</div>
|
||||
<AlarmList
|
||||
appNotificationCategory={ appNotificationCategory }
|
||||
appNotificationCategories={ appNotificationCategories }
|
||||
></AlarmList>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user