Skip to content

Commit

Permalink
[Feature/BAR-146] 헤더, 푸터 링크 및 기능 처리 (#59)
Browse files Browse the repository at this point in the history
* feat: api 추가

* feat: ROUTE 객체 추가

* feat: 미들웨어에서의 처리 추가

* feat: react-notion-x 설치

* feat: Layout 내부에서 버튼 처리

* feat: 약관 페이지 추가

* feat: pathname 변경시 모달 제거

* feat: 로그아웃및 프로필네임 설정

---------

Co-authored-by: wonjin-dev <[email protected]>
  • Loading branch information
miro-ring and wonjin-dev authored Feb 14, 2024
1 parent cb9ca0f commit 1a197b2
Show file tree
Hide file tree
Showing 24 changed files with 780 additions and 144 deletions.
5 changes: 5 additions & 0 deletions middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { NextResponse } from 'next/server';
export const middleware = async (request: NextRequest) => {
const refreshToken = request.cookies.get('refreshToken');

if (request.nextUrl.pathname.startsWith('/terms')) return;

if (refreshToken && request.nextUrl.pathname === '/') {
return NextResponse.redirect(new URL('/main', request.url));
}
if (
!refreshToken &&
request.nextUrl.pathname !== '/' &&
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@
"js-cookie": "^3.0.5",
"ko": "link:dayjs/locale/ko",
"next": "14.0.3",
"notion-client": "^6.16.0",
"notion-types": "^6.16.0",
"react": "^18",
"react-dom": "^18",
"react-notion-x": "^6.16.0",
"zustand": "^4.4.7"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { AppProps } from 'next/app';

import 'react-notion-x/src/styles.css';
import '@styles/global.css';

import Modal from '@components/Modal';
Expand Down
2 changes: 1 addition & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Layout from '@components/Layout';

const Intro = () => {
return <Layout headerType="intro" isShowFooter></Layout>;
return <Layout isFooter></Layout>;
};

export default Intro;
5 changes: 4 additions & 1 deletion pages/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ import useGetWriteHistory from '@domain/끄적이는/queries/useGetHistory';
import * as styles from '@domain/끄적이는/style.css';
import 참고하는TabContent from '@domain/참고하는/components';
import { useInput } from '@hooks/useInput';
import useGetMyProfile from '@queries/useGetMyProfile';
import { COLORS } from '@styles/tokens';

const MainPage = () => {
useGetMyProfile();

const writeInput = useInput({ id: 'write-input' });
const { todayMemos, history } = useGetWriteHistory();
const { mutate: submitTemporalMemo } = useCreateTemporalMemo();

const writeInput = useInput({ id: 'write-input' });
const [selectedTab, setSelectedTab] = useState('끄적이는');

const handleTabSelect = (selectedTab: string) => {
Expand Down
2 changes: 1 addition & 1 deletion pages/profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const ProfilePage = () => {
};

return (
<Layout isShowFooter>
<Layout isFooter>
<div className={styles.container}>
<div className={styles.profileWrapper}>
{profileImg ? (
Expand Down
2 changes: 1 addition & 1 deletion pages/redirect/[authType]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Bridge = () => {
(await getToken(authType, code)) || {};

if (!accessToken || !refreshToken) {
router.push(ROUTES.INTRO);
router.push(ROUTES.LANDING);
return;
}

Expand Down
35 changes: 35 additions & 0 deletions pages/terms/privacy/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { NotionRenderer } from 'react-notion-x';
import { NotionAPI } from 'notion-client';
import { type ExtendedRecordMap } from 'notion-types';

import Layout from '@components/Layout';

interface PrivacyProps {
blockMap: ExtendedRecordMap;
}

const Privacy = ({ blockMap }: PrivacyProps) => {
return (
<Layout>
<NotionRenderer
recordMap={blockMap}
fullPage
darkMode={false}
disableHeader
/>
</Layout>
);
};

export default Privacy;

export const getStaticProps = async () => {
const notion = new NotionAPI();
const recordMap = await notion.getPage('045e6bc33a544855a4a18c839ff746cc');

return {
props: {
blockMap: recordMap,
},
};
};
35 changes: 35 additions & 0 deletions pages/terms/use/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { NotionRenderer } from 'react-notion-x';
import { NotionAPI } from 'notion-client';
import { type ExtendedRecordMap } from 'notion-types';

import Layout from '@components/Layout';

interface UseProps {
blockMap: ExtendedRecordMap;
}

const Use = ({ blockMap }: UseProps) => {
return (
<Layout>
<NotionRenderer
recordMap={blockMap}
fullPage
darkMode={false}
disableHeader
/>
</Layout>
);
};

export default Use;

export const getStaticProps = async () => {
const notion = new NotionAPI();
const recordMap = await notion.getPage('50e74a36bd484d888c975f111488a6df');

return {
props: {
blockMap: recordMap,
},
};
};
Loading

0 comments on commit 1a197b2

Please sign in to comment.