Skip to content

Commit 5fd9543

Browse files
authored
refactor: 2차 QA 반영 (#116)
* feat: 마이페이지에서 신고 횟수 조회 기능 구현 * design: button에 aria-label 추가하기 * design: 마이페이지 신고 횟수 조회 텍스트 수정 * perf: 오고 있는 편지가 존재하지 않을 때는 오고 있는 편지 모달 내에서 렌더링되지 않도록 * feat: 마이페이지에서 신고 횟수 클릭 시 신고 안내 모달이 뜨도록 * fix: 마이페이지에서 신고 횟수 조회 텍스트 오류 수정
1 parent f55da9f commit 5fd9543

File tree

5 files changed

+43
-1
lines changed

5 files changed

+43
-1
lines changed

src/pages/Home/components/ShowShareAccessModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const ShowShareAccessModal = ({ onClose }: ShowShareAccessModalProps) => {
6161
className="text-gray-80 body-m flex h-10 w-full items-center justify-between gap-1 rounded-lg bg-white p-3"
6262
key={proposal.shareProposalId}
6363
onClick={() => handleNavigation(proposal.shareProposalId)}
64+
aria-label="따숨님의 공유 요청"
6465
>
6566
<p>{proposal.requesterZipCode}님의 공유 요청</p>
6667
</button>

src/pages/MyPage/index.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ import useMyPageStore from '@/stores/myPageStore';
88

99
import { TEMPERATURE_RANGE } from './constants';
1010
import useToastStore from '@/stores/toastStore';
11+
import ModalOverlay from '@/components/ModalOverlay';
1112

1213
const MyPage = () => {
1314
useEffect(() => {
1415
fetchMyPageInfo();
1516
}, []);
1617

1718
const { data, fetchMyPageInfo } = useMyPageStore();
19+
1820
const [isOpenModal, setIsOpenModal] = useState(false);
21+
const [isOpenWarningModal, setIsOpenWarningModal] = useState(false);
22+
1923
const logout = useAuthStore((state) => state.logout);
2024
const setToastActive = useToastStore((state) => state.setToastActive);
2125

@@ -60,6 +64,19 @@ const MyPage = () => {
6064
}}
6165
/>
6266
)}
67+
68+
{isOpenWarningModal && (
69+
<ModalOverlay closeOnOutsideClick onClose={() => setIsOpenWarningModal(false)}>
70+
<article className="bg-accent-1 relative w-77 overflow-hidden rounded-sm p-6">
71+
<div className="absolute inset-0 h-full w-full bg-white/90 blur-[25px]" />
72+
<div className="relative">
73+
<h2 className="body-sb mb-1.5 text-gray-100">경고 규칙</h2>
74+
<p className="caption-r text-black">3회 경고: 서비스 이용 불가능</p>
75+
</div>
76+
</article>
77+
</ModalOverlay>
78+
)}
79+
6380
<main className="flex grow flex-col gap-12 px-5 pt-20 pb-6">
6481
<h1 className="h2-b mx-auto flex gap-1.5">
6582
{data.zipCode.split('').map((code, index) => (
@@ -109,11 +126,24 @@ const MyPage = () => {
109126
<span>{data.email}</span>
110127
</p>
111128
</div>
129+
<div
130+
className="flex justify-between"
131+
onClick={async () => {
132+
setIsOpenWarningModal(true);
133+
}}
134+
>
135+
<p className="body-sb text-gray-100">경고 횟수</p>
136+
<p className="body-r text-gray-60">
137+
<span>{data.warningCount}</span>
138+
</p>
139+
</div>
140+
112141
<button
113142
className="body-sb self-start text-gray-100"
114143
onClick={() => {
115144
logout();
116145
}}
146+
aria-label="로그아웃"
117147
>
118148
로그아웃
119149
</button>
@@ -125,6 +155,7 @@ const MyPage = () => {
125155
onClick={async () => {
126156
setIsOpenModal(true);
127157
}}
158+
aria-label="탈퇴하기"
128159
>
129160
탈퇴하기
130161
</button>

src/pages/Share/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const ShareApprovalPage = () => {
7171
type="button"
7272
className="body-m secondary-btn h-10 flex-1 basis-1/2"
7373
onClick={() => handleProposalApproval('reject')}
74+
aria-label="거부하기"
7475
>
7576
거부하기
7677
</button>
@@ -79,6 +80,7 @@ const ShareApprovalPage = () => {
7980
type="button"
8081
className="primary-btn body-m h-10 flex-1 basis-1/2"
8182
onClick={() => handleProposalApproval('approve')}
83+
aria-label="승인하기"
8284
>
8385
승인하기
8486
</button>

src/stores/incomingLettersStore.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export const useIncomingLettersStore = create<IncomingLettersStore>((set) => ({
5151
data: inProgressLetters,
5252
});
5353

54-
setInterval(() => {
54+
if (inProgressLetters.length === 0) return;
55+
56+
const intervalId = setInterval(() => {
5557
set((state) => {
5658
const updatedLetters = state.data.map((letter: IncomingLetters) => {
5759
const remainingTime = calculatingRemainingTime(letter.deliveryCompletedAt);
@@ -62,6 +64,10 @@ export const useIncomingLettersStore = create<IncomingLettersStore>((set) => ({
6264
(letter) => letter.remainingTime !== '00:00:00',
6365
);
6466

67+
if (filteredLetters.length === 0) {
68+
clearInterval(intervalId);
69+
}
70+
6571
return {
6672
data: filteredLetters,
6773
};

src/stores/myPageStore.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ interface MyPageDataStore {
77
temperature: string;
88
social: string;
99
email: string;
10+
warningCount: number;
1011
}
1112

1213
interface MyPageStore {
@@ -21,6 +22,7 @@ const useMyPageStore = create<MyPageStore>((set) => ({
2122
temperature: '',
2223
social: '',
2324
email: '',
25+
warningCount: 0,
2426
},
2527
message: '',
2628
setMyPageData: (newData) => set({ data: newData }),

0 commit comments

Comments
 (0)