Skip to content

Commit

Permalink
fix: 버그 수정3
Browse files Browse the repository at this point in the history
  • Loading branch information
abcxj123 committed Jun 11, 2024
1 parent bbfe950 commit 824df97
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 24 deletions.
4 changes: 0 additions & 4 deletions src/components/molecules/MoneyBoxItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const MoneyBoxItem: FC<Iprops> = ({
color2,
onClick,
onClick2,
onClickQuestion,
isLimit,
}) => {
return (
Expand All @@ -38,9 +37,6 @@ export const MoneyBoxItem: FC<Iprops> = ({
>
출금제한
</div>
<button onClick={() => onClickQuestion!()}>
<GoQuestion size={13} />
</button>
</>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/main/MyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ export const MyPage = () => {
: 'icons/bankbook.svg'
}
link={
item.type === 'DEPOSITWITHDRAWL'
item.type === 'DEPOSITWITHDRAWAL'
? '/account'
: item.type === 'SAVING100'
? '/saving100'
? '/savings100Days'
: item.type === 'SAVING'
? '/roadmap4'
: item.type === 'DEPOSIT'
Expand Down
6 changes: 5 additions & 1 deletion src/pages/mission3/Mission3AccountOpening.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ export const Mission3AccountOpening = () => {
return;
}
if (currentNumber === 5) {
navigate('/savings100Days');
navigate('/savings100Days', {
state: {
prev: true,
},
});
return;
}
setCurrentNumber((prev) => prev + 1);
Expand Down
21 changes: 16 additions & 5 deletions src/pages/mission3/Savings100Days.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useRef, useState } from 'react';
import { Calendar } from '../../components/organisms/Calendar';
import Topbar from '../../components/Topbar';
import { useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { ApiClient } from '../../apis/apiClient';
import { differenceInDays, formatDate } from 'date-fns';
Expand All @@ -10,11 +10,16 @@ import { AlertModal } from '../../components/AlertModal';

export const Savings100Days = () => {
const navigate = useNavigate();
const location = useLocation();
const queryClient = useQueryClient();
const [showStepModal, setShowStepModal] = useState<boolean>(false);
const [showAlarm, setShowAlarm] = useState<boolean>(false);
const alarmMsgRef = useRef<string>('');

const locationState = location.state as {
prev: boolean;
};

const { data: saving100, isSuccess } = useQuery({
queryKey: ['saving100'],
queryFn: () => {
Expand Down Expand Up @@ -92,6 +97,15 @@ export const Savings100Days = () => {
}
};

const onClickBack = () => {
if (locationState != null && locationState.prev) {
navigate('/mission');
return;
}

navigate(-1);
};

const moveToTermination = () => {
isSuccess &&
navigate('/termination', {
Expand Down Expand Up @@ -132,10 +146,7 @@ export const Savings100Days = () => {
</AlertModal>
)}

<Topbar
title={saving100.productName}
onClick={() => navigate('/mission')}
/>
<Topbar title={saving100.productName} onClick={() => onClickBack()} />
<div className='bg-hanaAqua pb-[100px]'>
<div className='bg-white font-hanaMedium p-8'>
<div className='text-3xl mb-2'>생활비</div>
Expand Down
6 changes: 5 additions & 1 deletion src/pages/mission4/Mission4AccountOpening.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export const Mission4AccountOpening = () => {
return;
}
if (currentNumber === 5) {
navigate('/roadmap4');
navigate('/roadmap4', {
state: {
prev: true,
},
});
return;
}
setCurrentNumber((prev) => prev + 1);
Expand Down
21 changes: 16 additions & 5 deletions src/pages/mission4/RoadMap4.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useState } from 'react';
import Topbar from '../../components/Topbar';
import { useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { ApiClient } from '../../apis/apiClient';
import { differenceInDays, formatDate } from 'date-fns';
Expand All @@ -10,12 +10,17 @@ import { AlertModal } from '../../components/AlertModal';

export const RoadMap4 = () => {
const navigate = useNavigate();
const location = useLocation();
const percent = useRef<number>(0);
const queryClient = useQueryClient();
const [showStepModal, setShowStepModal] = useState<boolean>(false);
const [showAlarm, setShowAlarm] = useState<boolean>(false);
const alarmMsgRef = useRef<string>('');

const locationState = location.state as {
prev: boolean;
};

const { data: roadmap, isSuccess } = useQuery({
queryKey: ['roadMap4'],
queryFn: () => {
Expand Down Expand Up @@ -85,6 +90,15 @@ export const RoadMap4 = () => {
}
};

const onClickBack = () => {
if (locationState != null && locationState.prev) {
navigate('/mission');
return;
}

navigate(-1);
};

if (isSuccess) {
percent.current = Math.floor(
(differenceInDays(new Date(), roadmap.startDate) /
Expand Down Expand Up @@ -132,10 +146,7 @@ export const RoadMap4 = () => {
</div>
</AlertModal>
)}
<Topbar
title={roadmap.productName}
onClick={() => navigate('/mission')}
/>
<Topbar title={roadmap.productName} onClick={() => onClickBack()} />
<div className='bg-hanaSky min-h-real-screen2'>
<div className='absolute top-[70px] left-[15px] w-[150px]'>
<div className='font-hanaMedium text-lg mb-2'>
Expand Down
6 changes: 5 additions & 1 deletion src/pages/mission5/Mission5AccountOpening.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ export const Mission5AccountOpening = () => {
return;
}
if (currentNumber === 4) {
navigate('/roadmap5');
navigate('/roadmap5', {
state: {
prev: true,
},
});
return;
}
setCurrentNumber((prev) => prev + 1);
Expand Down
21 changes: 16 additions & 5 deletions src/pages/mission5/RoadMap5.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useState } from 'react';
import Topbar from '../../components/Topbar';
import { useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { ApiClient } from '../../apis/apiClient';
import { differenceInDays, formatDate } from 'date-fns';
Expand All @@ -9,11 +9,16 @@ import { AlertModal } from '../../components/AlertModal';

export const RoadMap5 = () => {
const navigate = useNavigate();
const location = useLocation();
const queryClient = useQueryClient();
const [showStepModal, setShowStepModal] = useState<boolean>(false);
const [showAlarm, setShowAlarm] = useState<boolean>(false);
const alarmMsgRef = useRef<string>('');

const locationState = location.state as {
prev: boolean;
};

const { data: roadmap, isSuccess } = useQuery({
queryKey: ['roadMap5'],
queryFn: () => {
Expand Down Expand Up @@ -83,6 +88,15 @@ export const RoadMap5 = () => {
}
};

const onClickBack = () => {
if (locationState != null && locationState.prev) {
navigate('/mission');
return;
}

navigate(-1);
};

const moveToTermination = () => {
isSuccess &&
navigate('/termination', {
Expand Down Expand Up @@ -122,10 +136,7 @@ export const RoadMap5 = () => {
</div>
</AlertModal>
)}
<Topbar
title={roadmap.productName}
onClick={() => navigate('/mission')}
/>
<Topbar title={roadmap.productName} onClick={() => onClickBack()} />
<div className='bg-hanaSky min-h-real-screen'>
<img
src='/images/pado.svg'
Expand Down
1 change: 1 addition & 0 deletions src/pages/moneyBox/MoneyBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const MoneyBox = () => {
const res = ApiClient.getInstance().updateMissionCheck();
return res;
},
onSettled: () => queryClient.invalidateQueries({ queryKey: ['userInfo'] }),
});

const { mutate: updateHanaMoney } = useMutation({
Expand Down

0 comments on commit 824df97

Please sign in to comment.