@@ -2,30 +2,45 @@ 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" ;
56
6- import { Dashboard } from "@/components/SideMenu/dashboard " ;
7+ import { getDashboards } from "@/api/sidemenu " ;
78
8- interface Props {
9- dashboardList : Dashboard [ ] ;
9+ interface Dashboard {
10+ id : number ;
11+ title : string ;
12+ color : string ;
13+ userId : number ;
14+ createdAt : string ;
15+ updatedAt : string ;
16+ createdByMe : boolean ;
1017}
1118
12- export default function SideMenu ( { dashboardList } : Props ) {
19+ interface SideMenuProps {
20+ teamId : string ;
21+ }
22+
23+ export default function SideMenu ( { teamId } : SideMenuProps ) {
1324 const router = useRouter ( ) ;
1425 const { boardid } = router . query ;
1526 const boardId = parseInt ( boardid as string ) ;
1627
28+ const [ dashboardList , setDashboardList ] = useState < Dashboard [ ] > ( [ ] ) ;
29+
30+ useEffect ( ( ) => {
31+ getDashboards ( { teamId } )
32+ . then ( ( res ) => setDashboardList ( res . dashboards ) )
33+ . catch ( ( err ) => console . error ( "대시보드 로딩 실패:" , err ) ) ;
34+ } , [ teamId ] ) ;
35+
1736 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- { /* 🔥 로고 섹션 - 반응형 정렬 */ }
37+ < 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" >
38+ { /* 로고 */ }
2339 < div className = "mb-14 px-3 sm:mb-9 sm:px-0" >
2440 < Link
2541 href = { "/" }
2642 className = "flex lg:justify-start md:justify-start sm:justify-center"
2743 >
28- { /* ✅ 태블릿 & 데스크톱: 큰 로고 (768px 이상) */ }
2944 < Image
3045 src = "/svgs/logo_taskify.svg"
3146 alt = "Taskify Large Logo"
@@ -35,7 +50,6 @@ export default function SideMenu({ dashboardList }: Props) {
3550 priority
3651 unoptimized
3752 />
38- { /* ✅ 모바일 & 초소형 화면: 작은 로고 (767px 이하) */ }
3953 < Image
4054 src = "/svgs/logo.svg"
4155 alt = "Taskify Small Logo"
@@ -48,10 +62,9 @@ export default function SideMenu({ dashboardList }: Props) {
4862 </ Link >
4963 </ div >
5064
51- { /* 🔥 대시보드 리스트 타이틀 + 추가 버튼 */ }
65+ { /* 대시보드 타이틀 */ }
5266 < nav >
5367 < div className = "mb-4 flex items-center justify-between px-3 md:px-2" >
54- { /* ✅ Dash Boards 텍스트 (768px 이상에서만 표시) */ }
5568 < span className = "hidden md:block font-12sb text-[var(--color-black)]" >
5669 Dash Boards
5770 </ span >
@@ -66,7 +79,7 @@ export default function SideMenu({ dashboardList }: Props) {
6679 </ button >
6780 </ div >
6881
69- { /* 🔥 대시보드 목록 - 모바일에서 중앙 정렬 */ }
82+ { /* 대시보드 목록 */ }
7083 < ul className = "flex flex-col lg:items-start md:items-start sm:items-center sm:w-full" >
7184 { dashboardList . map ( ( dashboard ) => (
7285 < li
@@ -81,7 +94,6 @@ export default function SideMenu({ dashboardList }: Props) {
8194 href = { `/dashboard/${ dashboard . id } ` }
8295 className = "flex items-center gap-3 sm:gap-2"
8396 >
84- { /* 컬러 아이콘 */ }
8597 < svg
8698 xmlns = "http://www.w3.org/2000/svg"
8799 width = "8"
@@ -92,8 +104,6 @@ export default function SideMenu({ dashboardList }: Props) {
92104 >
93105 < circle cx = "4" cy = "4" r = "4" />
94106 </ svg >
95-
96- { /* 대시보드 제목 & 크라운 아이콘 */ }
97107 < div className = "hidden md:flex items-center gap-2" >
98108 < span className = "truncate font-18m md:text-base" >
99109 { dashboard . title }
0 commit comments