Skip to content

Commit

Permalink
refactor : 프로젝트 폴더 구조 수정
Browse files Browse the repository at this point in the history
- 폴더 구조를 app 아래 project, recruitment로 구분
  • Loading branch information
Yujin-Baek committed Nov 9, 2023
1 parent 2327e10 commit 9c315c6
Show file tree
Hide file tree
Showing 33 changed files with 187 additions and 142 deletions.
5 changes: 1 addition & 4 deletions frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'] })

Expand All @@ -19,9 +18,7 @@ export default function RootLayout({
return (
<html lang="en">
<body className={inter.className}>
<Provider>
<NavBar>{children}</NavBar>
</Provider>
<Provider>{children}</Provider>
</body>
</html>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ 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,
selectedStackState,
titleState,
tldrState,
refreshState,
} from '../../../../utils/atoms'
import AllStacks from '../../../../utils/stacks'
} from '../../../../../utils/atoms'
import AllStacks from '../../../../../utils/stacks'

type ReadReplyObject = {
commentId: number
Expand Down Expand Up @@ -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() {
Expand All @@ -79,7 +79,7 @@ export default function ReadingPage({ params }: ParamsType) {
alert('프로젝트 상세 조회 실패')
throw new Error('프로젝트 상세 조회 실패')
}
router.push('/')
router.push('/project')
}

const resData = await res.json()
Expand Down Expand Up @@ -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')
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ 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,
selectedStackState,
thumbnailUrlState,
titleState,
tldrState,
} from '../../../utils/atoms'
} from '../../../../utils/atoms'

const ToastUIEditor = dynamic(
() => import('../../../components/submit/toastUIEditor'),
() => import('../../../../components/project/submit/toastUIEditor'),
{ ssr: false },
)

Expand Down Expand Up @@ -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) {
Expand All @@ -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(() => {
Expand All @@ -104,7 +107,7 @@ export default function NewPost() {
if (!(accessToken || persistToken)) {
// eslint-disable-next-line no-alert
alert('로그인시 이용하실 수 있습니다.')
router.push('/')
router.push('/project')
}
}, [])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ 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,
selectedStackState,
thumbnailUrlState,
titleState,
tldrState,
} from '../../../utils/atoms'
} from '../../../../utils/atoms'

const ToastUIEditor = dynamic(
() => import('../../../components/submit/toastUIEditor'),
() => import('../../../../components/project/submit/toastUIEditor'),
{ ssr: false },
)

Expand Down Expand Up @@ -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(() => {
Expand All @@ -107,7 +105,7 @@ export default function NewPost() {
if (!(accessToken || persistToken)) {
// eslint-disable-next-line no-alert
alert('로그인시 이용하실 수 있습니다.')
router.push('/')
router.push('/project')
}
// 글쓰기 페이지 렌더링 시 변수 초기화
setTitle('')
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<DataObject> = async (data: DataObject) => {
Expand Down Expand Up @@ -112,7 +112,7 @@ export default function Login() {

setUsername(myInfoData.data.nickname)

router.push('/')
router.push('/project')
}

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<DataObject> = async (data: DataObject) => {
Expand Down Expand Up @@ -142,7 +142,7 @@ export default function Registration() {

setUsername(myInfoData.data.nickname)

router.push('/')
router.push('/project')
}

useEffect(() => {
Expand All @@ -152,7 +152,7 @@ export default function Registration() {
if (accessToken || persistToken) {
// eslint-disable-next-line no-alert
alert('이미 로그인 상태입니다.')
router.push('/')
router.push('/project')
}
}, [])

Expand Down
9 changes: 9 additions & 0 deletions frontend/src/app/project/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import ProjectNavBar from '../../components/general/ProjectNavBar'

export default function ProjectLayout({
children,
}: {
children: React.ReactNode
}) {
return <ProjectNavBar>{children}</ProjectNavBar>
}
12 changes: 6 additions & 6 deletions frontend/src/app/page.tsx → frontend/src/app/project/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }) {
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/app/recruitment/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import RecruitmentNavBar from '../../components/general/RecruitmentNavBar'

export default function ProjectLayout({
children,
}: {
children: React.ReactNode
}) {
return <RecruitmentNavBar>{children}</RecruitmentNavBar>
}
File renamed without changes.
Loading

0 comments on commit 9c315c6

Please sign in to comment.