알림 수정
This commit is contained in:
@@ -5,6 +5,7 @@ import moment from 'moment';
|
||||
import { useAppAlarmMarkMutation } from '../api/use-app-alarm-mark-mutation';
|
||||
import { AppAlarmMarkParams, AppAlarmMarkResponse } from '../model/types';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export interface AlarmItemProps {
|
||||
appNotificationSequence?: number;
|
||||
@@ -13,6 +14,7 @@ export interface AlarmItemProps {
|
||||
appNotificationTitle?: string;
|
||||
appNotificationContent?: string;
|
||||
appNotificationLink?: string;
|
||||
appNotificationCategories: Array<any>;
|
||||
};
|
||||
|
||||
export const AlarmItem = ({
|
||||
@@ -21,13 +23,22 @@ export const AlarmItem = ({
|
||||
notificationReceivedDate,
|
||||
appNotificationTitle,
|
||||
appNotificationContent,
|
||||
appNotificationLink
|
||||
appNotificationLink,
|
||||
appNotificationCategories
|
||||
}: AlarmItemProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
|
||||
let userInfo = useStore.getState().UserStore.userInfo;
|
||||
const {mutateAsync: appAlarmMark} = useAppAlarmMarkMutation();
|
||||
|
||||
const [appNotificationCategoryName, setAppNotificationCategoryName] = useState<string>('');
|
||||
|
||||
const getCategoryName = () => {
|
||||
let myCategory = appNotificationCategories.filter((value, index) => {
|
||||
return value.code1 === appNotificationCategory;
|
||||
});
|
||||
return myCategory[0].desc1;
|
||||
};
|
||||
const onClickToNavigate = () => {
|
||||
let path = PATHS.support.notice.detail + appNotificationSequence;
|
||||
let pathState = {};
|
||||
@@ -39,21 +50,27 @@ export const AlarmItem = ({
|
||||
console.log('appNotificationContent : [' + appNotificationContent + ']');
|
||||
console.log('appNotificationLink : [' + appNotificationLink + ']');
|
||||
|
||||
if(appNotificationCategory === '10'){
|
||||
if(appNotificationLink){
|
||||
path = appNotificationLink;
|
||||
/*
|
||||
if(appNotificationCategory === '10'){
|
||||
|
||||
}
|
||||
else if(appNotificationCategory === '20'){
|
||||
|
||||
}
|
||||
else if(appNotificationCategory === '20'){
|
||||
}
|
||||
else if(appNotificationCategory === '30'){
|
||||
|
||||
}
|
||||
else if(appNotificationCategory === '30'){
|
||||
}
|
||||
else if(appNotificationCategory === '40'){
|
||||
|
||||
}
|
||||
else if(appNotificationCategory === '60'){
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if(appNotificationCategory === '40'){
|
||||
|
||||
}
|
||||
else if(appNotificationCategory === '60'){
|
||||
|
||||
}
|
||||
|
||||
navigate(path, {
|
||||
state: pathState
|
||||
});
|
||||
@@ -73,22 +90,26 @@ export const AlarmItem = ({
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setAppNotificationCategoryName(getCategoryName());
|
||||
}, [appNotificationCategory]);
|
||||
|
||||
return (
|
||||
<div className="notice-item">
|
||||
<div
|
||||
className="notice-item"
|
||||
onClick={ () => callAppAlarmMark() }
|
||||
>
|
||||
<div className="notice-content">
|
||||
<div className="notice-title">{ appNotificationTitle }</div>
|
||||
<div className="notice-meta">
|
||||
<strong>{ appNotificationCategory }</strong>
|
||||
<strong>{ appNotificationCategoryName }</strong>
|
||||
<span>{ moment(notificationReceivedDate).format('YYYY.MM.DD HH:mm:ss') }</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="notice-arrow"
|
||||
onClick={ () => callAppAlarmMark() }
|
||||
>
|
||||
<div className="notice-arrow">
|
||||
<img
|
||||
src={ IMAGE_ROOT + '/Forward.svg' }
|
||||
alt={ appNotificationCategory + ' 바로가기' }
|
||||
alt={ appNotificationCategoryName + ' 바로가기' }
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,10 +12,12 @@ import { DefaultRequestPagination } from '@/entities/common/model/types';
|
||||
|
||||
export interface AlarmListProps {
|
||||
appNotificationCategory: string;
|
||||
appNotificationCategories: Array<any>;
|
||||
};
|
||||
|
||||
export const AlarmList = ({
|
||||
appNotificationCategory
|
||||
appNotificationCategory,
|
||||
appNotificationCategories
|
||||
}: AlarmListProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
@@ -108,6 +110,7 @@ export const AlarmList = ({
|
||||
appNotificationTitle={ resultList[i]?.appNotificationTitle }
|
||||
appNotificationContent={ resultList[i]?.appNotificationContent }
|
||||
appNotificationLink={ resultList[i]?.appNotificationLink }
|
||||
appNotificationCategories={ appNotificationCategories }
|
||||
></AlarmItem>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user