Skip to content

Commit

Permalink
Merge pull request #192 from bankidz/dev
Browse files Browse the repository at this point in the history
그룹링크 테스트 배포용
  • Loading branch information
9yujin authored Sep 5, 2022
2 parents eb6b287 + 04b2b4d commit 7f85916
Show file tree
Hide file tree
Showing 76 changed files with 728 additions and 478 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"polished": "^4.2.2",
"rc-slider": "^10.0.1",
"react": "^18.1.0",
"react-apple-login": "^1.1.5",
"react-content-loader": "^6.2.0",
"react-dom": "^18.1.0",
"react-icons": "^4.3.1",
Expand All @@ -39,6 +38,7 @@
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"react-signature-canvas": "^1.0.6",
"react-spinners": "^0.13.4",
"react-spring-bottom-sheet": "^3.4.1",
"styled-components": "^5.3.5",
"styled-reset": "^4.4.1",
Expand Down
7 changes: 6 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import FinancialRouter from './pages/Financial';
import NotFound from './pages/NotFound';
import RequireAuth from '@components/auth/RequireAuth';
import PersistLogin from '@components/auth/PersistLogin';
import SungwooTestPage from './pages/SungwooTestPage';
import TestPage from './pages/Test/TestPage';
import { useQueryClient } from 'react-query';
import GroupLink from './components/mypage/GroupLink';
import Setting from './pages/Setting/Setting';
import SettingRouter from './pages/Setting';

function App() {
const queryClient = useQueryClient();
Expand All @@ -37,10 +39,13 @@ function App() {
<Route path="/*" element={<HomeRouter />} />
<Route path="/walk/*" element={<WalkRouter />} />
<Route path="/mypage/*" element={<MypageRouter />} />

<Route path="/setting/*" element={<SettingRouter />} />
<Route path="/financial/*" element={<FinancialRouter />} />
{/* <Route path="/sungwoo" element={<SungwooTestPage />} /> */}
<Route path="*" element={<NotFound />} />
{/* </Route> */}

{/* </Route> */}
</Route>
</Routes>
Expand Down
4 changes: 2 additions & 2 deletions src/assets/icons/arrow-walking.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/assets/icons/setting.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 30 additions & 15 deletions src/components/auth/PersistLogin.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Outlet } from 'react-router-dom';
import { useState, useEffect } from 'react';
import useRefreshToken from '@lib/hooks/auth/useRefreshToken';
import useRefreshAccessToken from '@lib/hooks/auth/useRefreshAccessToken';
import { useAppSelector } from '@store/app/hooks';
import { selectAccessToken } from '@store/slices/authSlice';
import useLocalStorage from '@lib/hooks/auth/useLocalStorage';

function PersistLogin() {
const [isLoading, setIsLoading] = useState(true);
const refresh = useRefreshToken();
const refreshAccessToken = useRefreshAccessToken();
const accessToken = useAppSelector(selectAccessToken);
const [persist] = useLocalStorage('persist', true);

Expand All @@ -16,29 +16,44 @@ function PersistLogin() {
let isMounted = true;
const verifyRefreshToken = async () => {
try {
await refresh();
await refreshAccessToken();
} catch (err) {
console.error(err);
} finally {
isMounted && setIsLoading(false); // escape memory leak
}
};

// verify only on refresh
!accessToken && persist ? verifyRefreshToken() : setIsLoading(false);
if (!accessToken && persist) {
verifyRefreshToken();
} else {
setIsLoading(false);
}

return () => (isMounted = false);
}, []);

return (
<>
{!persist ? (
<Outlet />
) : isLoading ? (
<p>자동 로그인 처리중입니다...</p>
) : (
<Outlet />
)}
</>
);
if (persist && isLoading) {
// TODO: <p> 삭제
return <p>자동 로그인 처리중입니다...</p>;
} else {
return <Outlet />;
}
}

export default PersistLogin;

// TODO: 테스트 후 주석 삭제
// !accessToken && persist ? verifyRefreshToken() : setIsLoading(false);
// return (
// <>
// {!persist ? (
// <Outlet />
// ) : isLoading ? (
// <p>자동 로그인 처리중입니다...</p>
// ) : (
// <Outlet />
// )}
// </>
// );
3 changes: 1 addition & 2 deletions src/components/auth/RequireAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ function RequireAuth() {
const accessToken = useAppSelector(selectAccessToken);
const isKid = useAppSelector(selectIsKid);

console.log(accessToken);
console.log(isKid);
console.log('aT: ', accessToken);
if (accessToken === '') {
return <Navigate to="auth/login" replace />;
} else if (isKid === null) {
Expand Down
26 changes: 26 additions & 0 deletions src/components/common/CustomSyncLoader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import SyncLoader from 'react-spinners/SyncLoader';
import styled from 'styled-components';

function CustomSyncLoader() {
return (
<Wrapper>
<SyncLoader
size={13}
margin={2}
color="#FFC52F" // yellow400
loading={true}
speedMultiplier={0.7}
/>
</Wrapper>
);
}

export default CustomSyncLoader;

const Wrapper = styled.div`
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ const Template: ComponentStory<typeof PrimaryModal> = (args) => (
<PrimaryModal {...args} />
);

export const 가족이_생겼어요 = Template.bind({});
가족이_생겼어요.args = {
headerText: '가족이 생겼어요',
bodyText: '기획에서 워딩 생각해주세요',
export const 에어팟_사기 = Template.bind({});
에어팟_사기.args = {
isKid: false,
isFemale: false,
headerText: '뱅키즈 첫 가입을 축하해요',
bodyText: '뱅키와 저금을 통해 돈길만 걸어요',
};
2 changes: 1 addition & 1 deletion src/components/common/modals/primaryModal/PrimaryModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
MODAL_CLOSE_TRANSITION_TIME,
MODAL_SLIDE_FROM_POSITION,
MODAL_SLIDE_TO_POSITION,
} from '@lib/constants';
} from '@lib/constants/MODAL';
import useModals from '@lib/hooks/useModals';
import { modals } from '../Modals';

Expand Down
118 changes: 0 additions & 118 deletions src/components/common/modals/receiptModal/DashedBorder.tsx

This file was deleted.

4 changes: 1 addition & 3 deletions src/components/common/modals/receiptModal/ReceiptModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import getHeightByVariant from './getHeightByVariant';
import { IDongil } from '@lib/types/IDongil';
import PerforatedLineTop from './perforatedLines/PerforatedLineTop';
import PerforatedLineBottom from './perforatedLines/PerforatedLineBottom';
import DashedBorder from './DashedBorder';
import TopContent from './contents/TopContent';
import BottomContent from './contents/BottomContent';
import CommentContent from './contents/CommentContent';
Expand All @@ -16,7 +15,7 @@ import {
MODAL_CLOSE_TRANSITION_TIME,
MODAL_SLIDE_FROM_POSITION,
MODAL_SLIDE_TO_POSITION,
} from '@lib/constants';
} from '@lib/constants/MODAL';
import useModals from '@lib/hooks/useModals';
import { modals } from '../Modals';
import { TReceiptModalVariant } from './TReceiptModalVariant';
Expand Down Expand Up @@ -118,7 +117,6 @@ function ReceiptModal({
// @ts-expect-error
<StyledReactModal {...reactModalParams}>
<Content>
<DashedBorder variant={variant} />
<PerforatedLineTop fill={theme.palette.greyScale.white} />
<TopContent variant={variant} title={title} />
<BottomContent
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/modals/receiptModal/SubmitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Button from '@components/common/buttons/Button';
import CheckButton from '@components/common/buttons/CheckButton';
import { Dispatch, SetStateAction } from 'react';
import styled, { css } from 'styled-components';
import { MODAL_CLOSE_TRANSITION_TIME } from '@lib/constants';
import { MODAL_CLOSE_TRANSITION_TIME } from '@lib/constants/MODAL';
import { TReceiptModalVariant } from './TReceiptModalVariant';

interface SubmitButtonProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ const Wrapper = styled.div<{ variant: TReceiptModalVariant }>`
justify-content: flex-start;
align-items: space-between;
position: relative;
padding-left: 17px;
padding-right: 17px;
`;

const SignatureWrapper = styled.div`
Expand Down
Loading

0 comments on commit 7f85916

Please sign in to comment.