Skip to content

Commit c15914f

Browse files
committed
[Refactor] 폴더명 변경
2 parents dc08c2d + 94ac0b4 commit c15914f

File tree

5 files changed

+94
-45
lines changed

5 files changed

+94
-45
lines changed

src/api/axiosInstance.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import axios from "axios";
22

3+
// 👉 디버깅용 로그 출력
4+
console.log("🔐 BASE_URL:", process.env.NEXT_PUBLIC_BASE_URL);
5+
console.log("🔐 API_TOKEN:", process.env.NEXT_PUBLIC_API_TOKEN);
6+
37
const axiosInstance = axios.create({
48
baseURL: process.env.NEXT_PUBLIC_BASE_URL,
59
});
610

11+
// 👉 Authorization 헤더 자동 설정
712
axiosInstance.defaults.headers.common["Authorization"] =
8-
`Bearer ${process.env.NEXT_PUBLIC_API_TOKEN} `;
13+
`Bearer ${process.env.NEXT_PUBLIC_API_TOKEN}`;
914

1015
export default axiosInstance;

src/api/sidemenu.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import axiosInstance from "./axiosInstance";
2+
3+
export interface Dashboard {
4+
id: number;
5+
title: string;
6+
color: string;
7+
userId: number;
8+
createdAt: string;
9+
updatedAt: string;
10+
createdByMe: boolean;
11+
}
12+
13+
export const getDashboards = async ({
14+
teamId,
15+
navigationMethod = "pagination",
16+
page = 1,
17+
size = 10,
18+
}: {
19+
teamId: string;
20+
navigationMethod?: "pagination";
21+
page?: number;
22+
size?: number;
23+
}): Promise<{
24+
dashboards: Dashboard[];
25+
totalCount: number;
26+
cursorId: string | null;
27+
}> => {
28+
const res = await axiosInstance.get(`${teamId}/dashboards`, {
29+
params: { navigationMethod, page, size },
30+
});
31+
32+
return res.data;
33+
};

src/components/SideMenu/SideMenu.tsx

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,44 @@ import clsx from "clsx";
22
import Image from "next/image";
33
import Link from "next/link";
44
import { 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}

src/pages/404.tsx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
1+
import { useEffect } from "react";
2+
import { useRouter } from "next/router";
3+
14
export default function Custom404() {
5+
const router = useRouter();
6+
7+
const goToMain = () => {
8+
router.push("/");
9+
};
10+
11+
useEffect(() => {
12+
const timer = setTimeout(() => {
13+
router.push("/");
14+
}, 5000);
15+
16+
return () => clearTimeout(timer);
17+
}, [router]);
18+
219
return (
3-
<div className="flex flex-col items-center justify-center h-screen text-center">
4-
<h1 className="text-4xl font-bold text-[var(--primary)]">
5-
404 Not Found
6-
</h1>
7-
<p className="mt-2 text-lg text-black3">페이지를 찾을 수 없습니다.</p>
20+
<div className="flex flex-col items-center justify-center text-center h-screen bg-[var(--color-gray5)] gap-2">
21+
<h1 className="font-24b text-[var(--primary)]">404 Not Found</h1>
22+
<p className="font-16r text-black3">페이지를 찾을 수 없습니다.</p>
23+
<p className="font-16r text-black3">5초 후 홈페이지로 이동합니다.</p>
24+
<button
25+
onClick={goToMain}
26+
className="w-[200px] h-[50px] bg-[var(--primary)] font-16m text-white rounded-lg cursor-pointer"
27+
>
28+
홈페이지 이동하기
29+
</button>
830
</div>
931
);
1032
}

src/pages/mydashboard.tsx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,8 @@ import DashboardAddButton from "@/components/button/DashboardAddButton";
77
import CardButton from "@/components/button/CardButton";
88
import { PaginationBtn } from "@/components/button/PaginationBtn";
99

10-
const dummyDashboards: Dashboard[] = [
11-
{
12-
id: 1,
13-
title: "기획안",
14-
color: "#F87171",
15-
createdAt: "2024-01-01T00:00:00Z",
16-
updatedAt: "2024-01-02T00:00:00Z",
17-
createdByMe: true,
18-
userId: 101,
19-
},
20-
{
21-
id: 2,
22-
title: "디자인 시안",
23-
color: "#60A5FA",
24-
createdAt: "2024-01-03T00:00:00Z",
25-
updatedAt: "2024-01-04T00:00:00Z",
26-
createdByMe: false,
27-
userId: 102,
28-
},
29-
];
30-
3110
export default function MyDashboardPage() {
11+
const teamId = "13";
3212
const [dashCards, setDashCards] = useState<string[]>([]);
3313
const [currentPage, setCurrentPage] = useState(1);
3414
const itemsPerPage = 6;
@@ -57,7 +37,7 @@ export default function MyDashboardPage() {
5737

5838
return (
5939
<div className="flex h-screen overflow-hidden">
60-
<SideMenu dashboardList={dummyDashboards} />
40+
<SideMenu teamId="13-4" />
6141

6242
<div className="flex flex-col flex-1 overflow-hidden">
6343
<HeaderDashboard />

0 commit comments

Comments
 (0)