- 공지사항 리스트/상세 페이지에 다국어(i18n) 적용 - 카테고리 선택 필터 기능 추가 (전체/공지/이벤트/서비스/중요) - 검색창 Enter 키 지원 및 한글 입력 이슈 해결 - 검색/필터 실행 시 input 포커스 자동 해제 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
import { useEffect, useState } from 'react';
|
|
import { useLocation } from 'react-router';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { PATHS } from '@/shared/constants/paths';
|
|
import { useNoticeDetailMutation } from '@/entities/support/api/use-notice-detail-mutation';
|
|
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
|
import { HeaderType } from '@/entities/common/model/types';
|
|
import { NoticeItem } from '@/entities/support/model/types';
|
|
import {
|
|
useSetHeaderTitle,
|
|
useSetHeaderType,
|
|
useSetFooterMode,
|
|
useSetOnBack
|
|
} from '@/widgets/sub-layout/use-sub-layout';
|
|
import moment from 'moment';
|
|
|
|
export const NoticeDetailPage = () => {
|
|
const { navigate } = useNavigate();
|
|
const location = useLocation();
|
|
const { t } = useTranslation();
|
|
|
|
const [result, setResult] = useState<NoticeItem>({});
|
|
|
|
let from = location?.state.from;
|
|
|
|
useSetHeaderTitle(t('support.notice.title'));
|
|
useSetHeaderType(HeaderType.RightClose);
|
|
useSetFooterMode(false);
|
|
useSetOnBack(() => {
|
|
if(from){
|
|
navigate(from);
|
|
}
|
|
else{
|
|
navigate(PATHS.support.notice.list);
|
|
}
|
|
|
|
});
|
|
|
|
const { mutateAsync: noticeDetail } = useNoticeDetailMutation();
|
|
|
|
|
|
|
|
const callDetail = () => {
|
|
let detailParams = {
|
|
noticeId: location?.state.id,
|
|
};
|
|
|
|
noticeDetail(detailParams).then((rs) => {
|
|
console.log(rs);
|
|
setResult(rs);
|
|
});
|
|
};
|
|
|
|
useEffect(() => {
|
|
callDetail();
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, []);
|
|
|
|
return (
|
|
<>
|
|
<main>
|
|
<div className="tab-content">
|
|
<div className="tab-pane sub active">
|
|
<div className="option-list pb-120">
|
|
<div className="notice-detail">
|
|
<div className="notice-detail__title">{ result.title }</div>
|
|
<div className="notice-detail__meta">{ moment(result.regDate).format('YYYY.MM.DD') } | { t(`support.notice.categories.${result.category}`) }</div>
|
|
<div className="notice-detail__divider"></div>
|
|
<div className="notice-detail__body">{ result.content }</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</>
|
|
);
|
|
}; |