Skip to content

Commit e35773a

Browse files
committed
feat : 신고 검토에서 신고 카테고리 API 연결
1 parent 3707476 commit e35773a

File tree

6 files changed

+41
-22
lines changed

6 files changed

+41
-22
lines changed

src/components/admin/adminUserReport/AdminReportDetail.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { formatDate } from '../../../util/formatDate';
1212
import { useHandleUser } from '../../../hooks/admin/useHandleUser';
1313
import { useModal } from '../../../hooks/useModal';
1414
import Modal from '../../common/modal/Modal';
15+
import { REPORT_CATEGORY_LIST } from '../../../constants/admin/adminReportCategoryList';
1516

1617
export default function AdminReportDetail() {
1718
const { id: reportId } = useParams();
@@ -65,8 +66,8 @@ export default function AdminReportDetail() {
6566
<Link to={`/admin/users/${reportDetailData.reporter.userId}`}>
6667
<Avatar
6768
image={
68-
reportDetailData.reporter.img
69-
? reportDetailData.reporter.img
69+
reportDetailData.reporter.profileImg
70+
? reportDetailData.reporter.profileImg
7071
: defaultImg
7172
}
7273
size='50px'
@@ -81,8 +82,8 @@ export default function AdminReportDetail() {
8182
<Link to={`/admin/users/${reportDetailData.reportedUser.userId}`}>
8283
<Avatar
8384
image={
84-
reportDetailData.reportedUser.img
85-
? reportDetailData.reportedUser.img
85+
reportDetailData.reportedUser.profileImg
86+
? reportDetailData.reportedUser.profileImg
8687
: defaultImg
8788
}
8889
size='47px'
@@ -97,13 +98,9 @@ export default function AdminReportDetail() {
9798
<S.ContentHeader>
9899
<ReportCheckBox
99100
isAdmin={true}
100-
selectedCheckbox={[
101-
'욕설/비속어',
102-
'성적내용/음란물',
103-
'광고/스팸',
104-
'저작권 침해',
105-
'기타',
106-
]}
101+
selectedCheckbox={reportDetailData.category.map(
102+
(num) => REPORT_CATEGORY_LIST[num - 1]
103+
)}
107104
/>
108105
<S.Date>{formatDate(reportDetailData.reportedAt)}</S.Date>
109106
</S.ContentHeader>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const REPORT_CATEGORY_LIST = [
2+
'욕설/비속어',
3+
'성적내용/음란물',
4+
'광고/스팸',
5+
'사기/부정행위',
6+
'도배/스팸',
7+
'혐오/차별발언',
8+
'사생활 침해',
9+
'저작권 침해',
10+
'기타',
11+
] as const;
12+
13+
export type ReportCategory = (typeof REPORT_CATEGORY_LIST)[number];

src/models/admin/userDetail/reportDetail.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ApiCommonType } from '../../apiCommon';
33
export interface UserData {
44
userId: number;
55
nickname: string;
6-
img: string;
6+
profileImg: string;
77
}
88

99
export interface ReportDetail {
@@ -12,7 +12,7 @@ export interface ReportDetail {
1212
reportedUser: UserData;
1313
reportedAt: string;
1414
reason: string;
15-
category: 'ALL' | 'ABUSE' | 'SEXUAL' | 'AD' | 'COPYRIGHT' | 'ETC';
15+
category: number[];
1616
location: 'USER' | 'PROJECT' | 'COMMENT' | 'RECOMMENT';
1717
locationId: number;
1818
}

src/models/report.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface AllReports {
1818
nickname: string;
1919
profileImg: string;
2020
warning: number;
21-
category: string;
21+
category: number[];
2222
reportedAt: string;
2323
imposed: boolean;
2424
}

src/pages/admin/adminReports/AdminReports.styled.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ export const Item = styled(Link)`
4646
`;
4747

4848
export const ProfileImg = styled.div`
49-
flex-shrink: 0;
50-
text-align: center;
49+
width: 80px;
50+
display: flex;
51+
flex-direction: column;
52+
align-items: center;
5153
margin-right: 16px;
54+
flex-shrink: 0;
5255
`;
5356

5457
export const NickName = styled.p`
@@ -60,14 +63,17 @@ export const NickName = styled.p`
6063
export const ContentArea = styled.div`
6164
display: flex;
6265
flex: 1;
63-
flex-direction: column;
64-
justify-content: center;
66+
justify-content: flex-start;
6567
align-items: flex-start;
6668
margin-left: 35px;
67-
margin-bottom: 30px;
69+
70+
overflow: hidden;
71+
white-space: nowrap;
72+
text-overflow: ellipsis;
6873
`;
6974

7075
export const Category = styled.p`
76+
padding: 5px 10px;
7177
${({ theme }) => theme.heading.small};
7278
opacity: 50%;
7379
`;

src/pages/admin/adminReports/AdminReports.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ import * as S from './AdminReports.styled';
66
import defaultImg from '../../../assets/defaultImg.png';
77
import { XMarkIcon } from '@heroicons/react/24/outline';
88
import Pagination from '../../../components/common/pagination/Pagination';
9-
109
import { useModal } from '../../../hooks/useModal';
1110
import Modal from '../../../components/common/modal/Modal';
12-
1311
import { useGetAllReports } from '../../../hooks/admin/useGetAllReports';
1412
import { Spinner } from '../../../components/common/loadingSpinner/LoadingSpinner.styled';
1513
import { useHandleUser } from '../../../hooks/admin/useHandleUser';
1614
import { ADMIN_MODAL_MESSAGE } from '../../../constants/admin/adminModal';
15+
import { REPORT_CATEGORY_LIST } from '../../../constants/admin/adminReportCategoryList';
1716

1817
export default function AdminReports() {
1918
const { searchUnit, value, handleChangePagination, handleGetKeyword } =
@@ -67,7 +66,11 @@ export default function AdminReports() {
6766
<S.NickName>{data.nickname}</S.NickName>
6867
</S.ProfileImg>
6968
<S.ContentArea>
70-
<S.Category>{data.category}</S.Category>
69+
{data.category.map((category) => (
70+
<S.Category>
71+
"{REPORT_CATEGORY_LIST[category - 1]}"
72+
</S.Category>
73+
))}
7174
</S.ContentArea>
7275
<S.ButtonArea>
7376
<S.WarningButton

0 commit comments

Comments
 (0)