Skip to content

Commit 3822904

Browse files
committed
Merge branch 'class-calendar' of github.com:berkeley-cdss/assignment-snapshots into class-calendar
2 parents 439087e + eae884f commit 3822904

2 files changed

Lines changed: 41 additions & 37 deletions

File tree

src/snapshots-app/client/bundles/components/submission/tabs/summary/BackupCalendarChart.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const BackupCalendarChart = () => {
8383
yearLabel: { show: false },
8484
dayLabel: {
8585
firstDay: 0,
86-
nameMap: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
86+
nameMap: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
8787
},
8888
monthLabel: {
8989
position: "start", // Places month names to the left of the grid

src/snapshots-app/client/bundles/components/submission/tabs/summary/MultiStudentCalendar.jsx

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -71,59 +71,63 @@ const MultiStudentCalendar = () => {
7171
yearLabel: { show: false },
7272
dayLabel: {
7373
firstDay: 0,
74-
nameMap: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
74+
nameMap: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
7575
},
7676
monthLabel: {
7777
position: "start", // Places month names to the left of the grid
7878
margin: 20,
7979
},
8080
},
8181

82-
series: [{
83-
type: "custom",
84-
coordinateSystem: "calendar",
85-
data: calendarData,
82+
series: [
83+
{
84+
type: "custom",
85+
coordinateSystem: "calendar",
86+
data: calendarData,
8687

87-
renderItem: (params, api) => {
88-
const cellPoint = api.coord(api.value(0));
89-
const studentIndex = api.value(3); // index of student for this day
88+
renderItem: (params, api) => {
89+
const cellPoint = api.coord(api.value(0));
90+
const studentIndex = api.value(3); // index of student for this day
9091

91-
// Define a grid inside the cell (e.g., 5x5 grid)
92-
const columns = 5;
93-
const spacing = 8; // Pixels between dots
92+
// Define a grid inside the cell (e.g., 5x5 grid)
93+
const columns = 5;
94+
const spacing = 8; // Pixels between dots
9495

95-
const row = Math.floor(studentIndex / columns);
96-
const col = studentIndex % columns;
96+
const row = Math.floor(studentIndex / columns);
97+
const col = studentIndex % columns;
9798

98-
// Center the grid within the cell
99-
const startX = cellPoint[0] - (columns * spacing) / 2;
100-
const startY = cellPoint[1] - (columns * spacing) / 2;
99+
// Center the grid within the cell
100+
const startX = cellPoint[0] - (columns * spacing) / 2;
101+
const startY = cellPoint[1] - (columns * spacing) / 2;
101102

102-
return {
103-
type: "circle",
104-
shape: {
105-
cx: startX + col * spacing,
106-
cy: startY + row * spacing,
107-
r: 3, // Smaller radius for high density
108-
},
109-
style: api.style()
110-
};
111-
}
112-
}],
103+
return {
104+
type: "circle",
105+
shape: {
106+
cx: startX + col * spacing,
107+
cy: startY + row * spacing,
108+
r: 3, // Smaller radius for high density
109+
},
110+
style: api.style(),
111+
};
112+
},
113+
},
114+
],
113115
};
114116

115117
return (
116118
<>
117-
{calendarData.length === 0 ? <CircularProgress /> : <div style={{ width: "100%", background: "#fff", padding: "20px" }}>
118-
<ReactECharts
119-
option={option}
120-
style={{ height: "500px", width: "100%" }}
121-
/>
122-
</div>
123-
}
119+
{calendarData.length === 0 ? (
120+
<CircularProgress />
121+
) : (
122+
<div style={{ width: "100%", background: "#fff", padding: "20px" }}>
123+
<ReactECharts
124+
option={option}
125+
style={{ height: "500px", width: "100%" }}
126+
/>
127+
</div>
128+
)}
124129
</>
125-
126130
);
127131
};
128132

129-
export default MultiStudentCalendar;
133+
export default MultiStudentCalendar;

0 commit comments

Comments
 (0)