-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,066 additions
and
22 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Box from "@mui/material/Box"; | ||
import DashBoardChart from "./DashBoardChart"; | ||
import DashBoardTable from "./DashBoardTable"; | ||
import { DashBoardData } from "../../interface/DashBoard.interface"; | ||
|
||
export default function DashBoard() { | ||
// 최근 일주일간의 데이터 | ||
const data: DashBoardData[] = [ | ||
{ date: "2023-10-20", visitors: 100, signups: 25, reviews: 10 }, | ||
{ date: "2023-10-21", visitors: 150, signups: 30, reviews: 15 }, | ||
{ date: "2023-10-22", visitors: 120, signups: 20, reviews: 12 }, | ||
{ date: "2023-10-23", visitors: 200, signups: 50, reviews: 20 }, | ||
{ date: "2023-10-24", visitors: 180, signups: 40, reviews: 18 }, | ||
{ date: "2023-10-25", visitors: 220, signups: 60, reviews: 25 }, | ||
{ date: "2023-10-26", visitors: 250, signups: 70, reviews: 30 }, | ||
]; | ||
|
||
return ( | ||
<Box sx={{ display: "flex" }}> | ||
<DashBoardChart data={data} /> | ||
<DashBoardTable data={data} /> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { | ||
LineChart, | ||
Line, | ||
XAxis, | ||
YAxis, | ||
CartesianGrid, | ||
Tooltip, | ||
Legend, | ||
ResponsiveContainer, | ||
} from "recharts"; | ||
import { Paper, Typography } from "@mui/material"; | ||
import { customColors } from "../../styles/base/Variable.style"; | ||
import { DashBoardProps } from "../../interface/DashBoard.interface"; | ||
import Box from "@mui/material/Box"; | ||
|
||
export default function DashBoardChart({ data }: DashBoardProps) { | ||
return ( | ||
<Paper | ||
elevation={3} | ||
style={{ | ||
padding: "20px", | ||
width: "35vw", | ||
margin: "40px 0px 40px 40px", | ||
border: `2px solid ${customColors.sub_pink}`, | ||
}} | ||
> | ||
<Box sx={{ marginBottom: "20px" }}> | ||
<Typography variant="h6">회원가입 / 방문자 현황</Typography> | ||
</Box> | ||
|
||
<ResponsiveContainer width="100%" aspect={1.8}> | ||
<LineChart data={data}> | ||
<CartesianGrid strokeDasharray="3 3" /> | ||
<XAxis dataKey="date" tickFormatter={(date) => date.substring(5)} /> | ||
<YAxis /> | ||
<Tooltip /> | ||
<Legend /> | ||
<Line | ||
type="linear" | ||
dataKey="visitors" | ||
stroke={customColors.main_blue} | ||
name="방문자 수" | ||
/> | ||
<Line | ||
type="linear" | ||
dataKey="signups" | ||
stroke={customColors.sub_blue} | ||
name="회원가입 수" | ||
/> | ||
</LineChart> | ||
</ResponsiveContainer> | ||
</Paper> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import SideBar from "../reuse/sidebar/SideBar"; | ||
import Box from "@mui/material/Box"; | ||
import DashBoard from "./DashBoard"; | ||
|
||
// 대시보드 페이지 | ||
export default function DashBoardForm() { | ||
return ( | ||
<Box sx={{ display: "flex" }}> | ||
<SideBar /> | ||
대시보드 페이지 | ||
<DashBoard /> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { | ||
Paper, | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableContainer, | ||
TableHead, | ||
TableRow, | ||
Typography, | ||
} from "@mui/material"; | ||
import { customColors } from "../../styles/base/Variable.style"; | ||
import { | ||
DashBoardProps, | ||
DashBoardMonthData, | ||
} from "../../interface/DashBoard.interface"; | ||
|
||
import Box from "@mui/material/Box"; | ||
|
||
export default function DashBoardTable({ data }: DashBoardProps) { | ||
// 이번달 합계 데이터 | ||
const sum_data: DashBoardMonthData = { | ||
visitors: 10000, | ||
signups: 400, | ||
reviews: 3000, | ||
}; | ||
|
||
// 주간 방문자 수, 회원가입 수, 리뷰 수 | ||
const weekVisitors = data.reduce((total, item) => total + item.visitors, 0); | ||
const weekSignups = data.reduce((total, item) => total + item.signups, 0); | ||
const weekReviews = data.reduce((total, item) => total + item.reviews, 0); | ||
|
||
// 월간 합계 데이터 | ||
const thisMonthData = { | ||
date: "이번 달 합계", | ||
visitors: sum_data ? sum_data.visitors : 0, | ||
signups: sum_data ? sum_data.signups : 0, | ||
reviews: sum_data ? sum_data.reviews : 0, | ||
}; | ||
|
||
// 주간 합계 데이터 | ||
const thisWeekData = { | ||
date: "최근 7일 합계", | ||
visitors: weekVisitors, | ||
signups: weekSignups, | ||
reviews: weekReviews, | ||
}; | ||
|
||
return ( | ||
<Paper | ||
elevation={3} | ||
style={{ | ||
padding: "20px", | ||
width: "35vw", | ||
margin: "40px 0px 40px 40px", | ||
border: `2px solid ${customColors.sub_pink}`, | ||
}} | ||
> | ||
<Box sx={{ marginBottom: "20px" }}> | ||
<Typography variant="h6">일자별 요약</Typography> | ||
</Box> | ||
<TableContainer> | ||
<Table> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>일자</TableCell> | ||
<TableCell>방문자</TableCell> | ||
<TableCell>가입자</TableCell> | ||
<TableCell>리뷰</TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{data.map((item) => ( | ||
<TableRow key={item.date}> | ||
<TableCell>{item.date}</TableCell> | ||
<TableCell>{item.visitors}</TableCell> | ||
<TableCell>{item.signups}</TableCell> | ||
<TableCell>{item.reviews}</TableCell> | ||
</TableRow> | ||
))} | ||
|
||
<TableRow key={thisWeekData.date}> | ||
<TableCell>{thisWeekData.date}</TableCell> | ||
<TableCell>{thisWeekData.visitors}</TableCell> | ||
<TableCell>{thisWeekData.signups}</TableCell> | ||
<TableCell>{thisWeekData.reviews}</TableCell> | ||
</TableRow> | ||
<TableRow key={thisMonthData.date}> | ||
<TableCell>{thisMonthData.date}</TableCell> | ||
<TableCell>{thisMonthData.visitors}</TableCell> | ||
<TableCell>{thisMonthData.signups}</TableCell> | ||
<TableCell>{thisMonthData.reviews}</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
</Paper> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export interface DashBoardProps { | ||
data: DashBoardData[]; | ||
} | ||
|
||
export interface DashBoardData { | ||
date: string; | ||
visitors: number; | ||
signups: number; | ||
reviews: number; | ||
} | ||
|
||
export interface DashBoardMonthData { | ||
visitors: number; | ||
signups: number; | ||
reviews: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
import App from "./App.tsx"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.