Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pages/Home/components/ShowShareAccessModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const ShowShareAccessModal = ({ onClose }: ShowShareAccessModalProps) => {
className="text-gray-80 body-m flex h-10 w-full items-center justify-between gap-1 rounded-lg bg-white p-3"
key={proposal.shareProposalId}
onClick={() => handleNavigation(proposal.shareProposalId)}
aria-label="따숨님의 공유 요청"
>
<p>{proposal.requesterZipCode}님의 공유 요청</p>
</button>
Expand Down
31 changes: 31 additions & 0 deletions src/pages/MyPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ import useMyPageStore from '@/stores/myPageStore';

import { TEMPERATURE_RANGE } from './constants';
import useToastStore from '@/stores/toastStore';
import ModalOverlay from '@/components/ModalOverlay';

const MyPage = () => {
useEffect(() => {
fetchMyPageInfo();
}, []);

const { data, fetchMyPageInfo } = useMyPageStore();

const [isOpenModal, setIsOpenModal] = useState(false);
const [isOpenWarningModal, setIsOpenWarningModal] = useState(false);

const logout = useAuthStore((state) => state.logout);
const setToastActive = useToastStore((state) => state.setToastActive);

Expand Down Expand Up @@ -60,6 +64,19 @@ const MyPage = () => {
}}
/>
)}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분이 지원님 PR과 다른 것 같아서 두분이서 나중에 확인하셔야될 것 같습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해결해서 커밋 날렸습니다!

{isOpenWarningModal && (
<ModalOverlay closeOnOutsideClick onClose={() => setIsOpenWarningModal(false)}>
<article className="bg-accent-1 relative w-77 overflow-hidden rounded-sm p-6">
<div className="absolute inset-0 h-full w-full bg-white/90 blur-[25px]" />
<div className="relative">
<h2 className="body-sb mb-1.5 text-gray-100">경고 규칙</h2>
<p className="caption-r text-black">3회 경고: 서비스 이용 불가능</p>
</div>
</article>
</ModalOverlay>
)}

<main className="flex grow flex-col gap-12 px-5 pt-20 pb-6">
<h1 className="h2-b mx-auto flex gap-1.5">
{data.zipCode.split('').map((code, index) => (
Expand Down Expand Up @@ -109,11 +126,24 @@ const MyPage = () => {
<span>{data.email}</span>
</p>
</div>
<div
className="flex justify-between"
onClick={async () => {
setIsOpenWarningModal(true);
}}
>
<p className="body-sb text-gray-100">경고 횟수</p>
<p className="body-r text-gray-60">
<span>{data.warningCount}회</span>
</p>
</div>

<button
className="body-sb self-start text-gray-100"
onClick={() => {
logout();
}}
aria-label="로그아웃"
>
로그아웃
</button>
Expand All @@ -125,6 +155,7 @@ const MyPage = () => {
onClick={async () => {
setIsOpenModal(true);
}}
aria-label="탈퇴하기"
>
탈퇴하기
</button>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Share/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const ShareApprovalPage = () => {
type="button"
className="body-m secondary-btn h-10 flex-1 basis-1/2"
onClick={() => handleProposalApproval('reject')}
aria-label="거부하기"
>
거부하기
</button>
Expand All @@ -79,6 +80,7 @@ const ShareApprovalPage = () => {
type="button"
className="primary-btn body-m h-10 flex-1 basis-1/2"
onClick={() => handleProposalApproval('approve')}
aria-label="승인하기"
>
승인하기
</button>
Expand Down
8 changes: 7 additions & 1 deletion src/stores/incomingLettersStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export const useIncomingLettersStore = create<IncomingLettersStore>((set) => ({
data: inProgressLetters,
});

setInterval(() => {
if (inProgressLetters.length === 0) return;

const intervalId = setInterval(() => {
set((state) => {
const updatedLetters = state.data.map((letter: IncomingLetters) => {
const remainingTime = calculatingRemainingTime(letter.deliveryCompletedAt);
Expand All @@ -62,6 +64,10 @@ export const useIncomingLettersStore = create<IncomingLettersStore>((set) => ({
(letter) => letter.remainingTime !== '00:00:00',
);

if (filteredLetters.length === 0) {
clearInterval(intervalId);
}

return {
data: filteredLetters,
};
Expand Down
2 changes: 2 additions & 0 deletions src/stores/myPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface MyPageDataStore {
temperature: string;
social: string;
email: string;
warningCount: number;
}

interface MyPageStore {
Expand All @@ -21,6 +22,7 @@ const useMyPageStore = create<MyPageStore>((set) => ({
temperature: '',
social: '',
email: '',
warningCount: 0,
},
message: '',
setMyPageData: (newData) => set({ data: newData }),
Expand Down