Skip to content

Commit

Permalink
feat: 개근자 목록 데이터 표시 #118
Browse files Browse the repository at this point in the history
  • Loading branch information
Han-Joon-Hyeok committed Dec 29, 2022
1 parent 4cfc86c commit f1091a8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 38 deletions.
40 changes: 11 additions & 29 deletions src/pages/DashboardPage/MonthlyPerfectUserTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import {
import Typography from "@mui/material/Typography";

const columns = [
{ field: "id", headerName: "ID", width: 80 },
{
field: "intraId",
headerName: "Intra ID",
width: 150,
width: 120,
editable: true,
},
{
Expand All @@ -26,31 +25,6 @@ const columns = [
},
];

const rows = [
{ id: 1, intraId: "Snow", totalPerfectCount: 3 },
{
id: 2,
intraId: "Lannister",
totalPerfectCount: 3,
},
{
id: 3,
intraId: "Lannister",
totalPerfectCount: 3,
},
{ id: 4, intraId: "Stark", totalPerfectCount: 3 },
{
id: 5,
intraId: "Targaryen",
totalPerfectCount: 3,
},
{
id: 6,
intraId: "Melisandre",
totalPerfectCount: 3,
},
];

function CustomToolbar() {
return (
<GridToolbarContainer>
Expand All @@ -59,7 +33,15 @@ function CustomToolbar() {
);
}

function MonthlyPerfectUserTable() {
function MonthlyPerfectUserTable(props) {
const { data } = props;
const rows = [];
if (data.length > 0){
data.forEach((user) => {
if (user.isPerfectAttendance)
rows.push(user);
})
}
return (
<Grid item xs={4}>
<Card>
Expand All @@ -72,7 +54,7 @@ function MonthlyPerfectUserTable() {
<DataGrid
rows={rows}
columns={columns}
disableRowSelectionOnClick
getRowId={(row) => row.intraId}
components={{ Toolbar: CustomToolbar }}
/>
</Box>
Expand Down
14 changes: 6 additions & 8 deletions src/pages/DashboardPage/MonthlyUserTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@ function MonthlyUserTable(props) {
const { data } = props;
const rows = [];
if (data.length > 0) {
data.forEach((user) => {
if (user.isPerfectAttendance)
user.isPerfectAttendance = "✅"
else
user.isPerfectAttendance = "❌"
rows.push(user);
}
)
data.forEach((user) => {
if (user.isPerfectAttendance)
rows.push({...user, isPerfectAttendance: "✅"})
else
rows.push({...user, isPerfectAttendance: "❌"})
})
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/DashboardPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function DashboardPage() {
<MonthlyUserTable data={monthlyStatistic} />

{/* EXPLAIN: 이번 달 개근자 목록 테이블 */}
<MonthlyPerfectUserTable />
<MonthlyPerfectUserTable data={monthlyStatistic} />

{/* EXPLAIN: 출석 데이터 수정 */}
<UserAttendanceDataTable />
Expand Down

0 comments on commit f1091a8

Please sign in to comment.