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;
|
appNotificationTitle?: string;
|
||||||
appNotificationContent?: string;
|
appNotificationContent?: string;
|
||||||
appNotificationLink?: string;
|
appNotificationLink?: string;
|
||||||
appNotificationCategories: Array<any>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AlarmItem = ({
|
export const AlarmItem = ({
|
||||||
@@ -24,8 +23,7 @@ export const AlarmItem = ({
|
|||||||
notificationReceivedDate,
|
notificationReceivedDate,
|
||||||
appNotificationTitle,
|
appNotificationTitle,
|
||||||
appNotificationContent,
|
appNotificationContent,
|
||||||
appNotificationLink,
|
appNotificationLink
|
||||||
appNotificationCategories
|
|
||||||
}: AlarmItemProps) => {
|
}: AlarmItemProps) => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -36,10 +34,16 @@ export const AlarmItem = ({
|
|||||||
const [appNotificationCategoryName, setAppNotificationCategoryName] = useState<string>('');
|
const [appNotificationCategoryName, setAppNotificationCategoryName] = useState<string>('');
|
||||||
|
|
||||||
const getCategoryName = () => {
|
const getCategoryName = () => {
|
||||||
let myCategory = appNotificationCategories.filter((value, index) => {
|
const categoryMap: { [key: string]: string } = {
|
||||||
return value.code1 === appNotificationCategory;
|
'10': t('alarm.categories.benefits'),
|
||||||
});
|
'20': t('alarm.categories.notice'),
|
||||||
return myCategory[0].desc1;
|
'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 = () => {
|
const onClickToNavigate = () => {
|
||||||
let path = PATHS.support.notice.list + appNotificationSequence;
|
let path = PATHS.support.notice.list + appNotificationSequence;
|
||||||
|
|||||||
@@ -12,12 +12,10 @@ import { DefaultRequestPagination } from '@/entities/common/model/types';
|
|||||||
|
|
||||||
export interface AlarmListProps {
|
export interface AlarmListProps {
|
||||||
appNotificationCategory: string;
|
appNotificationCategory: string;
|
||||||
appNotificationCategories: Array<any>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AlarmList = ({
|
export const AlarmList = ({
|
||||||
appNotificationCategory,
|
appNotificationCategory
|
||||||
appNotificationCategories
|
|
||||||
}: AlarmListProps) => {
|
}: AlarmListProps) => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -100,13 +98,13 @@ export const AlarmList = ({
|
|||||||
for(let i=0;i<resultList.length;i++){
|
for(let i=0;i<resultList.length;i++){
|
||||||
rs.push(
|
rs.push(
|
||||||
<AlarmItem
|
<AlarmItem
|
||||||
|
key={i}
|
||||||
appNotificationSequence={ resultList[i]?.appNotificationSequence }
|
appNotificationSequence={ resultList[i]?.appNotificationSequence }
|
||||||
appNotificationCategory={ resultList[i]?.appNotificationCategory }
|
appNotificationCategory={ resultList[i]?.appNotificationCategory }
|
||||||
notificationReceivedDate={ resultList[i]?.notificationReceivedDate }
|
notificationReceivedDate={ resultList[i]?.notificationReceivedDate }
|
||||||
appNotificationTitle={ resultList[i]?.appNotificationTitle }
|
appNotificationTitle={ resultList[i]?.appNotificationTitle }
|
||||||
appNotificationContent={ resultList[i]?.appNotificationContent }
|
appNotificationContent={ resultList[i]?.appNotificationContent }
|
||||||
appNotificationLink={ resultList[i]?.appNotificationLink }
|
appNotificationLink={ resultList[i]?.appNotificationLink }
|
||||||
appNotificationCategories={ appNotificationCategories }
|
|
||||||
></AlarmItem>
|
></AlarmItem>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ export const ListPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<AlarmList
|
<AlarmList
|
||||||
appNotificationCategory={ appNotificationCategory }
|
appNotificationCategory={ appNotificationCategory }
|
||||||
appNotificationCategories={ appNotificationCategories }
|
|
||||||
></AlarmList>
|
></AlarmList>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
Reference in New Issue
Block a user