-
Notifications
You must be signed in to change notification settings - Fork 4
[Init] 라우팅 세팅 #23
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
[Init] 라우팅 세팅 #23
Changes from 10 commits
d9446f1
af071f1
f537245
c4de6a9
b0e6a1c
d9d93dc
d446279
4e8db38
ca45fe8
353c0b2
e2eebbb
e3e4516
a5bd326
e8265f2
9e0c652
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { createBrowserRouter } from "react-router-dom"; | ||
| import { publicRoutes } from "./public-routes"; | ||
| import { protectedRoutes } from "./protected-routes"; | ||
|
|
||
| export const router = createBrowserRouter([ | ||
| { | ||
| path: "/", | ||
| // element: <RootLayout />, TODO: RootLayout 추가 | ||
| children: [ | ||
| ...publicRoutes, | ||
|
|
||
| // TODO: auth에 따른 처리 추가 | ||
| ...protectedRoutes, | ||
| // TODO: paths 이외의 경로 접근 시 error 처리 | ||
| ], | ||
| }, | ||
| ]); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| export const ROUTES = { | ||
| HOME: "/", | ||
| LOGIN: "/login", | ||
| ONBOARDING: "/onboarding", | ||
| COMPANY: (id = ":id") => `/company/${id}`, // 기업 상세 | ||
| EXPERIENCE_MATCHING: "/experience-matching", // 경험x기업 매칭 | ||
|
|
||
| MATCHLING_LIST: "/matching", // 경험x기업 매칭 결과 리스트 | ||
| MATCHING_DETAIL: (id = ":id") => `/matching/${id}`, // 매칭 결과 상세 | ||
|
|
||
| EXPERIENCE: "/experience", // 경험 목록 | ||
| EXPERIENCE_CREATE: "/experience/create", // 경험 생성 | ||
| EXPERIENCE_DETAIL: (id = ":id") => `/experience/${id}`, // 경험 상세 | ||
| EXPERIENCE_EDIT: (id = ":id") => `/experience/${id}/edit`, // 경험 수정 | ||
|
|
||
| MYPAGE: "/mypage", | ||
| BOOKMARK: "/bookmark", | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { ROUTES } from "./paths"; | ||
|
|
||
| import { HomePage } from "@/pages/home/home-page"; | ||
| import { OnboardingPage } from "@/pages/onboarding/onboarding-page"; | ||
| import { CompanyDetailPage } from "@/pages/company-detail/company-detail-page"; | ||
|
Check warning on line 5 in src/app/routes/protected-routes.tsx
|
||
|
|
||
| import { ExperienceMatchingPage } from "@/pages/experience-matching/experience-matching-page"; | ||
| import { MatchingListPage } from "@/pages/matching-list/matching-list-page"; | ||
| import { MatchingDetailPage } from "@/pages/matching-detail/matching-detail-page"; | ||
|
|
||
| import { ExperienceDetailPage } from "@/pages/experience-detail/ui/experience-page/experience-detail-page"; | ||
| import { ExperiencePage } from "@/pages/experience/experience-page"; | ||
|
|
||
| import { MyPage } from "@/pages/my-page/my-page"; | ||
| import { BookmarkPage } from "@/pages/bookmark/bookmark-page"; | ||
|
|
||
| export const protectedRoutes = [ | ||
| { path: ROUTES.HOME, element: <HomePage /> }, | ||
| { path: ROUTES.ONBOARDING, element: <OnboardingPage /> }, | ||
|
|
||
| { path: ROUTES.COMPANY(), element: <CompanyDetailPage /> }, | ||
| { path: ROUTES.EXPERIENCE_MATCHING, element: <ExperienceMatchingPage /> }, | ||
|
|
||
| // 매칭 결과 | ||
| { path: ROUTES.MATCHLING_LIST, element: <MatchingListPage /> }, | ||
| { path: ROUTES.MATCHING_DETAIL(), element: <MatchingDetailPage /> }, | ||
|
|
||
| // 경험 | ||
| { path: ROUTES.EXPERIENCE, element: <ExperiencePage /> }, | ||
| { | ||
| path: ROUTES.EXPERIENCE_CREATE, | ||
| element: <ExperienceDetailPage mode="create" />, | ||
| }, | ||
| { | ||
| path: ROUTES.EXPERIENCE_DETAIL(), | ||
| element: <ExperienceDetailPage mode="view" />, | ||
| }, | ||
| { | ||
| path: ROUTES.EXPERIENCE_EDIT(), | ||
| element: <ExperienceDetailPage mode="edit" />, | ||
| }, | ||
|
|
||
| { path: ROUTES.MYPAGE, element: <MyPage /> }, | ||
| { path: ROUTES.BOOKMARK, element: <BookmarkPage /> }, | ||
| ]; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { ROUTES } from "./paths"; | ||
| import { LoginPage } from "@/pages/login/login-page"; | ||
|
|
||
| export const publicRoutes = [ | ||
| { path: ROUTES.LOGIN, element: <LoginPage /> }, | ||
| ]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const BookmarkPage = () => { | ||
| return ( | ||
| <div> | ||
| <h1>Welcome to the Bookmark Page</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { BookmarkPage }; |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 기업 분석 세부 페이지에 대한 라우팅은
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 크아악 초기 세팅할 당시에 만들었던 파일인데 제거하는 걸 깜빡했네요 감사합니다 !
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 로컬에서 해당 폴더가 추적이 안 돼서 보이지 않네요 .. 🥲 추후에 다른 작업 진행하면서 제거 해도 괜찮을까요?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아이구 물론입니다~ ^0^ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { useParams } from "react-router-dom"; | ||
|
|
||
| const CompanyDetailPage = () => { | ||
| const { id } = useParams(); | ||
| return ( | ||
| <div> | ||
| <h1>Company Detail Page - {id}</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { CompanyDetailPage }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { useParams } from "react-router-dom"; | ||
| import { ExperienceForm } from "./experience-form"; | ||
| import { ExperienceViewer } from "./experience-viewer"; | ||
|
|
||
| type mode = "view" | "edit" | "create"; | ||
|
|
||
| interface ExperiencePageProps { | ||
| mode: mode; | ||
| } | ||
|
|
||
| const ExperienceDetailPage = ({ mode }: ExperiencePageProps) => { | ||
| const { id } = useParams<{ id: string }>(); | ||
| switch (mode) { | ||
| case "view": | ||
| return <ExperienceViewer />; | ||
|
|
||
| case "create": | ||
| case "edit": | ||
| return <ExperienceForm mode={mode} id={id} />; | ||
| } | ||
| }; | ||
|
|
||
| export { ExperienceDetailPage }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| type mode = "create" | "edit"; | ||
|
|
||
| interface ExperienceFormProps { | ||
| mode: mode; | ||
| id?: string; | ||
| } | ||
|
|
||
| const ExperienceForm = ({ mode, id }: ExperienceFormProps) => { | ||
| // TODO: mode에 따라 isEdit 모드 분기 처리 | ||
| return ( | ||
| <div> | ||
| <h1> | ||
| Experience Form - {mode} {mode === "edit" && `${id}`} | ||
| </h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { ExperienceForm }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { useParams } from "react-router-dom"; | ||
|
|
||
| const ExperienceViewer = () => { | ||
| const { id } = useParams(); | ||
| return ( | ||
| <div> | ||
| <h1>Experience Viewer - {id}</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { ExperienceViewer }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const ExperienceMatchingPage = () => { | ||
| return ( | ||
| <div> | ||
| <h1>Welcome to the Experience Matching Page</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { ExperienceMatchingPage }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const ExperiencePage = () => { | ||
| return ( | ||
| <div> | ||
| <h1>Experience List Page</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { ExperiencePage }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const LoginPage = () => { | ||
| return ( | ||
| <div> | ||
| <h1>Welcome to the Login Page</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { LoginPage }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { useParams } from "react-router-dom"; | ||
|
|
||
| const MatchingDetailPage = () => { | ||
| const { id } = useParams(); | ||
| return ( | ||
| <div> | ||
| <h1>Welcome to the Matching Detail Page - {id}</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { MatchingDetailPage }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const MatchingListPage = () => { | ||
| return ( | ||
| <div> | ||
| <h1>Welcome to the Matching List Page</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { MatchingListPage }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const MyPage = () => { | ||
| return ( | ||
| <div> | ||
| <h1>Welcome to the My Page</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { MyPage }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const OnboardingPage = () => { | ||
| return ( | ||
| <div> | ||
| <h1>Welcome to the Onboarding Page</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { OnboardingPage }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const RegisterPage = () => { | ||
| return ( | ||
| <div> | ||
| <h1>Welcome to the Register Page</h1> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export { RegisterPage }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분 오타 있는 것 같습니다!!☺️
MATCHING_LIST로 바꾸면 될 것 같아요There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
매칠링~ 감사합니다 ^-^!!!!