Skip to content

Commit f40b396

Browse files
committed
fix: 코드리뷰 반영
1 parent 7b3db0e commit f40b396

File tree

12 files changed

+86
-161
lines changed

12 files changed

+86
-161
lines changed

apps/admin/app/studies/[studyId]/_components/statics/StudyAttendanceRate.tsx renamed to apps/admin/app/studies/[studyId]/_components/statics/StudyAnalyticsGraph.tsx

+13-11
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,29 @@ import type { StudyWeekStatisticsApiResponseDto } from "types/dtos/studyStatisti
55

66
import BarGraph from "./graph/BarGraph";
77

8-
const StudyAttendanceRate = ({
9-
averageAttendanceRate = 0,
8+
const StudyAnalyticsGraph = ({
9+
graphTitle,
10+
averageRate = 0,
1011
totalStudent,
1112
studyWeekStatisticsResponses,
1213
}: {
13-
averageAttendanceRate?: number;
14+
graphTitle: string;
15+
averageRate?: number;
1416
totalStudent?: number;
1517
studyWeekStatisticsResponses?: StudyWeekStatisticsApiResponseDto[];
1618
}) => {
1719
return (
1820
<Flex direction="column" gap="md">
19-
<Text className={StaticsTitleStyle} typo="h3">
20-
출석률
21+
<Text className={staticsTitleStyle} typo="h3">
22+
{graphTitle}
2123
</Text>
2224
<Flex direction="column" gap="xs">
2325
<Flex alignItems="flex-start" direction="column" gap="md">
2426
{studyWeekStatisticsResponses?.map((data) => (
2527
<Flex direction="row" gap="lg" key={data.week} minWidth="340px">
2628
<Text
2729
as="div"
28-
className={StudyWeekStyle}
30+
className={studyWeekStyle}
2931
color="sub"
3032
typo="body1"
3133
>
@@ -39,13 +41,13 @@ const StudyAttendanceRate = ({
3941
</Flex>
4042
))}
4143
<Flex direction="row" gap="lg">
42-
<Text className={StudyWeekStyle} color="sub" typo="body1">
44+
<Text className={studyWeekStyle} color="sub" typo="body1">
4345
평균
4446
</Text>
4547
<BarGraph
4648
barColor="average"
4749
isToolTipActive={false}
48-
percent={averageAttendanceRate}
50+
percent={averageRate}
4951
/>
5052
</Flex>
5153
</Flex>
@@ -54,12 +56,12 @@ const StudyAttendanceRate = ({
5456
);
5557
};
5658

57-
export default StudyAttendanceRate;
59+
export default StudyAnalyticsGraph;
5860

59-
const StudyWeekStyle = css({
61+
const studyWeekStyle = css({
6062
minWidth: "45px",
6163
});
6264

63-
const StaticsTitleStyle = css({
65+
const staticsTitleStyle = css({
6466
marginBottom: "10px",
6567
});

apps/admin/app/studies/[studyId]/_components/statics/StudyAssignmentRate.tsx

-60
This file was deleted.

apps/admin/app/studies/[studyId]/_components/statics/StudyCompleteRate.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use client";
22
import { Flex } from "@styled-system/jsx";
3-
import { Text } from "@wow-class/ui";
4-
import Tooltip from "components/Tooltip";
3+
import { Text, Tooltip } from "@wow-class/ui";
54
import { Help } from "wowds-icons";
65

76
import CircleGraph from "./graph/CircleGraph";

apps/admin/app/studies/[studyId]/_components/statics/StudyStatics.tsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { Flex } from "@styled-system/jsx";
22
import { Space, Text } from "@wow-class/ui";
33
import { studyApi } from "apis/study/studyApi";
44

5-
import StudyAssignmentRate from "./StudyAssignmentRate";
6-
import StudyAttendanceRate from "./StudyAttendanceRate";
5+
import StudyAnalyticsGraph from "./StudyAnalyticsGraph";
76
import StudyCompleteRate from "./StudyCompleteRate";
87

98
const StudyStatics = async ({ studyId }: { studyId: string }) => {
@@ -22,18 +21,18 @@ const StudyStatics = async ({ studyId }: { studyId: string }) => {
2221
</Flex>
2322
<Space height={33} />
2423
<Flex alignItems="flex-start" gap="xl">
25-
<StudyAttendanceRate
26-
averageAttendanceRate={studyStatistics?.averageAttendanceRate}
24+
<StudyAnalyticsGraph
25+
averageRate={studyStatistics?.averageAttendanceRate}
26+
graphTitle="출석률"
2727
totalStudent={studyStatistics?.totalStudentCount}
2828
studyWeekStatisticsResponses={
2929
studyStatistics?.studyWeekStatisticsResponses
3030
}
3131
/>
32-
<StudyAssignmentRate
32+
<StudyAnalyticsGraph
33+
averageRate={studyStatistics?.averageAssignmentSubmissionRate}
34+
graphTitle="과제 제출률"
3335
totalStudent={studyStatistics?.totalStudentCount}
34-
averageAssignmentSubmissionRate={
35-
studyStatistics?.averageAssignmentSubmissionRate
36-
}
3736
studyWeekStatisticsResponses={
3837
studyStatistics?.studyWeekStatisticsResponses
3938
}

apps/admin/app/studies/[studyId]/_components/statics/graph/BarGraph.tsx

+11-12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ const BarGraph = ({
2020
isCurriculumCanceled?: boolean;
2121
}) => {
2222
const [showTooltip, setShowTooltip] = useState(false);
23+
const toggleTooltip = () => {
24+
if (isToolTipActive) setShowTooltip((prevState) => !prevState);
25+
};
2326
return (
2427
<Flex
2528
alignItems="center"
@@ -35,17 +38,13 @@ const BarGraph = ({
3538
{percent > 0 ? (
3639
<div
3740
style={{ width: `${50 + (232 - 50) * (percent / 100)}px` }}
38-
className={BarGraphStyle({
41+
className={barGraphStyle({
3942
type: barColor,
4043
})}
41-
onMouseEnter={() => {
42-
if (isToolTipActive) setShowTooltip(true);
43-
}}
44-
onMouseLeave={() => {
45-
if (isToolTipActive) setShowTooltip(false);
46-
}}
44+
onMouseEnter={toggleTooltip}
45+
onMouseLeave={toggleTooltip}
4746
>
48-
<div className={BarGraphInnerStyle}>
47+
<div className={barGraphInnerStyle}>
4948
<Text className={percentLabelStyle} color="white" typo="label2">
5049
{percent > 0 && `${percent}%`}
5150
</Text>
@@ -57,7 +56,7 @@ const BarGraph = ({
5756
</div>
5857
</div>
5958
) : (
60-
<Text className={ZeroPercentLabel} color="sub" typo="label2">
59+
<Text className={zeroPercentLabelStyle} color="sub" typo="label2">
6160
0%
6261
</Text>
6362
)}
@@ -98,7 +97,7 @@ const BarGraphBackgroundStyle = cva({
9897
},
9998
});
10099

101-
const BarGraphStyle = cva({
100+
const barGraphStyle = cva({
102101
base: {
103102
position: "absolute",
104103
zIndex: 10,
@@ -128,12 +127,12 @@ const percentLabelStyle = css({
128127
alignItems: "center",
129128
});
130129

131-
const BarGraphInnerStyle = css({
130+
const barGraphInnerStyle = css({
132131
position: "relative",
133132
width: "100%",
134133
height: "100%",
135134
});
136135

137-
const ZeroPercentLabel = css({
136+
const zeroPercentLabelStyle = css({
138137
marginLeft: "8px",
139138
});

apps/admin/app/studies/[studyId]/_components/statics/graph/CircleGraph.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ const CircleGraph = ({
2020

2121
return (
2222
<Flex alignItems="center" direction="column" gap="lg" minWidth={size}>
23-
<div className={CircleGraphWrapperStyle}>
23+
<div className={circleGraphWrapperStyle}>
2424
<svg
25-
className={CircleGraphStyle}
25+
className={circleGraphStyle}
2626
height={size}
2727
viewBox={`0 0 ${size} ${size}`}
2828
width={size}
@@ -46,7 +46,7 @@ const CircleGraph = ({
4646
strokeWidth={strokeWidth}
4747
/>
4848
</svg>
49-
<Text className={CircleGraphLabelStyle} typo="h1">
49+
<Text className={circleGraphLabelStyle} typo="h1">
5050
{percentage}%
5151
</Text>
5252
</div>
@@ -56,17 +56,17 @@ const CircleGraph = ({
5656

5757
export default CircleGraph;
5858

59-
const CircleGraphStyle = css({
59+
const circleGraphStyle = css({
6060
width: "100%",
6161
transform: "rotate(-90deg)",
6262
});
6363

64-
const CircleGraphWrapperStyle = css({
64+
const circleGraphWrapperStyle = css({
6565
width: "100%",
6666
position: "relative",
6767
});
6868

69-
const CircleGraphLabelStyle = css({
69+
const circleGraphLabelStyle = css({
7070
position: "absolute",
7171
top: "50%",
7272
left: "50%",

apps/admin/app/studies/[studyId]/_components/statics/graph/GraphToolTip.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ import { css } from "@styled-system/css";
22
import { Text } from "@wow-class/ui";
33
const GraphToolTip = ({ studentCount }: { studentCount: number }) => {
44
return (
5-
<div className={ToolTipContainerStyle}>
6-
<div className={ToolTipStyle}>
5+
<div className={toolTipContainerStyle}>
6+
<div className={toolTipStyle}>
77
<Text color="black" typo="label2">
88
{studentCount}
99
</Text>
1010
</div>
11-
<div className={ToolTipDecoStyle}></div>
11+
<div className={toolTipDecoStyle}></div>
1212
</div>
1313
);
1414
};
1515

1616
export default GraphToolTip;
1717

18-
const ToolTipContainerStyle = css({
18+
const toolTipContainerStyle = css({
1919
position: "absolute",
2020
width: "43px",
2121
height: "38px",
@@ -25,7 +25,7 @@ const ToolTipContainerStyle = css({
2525
zIndex: 20,
2626
});
2727

28-
const ToolTipStyle = css({
28+
const toolTipStyle = css({
2929
position: "relative",
3030
width: "100%",
3131
height: "24px",
@@ -36,7 +36,7 @@ const ToolTipStyle = css({
3636
zIndex: 20,
3737
});
3838

39-
const ToolTipDecoStyle = css({
39+
const toolTipDecoStyle = css({
4040
position: "absolute",
4141
bottom: 0,
4242
left: "50%",

apps/client/app/(afterLogin)/my-study/my-assignment/_components/AssignmentDescription.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { css } from "@styled-system/css";
2+
import { Tooltip } from "@wow-class/ui";
23
import { myStudyApi } from "apis/myStudyApi";
34
import { studyDetailApi } from "apis/studyDetailApi";
4-
import Tooltip from "components/Tooltip";
55
import Link from "next/link";
66

77
export const AssignmentDescription = async () => {

apps/client/components/Tooltip.tsx

-54
This file was deleted.

0 commit comments

Comments
 (0)