@@ -2,30 +2,44 @@ import clsx from "clsx";
22import Image from "next/image" ;
33import Link from "next/link" ;
44import { useRouter } from "next/router" ;
5+ import { useEffect , useState } from "react" ;
6+ import { getDashboards } from "@/api/sidemenu" ;
57
6- import { Dashboard } from "@/components/sideMenu/dashboard" ;
8+ interface Dashboard {
9+ id : number ;
10+ title : string ;
11+ color : string ;
12+ userId : number ;
13+ createdAt : string ;
14+ updatedAt : string ;
15+ createdByMe : boolean ;
16+ }
717
8- interface Props {
9- dashboardList : Dashboard [ ] ;
18+ interface SideMenuProps {
19+ teamId : string ;
1020}
1121
12- export default function SideMenu ( { dashboardList } : Props ) {
22+ export default function SideMenu ( { teamId } : SideMenuProps ) {
1323 const router = useRouter ( ) ;
1424 const { boardid } = router . query ;
1525 const boardId = parseInt ( boardid as string ) ;
1626
27+ const [ dashboardList , setDashboardList ] = useState < Dashboard [ ] > ( [ ] ) ;
28+
29+ useEffect ( ( ) => {
30+ getDashboards ( { teamId } )
31+ . then ( ( res ) => setDashboardList ( res . dashboards ) )
32+ . catch ( ( err ) => console . error ( "대시보드 로딩 실패:" , err ) ) ;
33+ } , [ teamId ] ) ;
34+
1735 return (
18- < aside
19- className = "h-screen overflow-y-auto border-r border-[var(--color-gray3)] px-3 py-5
20- lg:w-[300px] md:w-[160px] sm:w-[67px] transition-all duration-200 flex flex-col"
21- >
22- { /* 🔥 로고 섹션 - 반응형 정렬 */ }
36+ < aside className = "h-screen overflow-y-auto border-r border-[var(--color-gray3)] px-3 py-5 lg:w-[300px] md:w-[160px] sm:w-[67px] transition-all duration-200 flex flex-col" >
37+ { /* 로고 */ }
2338 < div className = "mb-14 px-3 sm:mb-9 sm:px-0" >
2439 < Link
2540 href = { "/" }
2641 className = "flex lg:justify-start md:justify-start sm:justify-center"
2742 >
28- { /* ✅ 태블릿 & 데스크톱: 큰 로고 (768px 이상) */ }
2943 < Image
3044 src = "/svgs/logo_taskify.svg"
3145 alt = "Taskify Large Logo"
@@ -35,7 +49,6 @@ export default function SideMenu({ dashboardList }: Props) {
3549 priority
3650 unoptimized
3751 />
38- { /* ✅ 모바일 & 초소형 화면: 작은 로고 (767px 이하) */ }
3952 < Image
4053 src = "/svgs/logo.svg"
4154 alt = "Taskify Small Logo"
@@ -48,10 +61,9 @@ export default function SideMenu({ dashboardList }: Props) {
4861 </ Link >
4962 </ div >
5063
51- { /* 🔥 대시보드 리스트 타이틀 + 추가 버튼 */ }
64+ { /* 대시보드 타이틀 */ }
5265 < nav >
5366 < div className = "mb-4 flex items-center justify-between px-3 md:px-2" >
54- { /* ✅ Dash Boards 텍스트 (768px 이상에서만 표시) */ }
5567 < span className = "hidden md:block font-12sb text-[var(--color-black)]" >
5668 Dash Boards
5769 </ span >
@@ -66,7 +78,7 @@ export default function SideMenu({ dashboardList }: Props) {
6678 </ button >
6779 </ div >
6880
69- { /* 🔥 대시보드 목록 - 모바일에서 중앙 정렬 */ }
81+ { /* 대시보드 목록 */ }
7082 < ul className = "flex flex-col lg:items-start md:items-start sm:items-center sm:w-full" >
7183 { dashboardList . map ( ( dashboard ) => (
7284 < li
@@ -81,7 +93,6 @@ export default function SideMenu({ dashboardList }: Props) {
8193 href = { `/dashboard/${ dashboard . id } ` }
8294 className = "flex items-center gap-3 sm:gap-2"
8395 >
84- { /* 컬러 아이콘 */ }
8596 < svg
8697 xmlns = "http://www.w3.org/2000/svg"
8798 width = "8"
@@ -92,8 +103,6 @@ export default function SideMenu({ dashboardList }: Props) {
92103 >
93104 < circle cx = "4" cy = "4" r = "4" />
94105 </ svg >
95-
96- { /* 대시보드 제목 & 크라운 아이콘 */ }
97106 < div className = "hidden md:flex items-center gap-2" >
98107 < span className = "truncate font-18m md:text-base" >
99108 { dashboard . title }
0 commit comments