diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index 5e8299c0..b8733d8a 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -2,7 +2,6 @@ import './globals.css' import type { Metadata } from 'next' import { Inter } from 'next/font/google' import Provider from '../components/general/Provider' -import NavBar from '../components/general/NavBar' const inter = Inter({ subsets: ['latin'] }) @@ -19,9 +18,7 @@ export default function RootLayout({ return ( - - {children} - + {children} ) diff --git a/frontend/src/app/(read)/post/[postId]/page.tsx b/frontend/src/app/project/(read)/post/[postId]/page.tsx similarity index 93% rename from frontend/src/app/(read)/post/[postId]/page.tsx rename to frontend/src/app/project/(read)/post/[postId]/page.tsx index 2fa9d733..45c0a546 100644 --- a/frontend/src/app/(read)/post/[postId]/page.tsx +++ b/frontend/src/app/project/(read)/post/[postId]/page.tsx @@ -4,11 +4,11 @@ import Image from 'next/image' import { useEffect, useState, useCallback } from 'react' import { useRouter } from 'next/navigation' import { useRecoilState, useRecoilValue } from 'recoil' -import gptIcon from '../../../../../public/images/svg/gptIcon.svg' -import ProfileIcon from '../../../../../public/images/svg/profileIcon.svg' -import GptModal from '../../../../components/read/GptModal' -import ToastViewer from '../../../../components/read/ToastViewer' -import Reply from '../../../../components/read/Reply' +import gptIcon from '../../../../../../public/images/svg/gptIcon.svg' +import ProfileIcon from '../../../../../../public/images/svg/profileIcon.svg' +import GptModal from '../../../../../components/project/read/GptModal' +import ToastViewer from '../../../../../components/project/read/ToastViewer' +import Reply from '../../../../../components/project/read/Reply' import { contentsState, @@ -16,8 +16,8 @@ import { titleState, tldrState, refreshState, -} from '../../../../utils/atoms' -import AllStacks from '../../../../utils/stacks' +} from '../../../../../utils/atoms' +import AllStacks from '../../../../../utils/stacks' type ReadReplyObject = { commentId: number @@ -54,11 +54,11 @@ export default function ReadingPage({ params }: ParamsType) { }, [isOpenModal]) function toWrite() { - router.push('/write') + router.push('/project/write') } function toModify() { - router.push('/modify') + router.push('/project/modification') } // GET요청 보내서 데이터 가져오고 받은 데이터 변수에 넣어주는 함수 async function getData() { @@ -79,7 +79,7 @@ export default function ReadingPage({ params }: ParamsType) { alert('프로젝트 상세 조회 실패') throw new Error('프로젝트 상세 조회 실패') } - router.push('/') + router.push('/project') } const resData = await res.json() @@ -119,10 +119,10 @@ export default function ReadingPage({ params }: ParamsType) { alert('프로젝트 삭제 실패') throw new Error('프로젝트 삭제 실패') } - router.push('/') + router.push('/project') } else { alert('프로젝트 삭제 성공') - router.push('/') + router.push('/project') } } } diff --git a/frontend/src/app/(search)/search-post/[postName]/page.tsx b/frontend/src/app/project/(search)/search-post/[postName]/page.tsx similarity index 90% rename from frontend/src/app/(search)/search-post/[postName]/page.tsx rename to frontend/src/app/project/(search)/search-post/[postName]/page.tsx index d9bb46f6..8750ee56 100644 --- a/frontend/src/app/(search)/search-post/[postName]/page.tsx +++ b/frontend/src/app/project/(search)/search-post/[postName]/page.tsx @@ -3,9 +3,9 @@ import { useEffect, useState } from 'react' import { useRouter } from 'next/navigation' -import WriteIcon from '../../../../../public/images/svg/pencil-square.svg' -import Banner from '../../../../components/main/Banner' -import ProjectCard from '../../../../components/main/ProjectCard' +import WriteIcon from '../../../../../../public/images/svg/pencil-square.svg' +import Banner from '../../../../../components/project/main/Banner' +import ProjectCard from '../../../../../components/project/main/ProjectCard' type DataObject = { id: number @@ -27,7 +27,7 @@ export default function SearchProjectPage({ params }: ParamsType) { const router = useRouter() // react-router-dom useNavigate 사용 선언 function toWrite() { - router.push('/write') + router.push('/project/write') } async function getData() { diff --git a/frontend/src/app/(search)/search-user/[userName]/page.tsx b/frontend/src/app/project/(search)/search-user/[userName]/page.tsx similarity index 94% rename from frontend/src/app/(search)/search-user/[userName]/page.tsx rename to frontend/src/app/project/(search)/search-user/[userName]/page.tsx index 119bf57d..92ace1cc 100644 --- a/frontend/src/app/(search)/search-user/[userName]/page.tsx +++ b/frontend/src/app/project/(search)/search-user/[userName]/page.tsx @@ -5,9 +5,9 @@ import { useRouter } from 'next/navigation' import { v4 as uuidv4 } from 'uuid' import Image from 'next/image' -import WriteIcon from '../../../../../public/images/svg/pencil-square.svg' -import ProfileIcon from '../../../../../public/images/svg/profileIcon.svg' -import Banner from '../../../../components/main/Banner' +import WriteIcon from '../../../../../../public/images/svg/arrow-right.svg' +import ProfileIcon from '../../../../../../public/images/svg/arrow-left.svg' +import Banner from '../../../../../components/project/main/Banner' type DataObject = { nickname: string diff --git a/frontend/src/app/(submit)/modification/page.tsx b/frontend/src/app/project/(submit)/modification/page.tsx similarity index 88% rename from frontend/src/app/(submit)/modification/page.tsx rename to frontend/src/app/project/(submit)/modification/page.tsx index c6fd64d7..05230cb8 100644 --- a/frontend/src/app/(submit)/modification/page.tsx +++ b/frontend/src/app/project/(submit)/modification/page.tsx @@ -7,8 +7,8 @@ import dynamic from 'next/dynamic' // TODO: NavBar 만들어야 함 // import NavBar from '../../components/general/NavBar' -import ImageUploader from '../../../components/submit/imageUploader' -import TechStackSelection from '../../../components/submit/techStackSelection' +import ImageUploader from '../../../../components/project/submit/imageUploader' +import TechStackSelection from '../../../../components/project/submit/techStackSelection' import { contentsState, projectIdState, @@ -16,10 +16,10 @@ import { thumbnailUrlState, titleState, tldrState, -} from '../../../utils/atoms' +} from '../../../../utils/atoms' const ToastUIEditor = dynamic( - () => import('../../../components/submit/toastUIEditor'), + () => import('../../../../components/project/submit/toastUIEditor'), { ssr: false }, ) @@ -65,14 +65,17 @@ export default function NewPost() { thumbNail: thumbnailUrl, } - const res = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL}/projects`, { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${accessToken || persistToken}`, + const res = await fetch( + `${process.env.NEXT_PUBLIC_BASE_URL}/projects/${projectId}`, + { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${accessToken || persistToken}`, + }, + body: JSON.stringify(data), }, - body: JSON.stringify(data), - }) + ) if (!res.ok) { if (!navigator.onLine) { @@ -89,12 +92,12 @@ export default function NewPost() { } setThumbnailUrl('') - router.push(`/read/${projectId}`) + router.push(`/project/post/${projectId}`) } // 취소 버튼 누를시 메인페이지 이동 function toMain() { - router.push('/') + router.push('/project') } useEffect(() => { @@ -104,7 +107,7 @@ export default function NewPost() { if (!(accessToken || persistToken)) { // eslint-disable-next-line no-alert alert('로그인시 이용하실 수 있습니다.') - router.push('/') + router.push('/project') } }, []) diff --git a/frontend/src/app/(submit)/new-post/page.tsx b/frontend/src/app/project/(submit)/new-post/page.tsx similarity index 93% rename from frontend/src/app/(submit)/new-post/page.tsx rename to frontend/src/app/project/(submit)/new-post/page.tsx index c5f1e983..7fb1b17a 100644 --- a/frontend/src/app/(submit)/new-post/page.tsx +++ b/frontend/src/app/project/(submit)/new-post/page.tsx @@ -5,10 +5,8 @@ import { useRouter } from 'next/navigation' import { useRecoilState } from 'recoil' import dynamic from 'next/dynamic' -// TODO: NavBar 만들어야 함 -// import NavBar from '../../components/general/NavBar' -import ImageUploader from '../../../components/submit/imageUploader' -import TechStackSelection from '../../../components/submit/techStackSelection' +import ImageUploader from '../../../../components/project/submit/imageUploader' +import TechStackSelection from '../../../../components/project/submit/techStackSelection' import { contentsState, projectIdState, @@ -16,10 +14,10 @@ import { thumbnailUrlState, titleState, tldrState, -} from '../../../utils/atoms' +} from '../../../../utils/atoms' const ToastUIEditor = dynamic( - () => import('../../../components/submit/toastUIEditor'), + () => import('../../../../components/project/submit/toastUIEditor'), { ssr: false }, ) @@ -92,12 +90,12 @@ export default function NewPost() { setProjectId(resData.data.projectId) setThumbnailUrl('') - router.push(`/read/${resData.data.projectId}`) + router.push(`/project/post/${resData.data.projectId}`) } // 취소 버튼 누를시 메인페이지 이동 function toMain() { - router.push('/') + router.push('/project') } useEffect(() => { @@ -107,7 +105,7 @@ export default function NewPost() { if (!(accessToken || persistToken)) { // eslint-disable-next-line no-alert alert('로그인시 이용하실 수 있습니다.') - router.push('/') + router.push('/project') } // 글쓰기 페이지 렌더링 시 변수 초기화 setTitle('') diff --git a/frontend/src/app/(user)/login/error.tsx b/frontend/src/app/project/(user)/login/error.tsx similarity index 100% rename from frontend/src/app/(user)/login/error.tsx rename to frontend/src/app/project/(user)/login/error.tsx diff --git a/frontend/src/app/(user)/login/page.tsx b/frontend/src/app/project/(user)/login/page.tsx similarity index 96% rename from frontend/src/app/(user)/login/page.tsx rename to frontend/src/app/project/(user)/login/page.tsx index c33a49fc..33309929 100644 --- a/frontend/src/app/(user)/login/page.tsx +++ b/frontend/src/app/project/(user)/login/page.tsx @@ -10,8 +10,8 @@ import { useRecoilState } from 'recoil' import * as yup from 'yup' import Image from 'next/image' -import Email from '../../../../public/images/svg/email.svg' -import { autoLoginState, usernameState } from '../../../utils/atoms' +import Email from '../../../../../public/images/svg/email.svg' +import { autoLoginState, usernameState } from '../../../../utils/atoms' type DataObject = { email: string @@ -60,11 +60,11 @@ export default function Login() { }) function toMain() { - router.push('/') + router.push('/project') } function toRegistration() { - router.push('/registration') + router.push('/project/registration') } const onSubmit: SubmitHandler = async (data: DataObject) => { @@ -112,7 +112,7 @@ export default function Login() { setUsername(myInfoData.data.nickname) - router.push('/') + router.push('/project') } useEffect(() => { diff --git a/frontend/src/app/(user)/profile/[userName]/page.tsx b/frontend/src/app/project/(user)/profile/[userName]/page.tsx similarity index 94% rename from frontend/src/app/(user)/profile/[userName]/page.tsx rename to frontend/src/app/project/(user)/profile/[userName]/page.tsx index b05d8b20..6db83f5b 100644 --- a/frontend/src/app/(user)/profile/[userName]/page.tsx +++ b/frontend/src/app/project/(user)/profile/[userName]/page.tsx @@ -4,10 +4,10 @@ import { useEffect, useState, useCallback } from 'react' import { useRouter } from 'next/navigation' import Image from 'next/image' -import WritedPost from '../../../../components/user/WritedPost' -import myProfile from '../../../../../public/images/png/myProfile.png' -import WriteIcon from '../../../../../public/images/svg/pencil-square.svg' -import FollowListModal from '../../../../components/user/FollowListModal' +import WritedPost from '../../../../../components/project/user/WritedPost' +import myProfile from '../../../../../../public/images/png/myProfile.png' +import WriteIcon from '../../../../../../public/images/svg/pencil-square.svg' +import FollowListModal from '../../../../../components/project/user/FollowListModal' type GetProjectInfoResponse = { id: number diff --git a/frontend/src/app/(user)/profile/page.tsx b/frontend/src/app/project/(user)/profile/page.tsx similarity index 95% rename from frontend/src/app/(user)/profile/page.tsx rename to frontend/src/app/project/(user)/profile/page.tsx index c4608db4..0ef9b2a0 100644 --- a/frontend/src/app/(user)/profile/page.tsx +++ b/frontend/src/app/project/(user)/profile/page.tsx @@ -50,7 +50,7 @@ export default function MyPage() { } if (resData.data !== undefined) { - router.push(`/profile/${resData.data.nickname}`) + router.push(`/project/profile/${resData.data.nickname}`) } } diff --git a/frontend/src/app/(user)/registration/error.tsx b/frontend/src/app/project/(user)/registration/error.tsx similarity index 100% rename from frontend/src/app/(user)/registration/error.tsx rename to frontend/src/app/project/(user)/registration/error.tsx diff --git a/frontend/src/app/(user)/registration/page.tsx b/frontend/src/app/project/(user)/registration/page.tsx similarity index 96% rename from frontend/src/app/(user)/registration/page.tsx rename to frontend/src/app/project/(user)/registration/page.tsx index 9fbc4718..416c25be 100644 --- a/frontend/src/app/(user)/registration/page.tsx +++ b/frontend/src/app/project/(user)/registration/page.tsx @@ -10,8 +10,8 @@ import { useRecoilState, useRecoilValue } from 'recoil' import * as yup from 'yup' import Image from 'next/image' -import Email from '../../../../public/images/svg/email.svg' -import { autoLoginState, usernameState } from '../../../utils/atoms' +import Email from '../../../../../public/images/svg/email.svg' +import { autoLoginState, usernameState } from '../../../../utils/atoms' type DataObject = { email: string @@ -65,11 +65,11 @@ export default function Registration() { }) function toMain() { - router.push('/') + router.push('/project') } function toLogin() { - router.push('/login') + router.push('/project/login') } const onSubmit: SubmitHandler = async (data: DataObject) => { @@ -142,7 +142,7 @@ export default function Registration() { setUsername(myInfoData.data.nickname) - router.push('/') + router.push('/project') } useEffect(() => { @@ -152,7 +152,7 @@ export default function Registration() { if (accessToken || persistToken) { // eslint-disable-next-line no-alert alert('이미 로그인 상태입니다.') - router.push('/') + router.push('/project') } }, []) diff --git a/frontend/src/app/project/layout.tsx b/frontend/src/app/project/layout.tsx new file mode 100644 index 00000000..f6e765db --- /dev/null +++ b/frontend/src/app/project/layout.tsx @@ -0,0 +1,9 @@ +import ProjectNavBar from '../../components/general/ProjectNavBar' + +export default function ProjectLayout({ + children, +}: { + children: React.ReactNode +}) { + return {children} +} diff --git a/frontend/src/app/page.tsx b/frontend/src/app/project/page.tsx similarity index 91% rename from frontend/src/app/page.tsx rename to frontend/src/app/project/page.tsx index 211715f6..ef0c4b94 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/project/page.tsx @@ -6,10 +6,10 @@ import { useRouter } from 'next/navigation' import { useRecoilValue } from 'recoil' import Image from 'next/image' -import WriteIcon from '../../public/images/svg/pencil-square.svg' -import Banner from '../components/main/Banner' -import ProjectCard from '../components/main/ProjectCard' -import { searchTextState } from '../utils/atoms' +import WriteIcon from '../../../public/images/svg/pencil-square.svg' +import Banner from '../../components/project/main/Banner' +import ProjectCard from '../../components/project/main/ProjectCard' +import { searchTextState } from '../../utils/atoms' type DataObject = { id: number @@ -20,13 +20,13 @@ type DataObject = { thumbNail: string } -export default function Main() { +export default function ProjectMain() { const searchText = useRecoilValue(searchTextState) const router = useRouter() function toWrite() { - router.push('/write') + router.push('/project/write') } async function getData({ pageParam = 1 }) { diff --git a/frontend/src/app/recruitment/layout.tsx b/frontend/src/app/recruitment/layout.tsx new file mode 100644 index 00000000..bda59322 --- /dev/null +++ b/frontend/src/app/recruitment/layout.tsx @@ -0,0 +1,9 @@ +import RecruitmentNavBar from '../../components/general/RecruitmentNavBar' + +export default function ProjectLayout({ + children, +}: { + children: React.ReactNode +}) { + return {children} +} diff --git a/frontend/src/app/(error)/error/page.tsx b/frontend/src/app/recruitment/page.tsx similarity index 100% rename from frontend/src/app/(error)/error/page.tsx rename to frontend/src/app/recruitment/page.tsx diff --git a/frontend/src/components/general/NavBar.tsx b/frontend/src/components/general/ProjectNavBar.tsx similarity index 92% rename from frontend/src/components/general/NavBar.tsx rename to frontend/src/components/general/ProjectNavBar.tsx index 9b60efc8..5e518af5 100644 --- a/frontend/src/components/general/NavBar.tsx +++ b/frontend/src/components/general/ProjectNavBar.tsx @@ -40,9 +40,9 @@ export default function NavBar({ children }: { children: React.ReactNode }) { router.push('/') } else if (searchText.charAt(0) === '@') { const searchUserName = searchText.substring(1) - router.push(`/search-user/${searchUserName}`) + router.push(`/project/search-user/${searchUserName}`) } else { - router.push(`/search-post/${searchText}`) + router.push(`/project/search-post/${searchText}`) } } @@ -51,7 +51,7 @@ export default function NavBar({ children }: { children: React.ReactNode }) { signOut() setBtnText('로그인') } else { - router.push('/login') + router.push('/project/login') } } @@ -63,7 +63,7 @@ export default function NavBar({ children }: { children: React.ReactNode }) { } }, [pathname]) - if (pathname === '/login' || pathname === '/registration') { + if (pathname === '/project/login' || pathname === '/project/registration') { return children } @@ -122,7 +122,7 @@ export default function NavBar({ children }: { children: React.ReactNode }) {