-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1367 from academic-relations/1358-impl-executive-…
…activity-report-charged-page impl executive activity report charged page
- Loading branch information
Showing
13 changed files
with
505 additions
and
71 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
packages/web/src/app/executive/activity-report/charged/[id]/page.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"use client"; | ||
|
||
import React, { useEffect, useState } from "react"; | ||
|
||
import Custom404 from "@sparcs-clubs/web/app/not-found"; | ||
import AsyncBoundary from "@sparcs-clubs/web/common/components/AsyncBoundary"; | ||
import LoginRequired from "@sparcs-clubs/web/common/frames/LoginRequired"; | ||
import { useAuth } from "@sparcs-clubs/web/common/providers/AuthContext"; | ||
import ExecutiveActivityReportChargedFrame from "@sparcs-clubs/web/features/executive/activity-report/frames/ExecutiveActivityReportChargedFrame"; | ||
|
||
const ExecutiveActivityReport = () => { | ||
const { isLoggedIn, login, profile } = useAuth(); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
if (isLoggedIn !== undefined || profile !== undefined) { | ||
setLoading(false); | ||
} | ||
}, [isLoggedIn, profile]); | ||
|
||
if (loading) { | ||
return <AsyncBoundary isLoading={loading} isError />; | ||
} | ||
|
||
if (!isLoggedIn) { | ||
return <LoginRequired login={login} />; | ||
} | ||
|
||
if (profile?.type !== "executive") { | ||
return <Custom404 />; | ||
} | ||
|
||
return <ExecutiveActivityReportChargedFrame />; | ||
}; | ||
|
||
export default ExecutiveActivityReport; |
94 changes: 94 additions & 0 deletions
94
.../web/src/features/executive/activity-report/components/ActivityReportChargedClubTable.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import React, { useMemo } from "react"; | ||
|
||
import { ApiAct028ResponseOk } from "@sparcs-clubs/interface/api/activity/endpoint/apiAct028"; | ||
import { | ||
createColumnHelper, | ||
getCoreRowModel, | ||
useReactTable, | ||
} from "@tanstack/react-table"; | ||
|
||
import FlexWrapper from "@sparcs-clubs/web/common/components/FlexWrapper"; | ||
import MoreDetailTitle from "@sparcs-clubs/web/common/components/MoreDetailTitle"; | ||
import Table from "@sparcs-clubs/web/common/components/Table"; | ||
import Tag from "@sparcs-clubs/web/common/components/Tag"; | ||
import { | ||
ActStatusTagList, | ||
ActTypeTagList, | ||
} from "@sparcs-clubs/web/constants/tableTagList"; | ||
import { formatDateTime } from "@sparcs-clubs/web/utils/Date/formatDate"; | ||
import { getTagDetail } from "@sparcs-clubs/web/utils/getTagDetail"; | ||
|
||
import { sortActivitiesByStatusAndCommentedDate } from "../utils/sortActivities"; | ||
|
||
const columnHelper = | ||
createColumnHelper<ApiAct028ResponseOk["activities"][number]>(); | ||
const columns = [ | ||
columnHelper.accessor("name", { | ||
header: "활동명", | ||
cell: info => info.getValue(), | ||
size: 400, | ||
}), | ||
columnHelper.accessor("activityTypeEnum", { | ||
header: "활동 분류", | ||
cell: info => { | ||
const { color, text } = getTagDetail(info.getValue(), ActTypeTagList); | ||
return <Tag color={color}>{text}</Tag>; | ||
}, | ||
size: 248, | ||
}), | ||
columnHelper.accessor("commentedAt", { | ||
header: "검토 일시", | ||
cell: info => { | ||
const date = info.getValue(); | ||
return date ? formatDateTime(date) : "-"; | ||
}, | ||
size: 220, | ||
}), | ||
columnHelper.accessor(row => row.commentedExecutive?.name, { | ||
header: "최종 검토자", | ||
cell: info => info.getValue() || "-", | ||
size: 120, | ||
}), | ||
columnHelper.accessor("activityStatusEnum", { | ||
header: "상태", | ||
cell: info => { | ||
const { color, text } = getTagDetail(info.getValue(), ActStatusTagList); | ||
return <Tag color={color}>{text}</Tag>; | ||
}, | ||
size: 120, | ||
}), | ||
]; | ||
|
||
const ActivityReportChargedClubTable: React.FC<{ | ||
activities: ApiAct028ResponseOk["activities"]; | ||
}> = ({ activities }) => { | ||
const { length } = activities; | ||
|
||
const sortedActivities = useMemo( | ||
() => sortActivitiesByStatusAndCommentedDate(activities), | ||
[activities], | ||
); | ||
|
||
const table = useReactTable({ | ||
data: sortedActivities, | ||
columns, | ||
getCoreRowModel: getCoreRowModel(), | ||
enableSorting: false, | ||
}); | ||
|
||
return ( | ||
<FlexWrapper direction="column" gap={16}> | ||
<MoreDetailTitle | ||
title={`${activities[0]?.club?.name || ""} (${length}개)`} | ||
moreDetail="내역 더보기" | ||
moreDetailPath={`/executive/activity-report/club/${activities[0]?.club?.id}`} | ||
/> | ||
<Table | ||
table={table} | ||
rowLink={row => `/executive/activity-report/${row.id}`} | ||
/> | ||
</FlexWrapper> | ||
); | ||
}; | ||
|
||
export default ActivityReportChargedClubTable; |
102 changes: 102 additions & 0 deletions
102
...web/src/features/executive/activity-report/components/ActivityReportChargedOtherTable.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import React, { useMemo } from "react"; | ||
|
||
import { ApiAct028ResponseOk } from "@sparcs-clubs/interface/api/activity/endpoint/apiAct028"; | ||
import { | ||
createColumnHelper, | ||
getCoreRowModel, | ||
useReactTable, | ||
} from "@tanstack/react-table"; | ||
|
||
import FlexWrapper from "@sparcs-clubs/web/common/components/FlexWrapper"; | ||
import Table from "@sparcs-clubs/web/common/components/Table"; | ||
import Tag from "@sparcs-clubs/web/common/components/Tag"; | ||
import Typography from "@sparcs-clubs/web/common/components/Typography"; | ||
import { | ||
ActStatusTagList, | ||
ActTypeTagList, | ||
} from "@sparcs-clubs/web/constants/tableTagList"; | ||
import { formatDateTime } from "@sparcs-clubs/web/utils/Date/formatDate"; | ||
import { getTagDetail } from "@sparcs-clubs/web/utils/getTagDetail"; | ||
|
||
import { sortActivitiesByStatusAndCommentedDate } from "../utils/sortActivities"; | ||
|
||
const columnHelper = | ||
createColumnHelper<ApiAct028ResponseOk["activities"][number]>(); | ||
const columns = [ | ||
columnHelper.accessor("club.name", { | ||
header: "동아리", | ||
cell: info => info.getValue(), | ||
size: 200, | ||
}), | ||
columnHelper.accessor("name", { | ||
header: "활동명", | ||
cell: info => info.getValue(), | ||
size: 252, | ||
}), | ||
columnHelper.accessor("activityTypeEnum", { | ||
header: "활동 분류", | ||
cell: info => { | ||
const { color, text } = getTagDetail(info.getValue(), ActTypeTagList); | ||
return <Tag color={color}>{text}</Tag>; | ||
}, | ||
size: 248, | ||
}), | ||
columnHelper.accessor("commentedAt", { | ||
header: "검토 일시", | ||
cell: info => { | ||
const date = info.getValue(); | ||
return date ? formatDateTime(date) : "-"; | ||
}, | ||
size: 220, | ||
}), | ||
columnHelper.accessor(row => row.chargedExecutive?.name, { | ||
header: "담당자", | ||
cell: info => | ||
info.getValue() || ( | ||
<Typography color="GRAY.300" fs={16} lh={24}> | ||
(미정) | ||
</Typography> | ||
), | ||
size: 120, | ||
}), | ||
columnHelper.accessor("activityStatusEnum", { | ||
header: "상태", | ||
cell: info => { | ||
const { color, text } = getTagDetail(info.getValue(), ActStatusTagList); | ||
return <Tag color={color}>{text}</Tag>; | ||
}, | ||
size: 120, | ||
}), | ||
]; | ||
|
||
const ActivityReportChargedOtherTable: React.FC<{ | ||
activities: ApiAct028ResponseOk["activities"]; | ||
}> = ({ activities }) => { | ||
const { length } = activities; | ||
|
||
const sortedActivities = useMemo( | ||
() => sortActivitiesByStatusAndCommentedDate(activities), | ||
[activities], | ||
); | ||
|
||
const table = useReactTable({ | ||
data: sortedActivities, | ||
columns, | ||
getCoreRowModel: getCoreRowModel(), | ||
enableSorting: false, | ||
}); | ||
|
||
return ( | ||
<FlexWrapper direction="column" gap={16}> | ||
<Typography fs={20} lh={24} fw="MEDIUM"> | ||
담당자가 아님 ({length}개) | ||
</Typography> | ||
<Table | ||
table={table} | ||
rowLink={row => `/executive/activity-report/${row.id}`} | ||
/> | ||
</FlexWrapper> | ||
); | ||
}; | ||
|
||
export default ActivityReportChargedOtherTable; |
30 changes: 30 additions & 0 deletions
30
.../web/src/features/executive/activity-report/components/ActivityReportChargedStatistic.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from "react"; | ||
|
||
import { ApiAct028ResponseOk } from "@sparcs-clubs/interface/api/activity/endpoint/apiAct028"; | ||
import { ActivityStatusEnum } from "@sparcs-clubs/interface/common/enum/activity.enum"; | ||
|
||
import ActivityReportStatisticContent from "./_atomic/ActivityReportStatisticContent"; | ||
|
||
const ActivityReportChargedStatistic: React.FC<{ | ||
activities: ApiAct028ResponseOk["activities"]; | ||
}> = ({ activities }) => { | ||
const pendingTotalCount = activities.filter( | ||
activity => activity.activityStatusEnum === ActivityStatusEnum.Applied, | ||
).length; | ||
const approvedTotalCount = activities.filter( | ||
activity => activity.activityStatusEnum === ActivityStatusEnum.Approved, | ||
).length; | ||
const rejectedTotalCount = activities.filter( | ||
activity => activity.activityStatusEnum === ActivityStatusEnum.Rejected, | ||
).length; | ||
|
||
return ( | ||
<ActivityReportStatisticContent | ||
pendingTotalCount={pendingTotalCount} | ||
approvedTotalCount={approvedTotalCount} | ||
rejectedTotalCount={rejectedTotalCount} | ||
/> | ||
); | ||
}; | ||
|
||
export default ActivityReportChargedStatistic; |
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
Oops, something went wrong.