Skip to content

Commit e2c113d

Browse files
committed
review : 리뷰 사항 적용
1 parent 7b09a7c commit e2c113d

File tree

16 files changed

+87
-42
lines changed

16 files changed

+87
-42
lines changed

src/api/alarm.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ export const testLiveAlarm = async () => {
5050
throw e;
5151
}
5252
} else {
53-
return;
53+
throw new Error('인증 토큰이 없습니다.');
5454
}
5555
};

src/components/admin/previewComponent/allUserPreview/AllUserPreview.styled.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ export const Text = styled.p`
3939
`;
4040

4141
export const Arrow = styled.img`
42-
width: 10px;
43-
height: 10px;
42+
width: 11px;
43+
height: 11px;
4444
`;

src/components/admin/previewComponent/allUserPreview/AllUserPreview.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@ import { useGetAllUsers } from '../../../../hooks/admin/useGetAllUsers';
44
import Avatar from '../../../common/avatar/Avatar';
55
import { ADMIN_ROUTE } from '../../../../constants/routes';
66
import arrow_right from '../../../../assets/ArrowRight.svg';
7+
import LoadingSpinner from '../../../common/loadingSpinner/LoadingSpinner';
78

89
const AllUserPreview = () => {
9-
const { allUserData, isLoading } = useGetAllUsers();
10+
const { allUserData, isLoading, isFetching } = useGetAllUsers();
11+
12+
if (isLoading || isFetching) {
13+
return <LoadingSpinner />;
14+
}
15+
16+
if (!allUserData || allUserData.length === 0) {
17+
return <S.Container>가입된 회원이 없습니다.</S.Container>;
18+
}
1019

1120
const previewList = allUserData
1221
? allUserData.length > 6
@@ -19,7 +28,7 @@ const AllUserPreview = () => {
1928
{previewList?.map((user) => (
2029
<S.Wrapper key={user.id}>
2130
<S.UserArea>
22-
<Avatar image={undefined} size='40px' />
31+
<Avatar image={user.user.img} size='40px' />
2332
<S.ContentArea to={`${ADMIN_ROUTE.allUser}/${user.id}`}>
2433
<S.NickName>{user.user.nickname}</S.NickName>
2534
<S.Email>{user.email}</S.Email>

src/components/admin/previewComponent/inquiresPreview/InquiresPreview.styled.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const Inquiry = styled(Link)`
2323

2424
export const Category = styled.p`
2525
font-size: 9px;
26-
opacity: 50%;
26+
opacity: 0.5;
2727
`;
2828

2929
export const Title = styled.p`
@@ -37,14 +37,14 @@ export const StateArea = styled.div`
3737
display: flex;
3838
`;
3939

40-
export const Date = styled.p`
40+
export const InquiriesDate = styled.p`
4141
font-size: 9px;
42-
opacity: 50%;
42+
opacity: 0.5;
4343
`;
4444

4545
export const Divider = styled.p`
4646
font-size: 9px;
47-
opacity: 20%;
47+
opacity: 0.2;
4848
margin-left: 3px;
4949
margin-right: 3px;
5050
`;

src/components/admin/previewComponent/inquiresPreview/InquiresPreview.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@ import { useGetAllInquiries } from '../../../../hooks/admin/useGetAllInquiries';
33
import Avatar from '../../../common/avatar/Avatar';
44
import { ADMIN_ROUTE } from '../../../../constants/routes';
55
import arrow_right from '../../../../assets/ArrowRight.svg';
6+
import LoadingSpinner from '../../../common/loadingSpinner/LoadingSpinner';
67

78
const InquiresPreview = () => {
8-
const { allInquiriesData } = useGetAllInquiries();
9+
const { allInquiriesData, isLoading, isFetching } = useGetAllInquiries();
10+
11+
if (isLoading || isFetching) {
12+
return <LoadingSpinner />;
13+
}
14+
15+
if (!allInquiriesData || allInquiriesData.length === 0) {
16+
return <S.Container>등록된 공지사항이 없습니다.</S.Container>;
17+
}
918

1019
const previewList = allInquiriesData
1120
? allInquiriesData.length > 6
@@ -24,7 +33,7 @@ const InquiresPreview = () => {
2433
<S.Category>{inquiry.category}</S.Category>
2534
<S.Title>{inquiry.title}</S.Title>
2635
<S.StateArea>
27-
<S.Date>{inquiry.createdAt}</S.Date>
36+
<S.InquiriesDate>{inquiry.createdAt}</S.InquiriesDate>
2837
<S.Divider>|</S.Divider>
2938
<S.InquiryState $isCompleted={inquiry.state}>
3039
{inquiry.state ? '답변 완료' : '답변 대기 중'}

src/components/admin/previewComponent/noticePreview/NoticePreview.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,25 @@ import React from 'react';
22
import * as S from './NoticePreview.styled';
33
import { useGetNotice } from '../../../../hooks/user/useGetNotice';
44
import line from '../../../../assets/line.svg';
5+
import LoadingSpinner from '../../../common/loadingSpinner/LoadingSpinner';
56

67
const NoticePreview = () => {
7-
const { noticeData } = useGetNotice({ keyword: '', page: 1 });
8+
const { noticeData, isLoading, isFetching } = useGetNotice({
9+
keyword: '',
10+
page: 1,
11+
});
12+
13+
if (isLoading || isFetching) {
14+
return <LoadingSpinner />;
15+
}
16+
17+
if (!noticeData?.notices || noticeData.notices.length === 0) {
18+
return <S.Container>공지사힝이 없습니다.</S.Container>;
19+
}
820

921
return (
1022
<S.Container>
11-
{noticeData?.notices.map((notice) => (
23+
{noticeData.notices.map((notice) => (
1224
<S.Wrapper key={notice.id}>
1325
<S.Dot src={line} />
1426
<S.NoticeTitle>{notice.title}</S.NoticeTitle>

src/components/admin/previewComponent/reportsPreview/ReportsPreview.styled.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const ContentArea = styled.div`
2323

2424
export const ImposedCount = styled.div`
2525
font-size: 9px;
26-
opacity: 50%;
26+
opacity: 0.5;
2727
`;
2828

2929
export const Category = styled.p`
@@ -37,14 +37,14 @@ export const StateArea = styled.div`
3737
display: flex;
3838
`;
3939

40-
export const Date = styled.p`
40+
export const ReportDate = styled.p`
4141
font-size: 9px;
42-
opacity: 50%;
42+
opacity: 0.5;
4343
`;
4444

4545
export const Divider = styled.p`
4646
font-size: 9px;
47-
opacity: 20%;
47+
opacity: 0.2;
4848
margin-left: 3px;
4949
margin-right: 3px;
5050
`;

src/components/admin/previewComponent/reportsPreview/ReportsPreview.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ const ReportsPreview = () => {
1616
return (
1717
<S.Container>
1818
{previewList?.map((report) => (
19-
<S.Wrapper>
19+
<S.Wrapper key={report.id}>
2020
<S.ReportArea to={`${ADMIN_ROUTE.reports}/${report.id}`}>
2121
<Avatar image={report.user.img} size='40px' />
2222
<S.ContentArea>
2323
<S.ImposedCount>{report.imposedCount}</S.ImposedCount>
2424
<S.Category>{report.category}</S.Category>
2525
<S.StateArea>
26-
<S.Date>{report.createdAt}</S.Date>
26+
<S.ReportDate>{report.createdAt}</S.ReportDate>
2727
<S.Divider>|</S.Divider>
28-
<S.IsImposed $isImposed={report.IsImposed}>
29-
{report.IsImposed ? '검토 완료' : '검토 미완료'}
28+
<S.IsImposed $isImposed={report.isImposed}>
29+
{report.isImposed ? '검토 완료' : '검토 미완료'}
3030
</S.IsImposed>
3131
</S.StateArea>
3232
</S.ContentArea>

src/constants/admin/mainItems.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const cardList: CardItem[] = [
2020
Component: AllUserPreview,
2121
},
2222
{
23-
key: 'inquires',
23+
key: 'inquiries',
2424
title: '문의 확인',
2525
link: `${ADMIN_ROUTE.inquiries}`,
2626
Component: InquiresPreview,

src/hooks/admin/useGetAllInquiries.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import { getAllInquiries } from '../../api/activityLog.api';
33
import { ActivityLog } from '../queries/user/keys';
44

55
export const useGetAllInquiries = () => {
6-
const { data: allInquiriesData, isLoading } = useQuery({
6+
const {
7+
data: allInquiriesData,
8+
isLoading,
9+
isFetching,
10+
} = useQuery({
711
queryKey: [ActivityLog.allInquiries],
812
queryFn: () => getAllInquiries(),
913
});
1014

11-
return { allInquiriesData, isLoading };
15+
return { allInquiriesData, isLoading, isFetching };
1216
};

0 commit comments

Comments
 (0)