-
Notifications
You must be signed in to change notification settings - Fork 1
[feat] add sidebar dashboard list api call #16
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
Changes from all commits
6cf6c4b
5d7f72c
d34e36f
c4311a7
ab405fc
eb01929
5f459ee
e376dfe
c3e80b2
1f9ab11
ddc18c6
8c59f5e
4202618
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .title { | ||
| color: skyblue; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import styles from './not-found.module.css'; | ||
|
|
||
| export default function NotFoundPage() { | ||
| return <div className={styles.title}>Page not found!!</div>; | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| .dashBoards { | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| gap: 6px; | ||
| } | ||
|
|
||
| .active { | ||
| color: salmon; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import Link from 'next/link'; | ||
| import { usePathname } from 'next/navigation'; | ||
| import type { GetDashboardsResponse } from '@/app/(with-header-sidebar)/mydashboard/_types/dashboards'; | ||
| import styles from './Dashboards.module.css'; | ||
| import useApi from '@/app/(with-header-sidebar)/mydashboard/_hooks/useApi'; | ||
|
|
||
| export default function Dashboards() { | ||
| const pathname = usePathname(); | ||
|
|
||
| const { data } = useApi<GetDashboardsResponse>('/dashboards', { | ||
| method: 'GET', | ||
| params: { navigationMethod: 'infiniteScroll', page: 1, size: 10 }, | ||
| }); | ||
|
|
||
| const dashboards = data?.dashboards; | ||
|
|
||
| return ( | ||
| <div className={styles.dashBoards}> | ||
| {dashboards && | ||
| dashboards.map((board) => ( | ||
| <Link | ||
| key={board.id} | ||
| href={`/dashboard/${board.id}`} | ||
| className={`link ${pathname === '/dashboard/' + board.id ? styles.active : ''}`} | ||
| > | ||
| {board.title} | ||
| </Link> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| .sideBar { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| gap: 30px; | ||
| } | ||
|
|
||
| .logo { | ||
| background-color: transparent; | ||
| text-align: left; | ||
| } | ||
|
|
||
| .addDashBoardsContainer { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .addDashBoardsTitle { | ||
| display: none; | ||
| } | ||
|
|
||
| .addButton { | ||
| background-color: transparent; | ||
| width: 20px; | ||
| } | ||
|
|
||
| @media screen and (min-width: 768px) { | ||
| .sideBar { | ||
| min-width: 155px; | ||
| } | ||
|
|
||
| .addDashBoardsTitle { | ||
| display: inline; | ||
| color: var(--gray-500); | ||
| font-size: 12px; | ||
| font-weight: 600; | ||
| } | ||
| } | ||
|
|
||
| @media screen and (min-width: 1199px) { | ||
| .sideBar { | ||
| min-width: 300px; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,47 @@ | ||
| 'use client'; | ||
|
|
||
| import Link from 'next/link'; | ||
| import { usePathname } from 'next/navigation'; | ||
| import Image from 'next/image'; | ||
| import Button from './Button'; | ||
| import useWindowSize from '@/app/(with-header-sidebar)/mydashboard/hooks/useWindowSize'; | ||
| import Button from '../Button'; | ||
| import useWindowSize from '@/app/(with-header-sidebar)/mydashboard/_hooks/useWindowSize'; | ||
| import Dashboards from './DashBoards'; | ||
| import styles from './SideBar.module.css'; | ||
|
|
||
| export default function SideBar() { | ||
| const pathname = usePathname(); | ||
| const { isMobile } = useWindowSize(); | ||
|
|
||
| return ( | ||
| <div className={styles.sideBar}> | ||
| <Button aria-label="ννμ΄μ§ μ΄λ" className={styles.button}> | ||
| <Button aria-label="ννμ΄μ§ μ΄λ" className={styles.logo}> | ||
| {isMobile ? ( | ||
| <Image | ||
| src="/images/logo_small.svg" | ||
| alt="λ‘κ³ ννμ΄μ§μ΄λ" | ||
| width={24} | ||
| height={27} | ||
| priority | ||
|
Collaborator
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. μ½μμ priorityλ£μΌλΌκ³ μλ©λ κ°μ§κ³ κ± λ£μμ΄μ |
||
| /> | ||
| ) : ( | ||
| <Image | ||
| src="/images/logo_large.svg" | ||
| alt="λ‘κ³ ννμ΄μ§μ΄λ" | ||
| width={109} | ||
| height={33} | ||
| priority | ||
| /> | ||
| )} | ||
| </Button> | ||
| <Button aria-label="λμ보λ μΆκ°νκΈ°" className={styles.button}> | ||
| <Image | ||
| src="/icons/add_box.svg" | ||
| alt="λμ보λ μΆκ°νκΈ°" | ||
| width={20} | ||
| height={20} | ||
| /> | ||
| </Button> | ||
| <Link | ||
| href={'/dashboard/1'} | ||
| className={`link ${pathname === '/dashboard/1' ? styles.active : ''}`} | ||
| > | ||
| O | ||
| </Link> | ||
| <Link | ||
| href={'/dashboard/2'} | ||
| className={`link ${pathname === '/dashboard/2' ? styles.active : ''}`} | ||
| > | ||
| O | ||
| </Link> | ||
| <div className={styles.addDashBoardsContainer}> | ||
| <span className={styles.addDashBoardsTitle}>Dash Boards</span> | ||
| <Button aria-label="λμ보λ μΆκ°νκΈ°" className={styles.addButton}> | ||
| <Image | ||
| src="/icons/add_box.svg" | ||
| alt="λμ보λ μΆκ°νκΈ°" | ||
| width={20} | ||
| height={20} | ||
| /> | ||
| </Button> | ||
| </div> | ||
| <Dashboards /> | ||
| </div> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { NextRequest, NextResponse } from 'next/server'; | ||
|
|
||
| export function middleware(request: NextRequest) { | ||
| const user = request.cookies.get('user'); // TODO get token | ||
|
Owner
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. λ―Έλ€μ¨μ΄ μ¬μ©νλ €λ©΄ set cookie headerλ₯Ό μ€μ ν΄μΌκ² λ€μ π€
Collaborator
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. @najitwo μ..!
Collaborator
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. μ
Owner
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. μ ν¬ apiκ° set cookie header κ° λμλκ² μλλΌκ°μ§κ³ ...μλ§ λ§λ€μ΄μΌ λ κ±°μμ!!
Owner
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
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. μ μλλλ€ μ κ° μλͺ»μκ°νμ΄μ
Owner
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. μ΄κ±΄... set cookie μν΄μ€ λ°±μλ νμΌλ‘ π€£ |
||
|
|
||
| // const restrictedPaths = ['/dashboard', '/mypage', '/mydashboard']; | ||
|
Collaborator
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. μ΄κ² μ§μ§ μ μ©λμ΄μΌνλ μ½λμΈλ° μ§κΈ κ°λ°μ€μ΄λΌ μ£Όμμ²λ¦¬ ν΄λ¨μ΅λλ€ |
||
| const restrictedPaths = ['/test']; | ||
|
|
||
| if ( | ||
| restrictedPaths.some((path) => request.nextUrl.pathname.startsWith(path)) | ||
| ) { | ||
| if (!user) { | ||
| // return NextResponse.redirect(new URL('/login', request.url)); | ||
| return NextResponse.redirect(new URL('/', request.url)); | ||
| } | ||
| } | ||
|
|
||
| return NextResponse.next(); | ||
| } | ||
|
|
||
| export const config = { | ||
| // matcher: ['/dashboard/:path*', '/mypage', '/mydashboard/:path*'], | ||
| matcher: ['/test'], | ||
| }; | ||

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.
μ¬κΈ°μ JSON.stringify() μ΄κ²μ μ¬μ©νμ μλκ° λκ°μ???
κ·Έλ₯ optionsλ‘ λ£μΌλ©΄ μλλμ?
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.
@najitwo λμ½μλ¨222....
μ΄κ±°.. optionλ€μ΄ νμ λ€λ₯Έκ°μ κ°μ§κ³ μ€λκ±°λΌμ 무νλ‘λ© λλλΌκ΅¬μ...