Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [55] 마이페이지, 회원탈퇴 구현 #56

Merged
merged 2 commits into from
Aug 8, 2024
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
14 changes: 0 additions & 14 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
},
"dependencies": {
"@hookform/resolvers": "^3.9.0",
"@lukemorales/query-key-factory": "^1.3.4",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-tabs": "^1.1.0",
"@reduxjs/toolkit": "^2.2.6",
Expand Down
11 changes: 10 additions & 1 deletion web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ const router = createBrowserRouter([
};
},
},
{
path: 'mypage',
lazy: async () => {
const { default: MyPage } = await import('@/pages/my-page');
return {
Component: MyPage,
};
},
},
{
path: 'myevent',
lazy: async () => {
Expand Down Expand Up @@ -86,7 +95,7 @@ export default function App() {
<Provider store={store}>
<QueryClientProvider client={queryClient}>
<GlobalStyles />
<Toaster position="top-center" richColors />
<Toaster position="bottom-center" richColors />
<RouterProvider router={router} />
</QueryClientProvider>
</Provider>
Expand Down
Binary file removed web/src/assets/step1.png
Binary file not shown.
Binary file removed web/src/assets/step2.png
Binary file not shown.
Binary file removed web/src/assets/step3.png
Binary file not shown.
4 changes: 2 additions & 2 deletions web/src/components/auth/sign-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ export const SignIn = () => {
</form>
</Form>
<div className="signin-config">
<span>비밀번호 찾기</span>
<p>아이디 찾기</p>
<div className="sep" />
<span>아이디 찾기</span>
<p>비밀번호 찾기</p>
<div className="sep" />
<Link to="/auth?authType=up" className="signup">
회원가입
Expand Down
20 changes: 10 additions & 10 deletions web/src/components/auth/sign-up1.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { AppDispatch, RootState } from '@/store';
import { toggleCheck } from '@/store/signup/terms';
import { body1Style, head1Style } from '@/styles/global-styles';
import { COLORS } from '@/theme';
import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import styled from 'styled-components';
import { Subtitle } from '../common/Subtitle';
import { body1Style, head1Style } from '@/styles/global-styles';
import { COLORS } from '@/theme';
import { toggleCheck } from '@/store/signup/terms';
import { AppDispatch, RootState } from '@/store';

import { useNavigate } from 'react-router-dom';
import checkRound from '../../assets/checkRound.png';
import uncheckRound from '../../assets/uncheckRound.png';
import rightArrow from '../../assets/rigth.png';
import { useNavigate } from 'react-router-dom';
import uncheckRound from '../../assets/uncheckRound.png';

export const SignUp1: React.FC = () => {
const dispatch = useDispatch<AppDispatch>();
Expand Down Expand Up @@ -98,7 +98,7 @@ export const SignUp1: React.FC = () => {
<img src={rightArrow} width="18px" height="18px" />
</TermItem>
</TermsContainer>
<NextButton onClick={handleNextClick} enabled={isButtonEnabled}>
<NextButton onClick={handleNextClick} $enabled={isButtonEnabled}>
다음으로
</NextButton>
</Container>
Expand Down Expand Up @@ -183,17 +183,17 @@ const Total = styled.div`
`;

interface NextButtonProps {
enabled: boolean;
$enabled: boolean;
}

const NextButton = styled.button<NextButtonProps>`
width: 100%;
padding: 10px;
background-color: ${props => (props.enabled ? COLORS.Main : COLORS.Gray3)};
background-color: ${props => (props.$enabled ? COLORS.Main : COLORS.Gray3)};
color: #fff;
border: none;
border-radius: 10px;
cursor: ${props => (props.enabled ? 'pointer' : 'not-allowed')};
cursor: ${props => (props.$enabled ? 'pointer' : 'not-allowed')};
font-size: 16px;
font-weight: bold;
margin-top: 200px;
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/auth/sign-up2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import { zodResolver } from '@hookform/resolvers/zod';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { useDispatch } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner';
import styled from 'styled-components';
import { Subtitle } from '../common/Subtitle';
import { Label } from '../common/label';
import { useNavigate } from 'react-router-dom';

export const SignUp2 = () => {
const dispatch = useDispatch<AppDispatch>();
Expand Down Expand Up @@ -171,7 +171,7 @@ export const SignUp2 = () => {
</div>
</div>
</div>
<NextButton as="button" type="submit" enabled={isEmailVerified}>
<NextButton as="button" type="submit" $enabled={isEmailVerified}>
다음으로
</NextButton>
</form>
Expand Down Expand Up @@ -251,17 +251,17 @@ const Confirm1 = styled.button`
`;

interface NextButtonProps {
enabled: boolean;
$enabled: boolean;
}

const NextButton = styled.button<NextButtonProps>`
width: 100%;
padding: 10px;
background-color: ${props => (props.enabled ? COLORS.Main : COLORS.Gray3)};
background-color: ${props => (props.$enabled ? COLORS.Main : COLORS.Gray3)};
color: #fff;
border: none;
border-radius: 10px;
cursor: ${props => (props.enabled ? 'pointer' : 'not-allowed')};
cursor: ${props => (props.$enabled ? 'pointer' : 'not-allowed')};
font-size: 16px;
font-weight: bold;
margin-top: 80px;
Expand Down
1 change: 1 addition & 0 deletions web/src/components/common/header/header.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const HeaderWrapper = styled.header`
padding: 0 1.25rem;
display: flex;
align-items: center;
justify-content: space-between;

h1 {
font-weight: bold;
Expand Down
33 changes: 31 additions & 2 deletions web/src/components/common/header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
import { ComponentProps } from 'react';
import { ComponentProps, useEffect, useState } from 'react';
import { HeaderWrapper } from './header.styles';
import styled from 'styled-components';
import btnMypage from '@/assets/btn_mypage.png';
import { useNavigate } from 'react-router-dom';

type HeaderProps = ComponentProps<'header'>;

export const Header = ({ children }: HeaderProps) => {
return <HeaderWrapper>{children}</HeaderWrapper>;
const [isLoggedIn, setIsLoggedIn] = useState(false);
const navigate = useNavigate();

useEffect(() => {
const token = localStorage.getItem('token');
if (token) {
setIsLoggedIn(true);
}
}, []);

const moveMyPage = () => {
navigate('/mypage');
};

return (
<HeaderWrapper>
{children}
{isLoggedIn && (
<MypageIcon src={btnMypage} alt="My Page" onClick={moveMyPage} />
)}
</HeaderWrapper>
);
};

const MypageIcon = styled.img`
width: 38px;
cursor: pointer;
`;
15 changes: 15 additions & 0 deletions web/src/components/mypage/DeleteModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useDeleteUser } from '@/services/queries/user.mutation';

export const DeleteModal = () => {
const { deleteUserAccount, isDeleting } = useDeleteUser();

const handleDelete = () => {
deleteUserAccount().then(() => onClose());
};

return (
<>
<div>탈퇴</div>
</>
);
};
28 changes: 28 additions & 0 deletions web/src/components/mypage/user-info.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { body1Style } from '@/styles/global-styles';
import { COLORS } from '@/theme';
import styled from 'styled-components';

export const Information = styled.div`
${body1Style}
color: ${COLORS.Gray1};
border-bottom: 1px solid ${COLORS.Gray5};
padding: 30px 0px 30px 0px;
`;

export const BasicInfo = styled.div`
margin-bottom: 20px;
`;

export const InfoContainer = styled.div`
display: flex;
gap: 27px;
`;
export const Info = styled.p`
${body1Style}
color: ${COLORS.Gray2};
`;

export const Id = styled.a`
color: ${COLORS.Gray2};
text-decoration: none;
`;
28 changes: 28 additions & 0 deletions web/src/components/mypage/user-info.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { UserInfoType } from '@/types/user';
import {
BasicInfo,
Id,
Info,
InfoContainer,
Information,
} from './user-info.styles';

export const UserInfo = ({ user }: { user: UserInfoType }) => {
return (
<Information>
<BasicInfo>기본 정보</BasicInfo>
<InfoContainer>
<Info>아이디</Info>
<Id>{user.userId}</Id>
</InfoContainer>
<InfoContainer>
<Info>휴대폰</Info>
<Id>{user.phoneNumber}</Id>
</InfoContainer>
<InfoContainer>
<Info>이메일</Info>
<Id>{user.email}</Id>
</InfoContainer>
</Information>
);
};
8 changes: 4 additions & 4 deletions web/src/lib/query-keys.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createQueryKeyStore } from '@lukemorales/query-key-factory';
const USER = 'user';

export const queries = createQueryKeyStore({
export const queries = {
user: {
all: null,
DEFAULT: [USER],
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

2개는 무슨 차이인가용?

Copy link
Contributor

Choose a reason for hiding this comment

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

처음에는 퀴리키 생성 라이브러리를 사용하려했는데, 저희가 복잡한 퀴리를 다루지 않을것같아서 직접 구현하였습니다!

});
};
8 changes: 8 additions & 0 deletions web/src/lib/schema/auth.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ export const signinSchema = z.object({
export type SignupOneStepType = z.infer<typeof signupOneStepSchema>;
export type SignupTwoStepType = z.infer<typeof signupTwoStepSchema>;
export type SigninType = z.infer<typeof signinSchema>;
export type SignupPayload = {
userId: string;
name: string;
password: string;
email: string;
phone: string;
verificationCode: string;
};
Loading
Loading