Skip to content

Commit

Permalink
Feat: 설정-작성한 후기 페이지
Browse files Browse the repository at this point in the history
  • Loading branch information
MEGUMMY1 committed Nov 30, 2024
1 parent 5052d8b commit 46bca85
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/components/Setting/MyReview/MyReview.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@import '@/styles/globals.scss';

.container {
background-color: $white;
padding: 0 20px;
@include Drag;
}

.section {
width: 100%;
height: 64px;
display: flex;
justify-content: space-between;
align-items: center;
align-self: stretch;
border-bottom: 1px solid $gray10;
@include B14M;
}

.subtext {
@include C12M;
color: $gray50;
}

.cursor {
cursor: pointer;
}
5 changes: 5 additions & 0 deletions src/components/Setting/MyReview/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import styles from './MyReview.module.scss';

export default function MyReview() {
return <div className={styles.container}></div>;
}
15 changes: 15 additions & 0 deletions src/components/Setting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import DeleteAccount from '../Auth/DeleteAccount';
import Logout from '../Auth/Logout';
import { useEffect, useState } from 'react';
import { getProfile, ProfileResponse } from '@/apis/get/getProfile';
import IconComponent from '../Asset/Icon';
import router from 'next/router';

export default function Setting() {
const [profile, setProfile] = useState<ProfileResponse>();
Expand All @@ -26,8 +28,21 @@ export default function Setting() {
}
}, [loading]);

const handleReviewPageClick = () => {
router.push('/setting/my-review');
};

return (
<div className={styles.container}>
<section
className={`${styles.section} ${styles.cursor}`}
onClick={handleReviewPageClick}
>
<p>내가 작성한 후기</p>
<div className={styles.cursor}>
<IconComponent name="right" size="l" />
</div>
</section>
<section className={styles.section}>
<p>계정정보</p>
<div>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function App({ Component, pageProps }: AppProps) {
'/details/[businessId]/map',
'/setting',
'/search',
'/setting/my-review',
].includes(router.pathname);
const hideHeader = [
'/',
Expand All @@ -77,6 +78,7 @@ export default function App({ Component, pageProps }: AppProps) {
'/setting',
'/search',
'/popular',
'/setting/my-review',
].includes(router.pathname);
const withoutHeader = ['/', '/login'].includes(router.pathname);
const tabNav = ['/lesson', '/popular'].includes(router.pathname);
Expand Down
File renamed without changes.
46 changes: 46 additions & 0 deletions src/pages/setting/my-review.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import Subheader from '@/components/Layout/Subheader';
import MyReview from '@/components/Setting/MyReview';
import { authState } from '@/states/authState';
import { useRouter } from 'next/router';
import { useEffect } from 'react';
import { useRecoilValue } from 'recoil';
import { InitialPageMeta } from '@/components/MetaData';
import { SSRMetaProps } from '@/components/MetaData/MetaData.type';
import { serviceUrl } from '@/constants/serviceUrl';
import { GetServerSideProps } from 'next';

export const getServerSideProps: GetServerSideProps = async () => {
const OGTitle = '작성 후기 | HELLOFIT';
const OGUrl = `${serviceUrl}/setting/my-review`;
return {
props: {
OGTitle,
OGUrl,
},
};
};

export default function MyReviewPage({ OGTitle, OGUrl }: SSRMetaProps) {
const auth = useRecoilValue(authState);
const router = useRouter();

useEffect(() => {
// 로그인이 되어 있지 않으면 /map으로 이동
if (!auth.isLoggedIn) {
router.push('/map');
}
}, [auth.isLoggedIn, router]);

// 로그인 상태 확인 중에는 렌더링을 멈춤
if (!auth.isLoggedIn) {
return null;
}

return (
<>
<InitialPageMeta title={OGTitle} url={OGUrl} />
<Subheader subheaderText="작성 후기" isGray={false} />
<MyReview />
</>
);
}

0 comments on commit 46bca85

Please sign in to comment.