@cuemath/leap 3.5.30-j1 → 3.5.30-j2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-utils.js +69 -54
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-utils.js.map +1 -1
- package/dist/features/timeline/monthly-report/comps/attendance/attendence-view.js +30 -30
- package/dist/features/timeline/monthly-report/comps/attendance/attendence-view.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,92 +1,107 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import f from "../../../../../assets/line-icons/icons/check2.js";
|
|
3
|
+
import _ from "../../../../../assets/line-icons/icons/cross.js";
|
|
4
|
+
import c from "../../../../../assets/line-icons/icons/dots-icon.js";
|
|
5
5
|
import D from "../../../../../assets/line-icons/icons/pause-icon.js";
|
|
6
|
-
import { ATTENDANCE_STATUS as
|
|
6
|
+
import { ATTENDANCE_STATUS as s } from "./attendance-constants.js";
|
|
7
7
|
import { StatusSymbol as C } from "./attendance.styled.js";
|
|
8
8
|
import T from "../../../../ui/theme/clrs.js";
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const p = T(), R = (t, n) => {
|
|
10
|
+
var o;
|
|
11
|
+
if (!(t != null && t.length)) return "";
|
|
12
|
+
const e = t.map((i) => {
|
|
13
|
+
const r = new Date(i.time * 1e3).getHours();
|
|
14
|
+
return `${r % 12 || 12} ${r >= 12 ? "PM" : "AM"}`;
|
|
15
|
+
});
|
|
16
|
+
return t.every(
|
|
17
|
+
(i) => {
|
|
18
|
+
var r, u;
|
|
19
|
+
return i.is_present === ((r = t == null ? void 0 : t[0]) == null ? void 0 : r.is_present) && i.is_paused === ((u = t == null ? void 0 : t[0]) == null ? void 0 : u.is_paused);
|
|
20
|
+
}
|
|
21
|
+
) ? `${n} / ${e.join(" / ")}
|
|
22
|
+
${((o = t == null ? void 0 : t[0]) == null ? void 0 : o.status) || ""}` : [n, ...t.map(y)].join(`
|
|
23
|
+
`);
|
|
24
|
+
}, $ = (t) => t.is_present ? s.ATTENDED : t.is_paused ? s.PAUSED : s.MISSED, P = (t) => {
|
|
25
|
+
let n = 0, e = 0, a = 0;
|
|
11
26
|
Object.values(t).forEach((i) => {
|
|
12
|
-
i.forEach((
|
|
13
|
-
switch (
|
|
14
|
-
case
|
|
15
|
-
|
|
27
|
+
i.forEach((r) => {
|
|
28
|
+
switch ($(r)) {
|
|
29
|
+
case s.ATTENDED:
|
|
30
|
+
n++;
|
|
16
31
|
break;
|
|
17
|
-
case
|
|
18
|
-
|
|
32
|
+
case s.PAUSED:
|
|
33
|
+
a++;
|
|
19
34
|
break;
|
|
20
35
|
default:
|
|
21
|
-
|
|
36
|
+
e++;
|
|
22
37
|
break;
|
|
23
38
|
}
|
|
24
39
|
});
|
|
25
40
|
});
|
|
26
|
-
const
|
|
27
|
-
return
|
|
28
|
-
},
|
|
41
|
+
const o = [];
|
|
42
|
+
return n > 0 && o.push(`${n} attended`), e > 0 && o.push(`${e} missed`), a > 0 && o.push(`${a} paused`), `${o.join(", ")}.`;
|
|
43
|
+
}, b = (t) => {
|
|
29
44
|
if (t.length === 0)
|
|
30
45
|
return {
|
|
31
46
|
status: null,
|
|
32
47
|
themeColor: null,
|
|
33
48
|
statusSymbol: ""
|
|
34
49
|
};
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
status:
|
|
50
|
+
const n = t.every((o) => o.is_present), e = t.every((o) => o.is_paused), a = t.every((o) => !o.is_present && !o.is_paused);
|
|
51
|
+
return n ? {
|
|
52
|
+
status: s.ATTENDED,
|
|
38
53
|
themeColor: "GREEN_1",
|
|
39
|
-
statusSymbol: /* @__PURE__ */
|
|
54
|
+
statusSymbol: /* @__PURE__ */ m(f, { color: "GREEN_6", width: 14, height: 14 }),
|
|
40
55
|
tooltipBgColor: "GREEN_2",
|
|
41
|
-
snackbarBg:
|
|
42
|
-
} :
|
|
43
|
-
status:
|
|
56
|
+
snackbarBg: p.GREEN_2
|
|
57
|
+
} : e ? {
|
|
58
|
+
status: s.PAUSED,
|
|
44
59
|
themeColor: "WHITE_4",
|
|
45
|
-
statusSymbol: /* @__PURE__ */
|
|
60
|
+
statusSymbol: /* @__PURE__ */ m(D, { color: "BLACK_T_60", width: 8, height: 8 }),
|
|
46
61
|
tooltipBgColor: "WHITE_5",
|
|
47
|
-
snackbarBg:
|
|
48
|
-
} :
|
|
49
|
-
status:
|
|
62
|
+
snackbarBg: p.WHITE_5
|
|
63
|
+
} : a ? {
|
|
64
|
+
status: s.MISSED,
|
|
50
65
|
themeColor: "ORANGE_1",
|
|
51
|
-
statusSymbol: /* @__PURE__ */
|
|
66
|
+
statusSymbol: /* @__PURE__ */ m(_, { color: "RED", width: 12, height: 12 }),
|
|
52
67
|
tooltipBgColor: "ORANGE_2",
|
|
53
|
-
snackbarBg:
|
|
68
|
+
snackbarBg: p.ORANGE_2
|
|
54
69
|
} : {
|
|
55
|
-
status:
|
|
70
|
+
status: s.PAUSED,
|
|
56
71
|
themeColor: "WHITE_4",
|
|
57
|
-
statusSymbol: /* @__PURE__ */
|
|
72
|
+
statusSymbol: /* @__PURE__ */ m(C, { $top: "2px", $right: "2px", children: /* @__PURE__ */ m(c, { color: "GREEN_6", width: 8, height: 8 }) }),
|
|
58
73
|
tooltipBgColor: "WHITE_5",
|
|
59
|
-
snackbarBg:
|
|
74
|
+
snackbarBg: p.WHITE_5
|
|
60
75
|
};
|
|
61
|
-
},
|
|
62
|
-
const
|
|
63
|
-
for (let
|
|
76
|
+
}, x = (t, n, e) => {
|
|
77
|
+
const a = new Date(e, n - 1, 1).getDay(), o = new Date(e, n, 0).getDate(), i = [];
|
|
78
|
+
for (let r = 0; r < a; r++)
|
|
64
79
|
i.push(null);
|
|
65
|
-
for (let
|
|
66
|
-
const
|
|
80
|
+
for (let r = 1; r <= o; r++) {
|
|
81
|
+
const u = `${e}-${n.toString().padStart(2, "0")}-${r.toString().padStart(2, "0")}`, d = t[u] || [], { status: g, themeColor: h, statusSymbol: E, tooltipBgColor: S, snackbarBg: l } = b(d);
|
|
67
82
|
i.push({
|
|
68
|
-
date:
|
|
69
|
-
status:
|
|
70
|
-
hasClasses:
|
|
71
|
-
classes:
|
|
72
|
-
themeColor:
|
|
83
|
+
date: r,
|
|
84
|
+
status: g,
|
|
85
|
+
hasClasses: d.length > 0,
|
|
86
|
+
classes: d,
|
|
87
|
+
themeColor: h,
|
|
73
88
|
statusSymbol: E,
|
|
74
|
-
tooltipBgColor:
|
|
75
|
-
snackbarBg:
|
|
89
|
+
tooltipBgColor: S,
|
|
90
|
+
snackbarBg: l
|
|
76
91
|
});
|
|
77
92
|
}
|
|
78
93
|
return i;
|
|
79
|
-
},
|
|
94
|
+
}, y = (t) => {
|
|
80
95
|
if (!t.status) return "";
|
|
81
|
-
const
|
|
82
|
-
return `${`${
|
|
96
|
+
const e = new Date(t.time * 1e3).getHours(), a = e >= 12 ? "PM" : "AM";
|
|
97
|
+
return `${`${e % 12 || 12} ${a}`}: ${t.status}`;
|
|
83
98
|
};
|
|
84
99
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
P as attendanceStatsText,
|
|
101
|
+
x as generateCalendarGrid,
|
|
102
|
+
$ as getClassStatus,
|
|
103
|
+
b as getDayStatusInfo,
|
|
104
|
+
R as getSnackbarMsg,
|
|
105
|
+
y as getStatusText
|
|
91
106
|
};
|
|
92
107
|
//# sourceMappingURL=attendance-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attendance-utils.js","sources":["../../../../../../src/features/timeline/monthly-report/comps/attendance/attendance-utils.tsx"],"sourcesContent":["import type { JSX } from 'react';\n\nimport Check2Icon from '../../../../../assets/line-icons/icons/check2';\nimport CrossIcon from '../../../../../assets/line-icons/icons/cross';\nimport DotIcon from '../../../../../assets/line-icons/icons/dots-icon';\nimport PauseIcon from '../../../../../assets/line-icons/icons/pause-icon';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { IClassEvent, TCalendarData } from '../../monthly-report-types';\nimport { ATTENDANCE_STATUS } from './attendance-constants';\nimport type { ICalendarDay, TAttendanceStatus } from './attendance-types';\nimport * as Styled from './attendance.styled';\nimport getColors from '../../../../ui/theme/clrs';\n\nconst colors = getColors();\n\nexport const getSnackbarMsg = (classes: IClassEvent[] | undefined, date: string) => {\n return
|
|
1
|
+
{"version":3,"file":"attendance-utils.js","sources":["../../../../../../src/features/timeline/monthly-report/comps/attendance/attendance-utils.tsx"],"sourcesContent":["import type { JSX } from 'react';\n\nimport Check2Icon from '../../../../../assets/line-icons/icons/check2';\nimport CrossIcon from '../../../../../assets/line-icons/icons/cross';\nimport DotIcon from '../../../../../assets/line-icons/icons/dots-icon';\nimport PauseIcon from '../../../../../assets/line-icons/icons/pause-icon';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { IClassEvent, TCalendarData } from '../../monthly-report-types';\nimport { ATTENDANCE_STATUS } from './attendance-constants';\nimport type { ICalendarDay, TAttendanceStatus } from './attendance-types';\nimport * as Styled from './attendance.styled';\nimport getColors from '../../../../ui/theme/clrs';\n\nconst colors = getColors();\n\nexport const getSnackbarMsg = (classes: IClassEvent[] | undefined, date: string) => {\n if (!classes?.length) return '';\n\n const timings = classes.map(cls => {\n const hours = new Date(cls.time * 1000).getHours();\n\n return `${hours % 12 || 12} ${hours >= 12 ? 'PM' : 'AM'}`;\n });\n\n const allSame = classes.every(\n cls => cls.is_present === classes?.[0]?.is_present && cls.is_paused === classes?.[0]?.is_paused,\n );\n\n if (allSame) {\n return `${date} / ${timings.join(' / ')}\\n${classes?.[0]?.status || ''}`;\n }\n\n return [date, ...classes.map(getStatusText)].join('\\n');\n};\n\nexport const getClassStatus = (classEvent: IClassEvent): TAttendanceStatus => {\n if (classEvent.is_present) {\n return ATTENDANCE_STATUS.ATTENDED;\n }\n\n if (classEvent.is_paused) {\n return ATTENDANCE_STATUS.PAUSED;\n }\n\n return ATTENDANCE_STATUS.MISSED;\n};\n\nexport const attendanceStatsText = (calendarData: TCalendarData) => {\n let attended = 0;\n let missed = 0;\n let paused = 0;\n\n Object.values(calendarData).forEach(dayClasses => {\n dayClasses.forEach(classEvent => {\n const status = getClassStatus(classEvent);\n\n switch (status) {\n case ATTENDANCE_STATUS.ATTENDED:\n attended++;\n break;\n case ATTENDANCE_STATUS.PAUSED:\n paused++;\n break;\n default:\n missed++;\n break;\n }\n });\n });\n\n const parts: string[] = [];\n\n if (attended > 0) parts.push(`${attended} attended`);\n\n if (missed > 0) parts.push(`${missed} missed`);\n\n if (paused > 0) parts.push(`${paused} paused`);\n\n return `${parts.join(', ')}.`;\n};\n\nexport const getDayStatusInfo = (dayClasses: IClassEvent[]) => {\n if (dayClasses.length === 0) {\n return {\n status: null,\n themeColor: null,\n statusSymbol: '',\n };\n }\n\n const attendedClass = dayClasses.every(cls => cls.is_present);\n const pausedClass = dayClasses.every(cls => cls.is_paused);\n const missedClass = dayClasses.every(cls => !cls.is_present && !cls.is_paused);\n\n if (attendedClass) {\n return {\n status: ATTENDANCE_STATUS.ATTENDED,\n themeColor: 'GREEN_1',\n statusSymbol: <Check2Icon color=\"GREEN_6\" width={14} height={14} />,\n tooltipBgColor: 'GREEN_2',\n snackbarBg: colors.GREEN_2,\n };\n }\n\n if (pausedClass) {\n return {\n status: ATTENDANCE_STATUS.PAUSED,\n themeColor: 'WHITE_4',\n statusSymbol: <PauseIcon color=\"BLACK_T_60\" width={8} height={8} />,\n tooltipBgColor: 'WHITE_5',\n snackbarBg: colors.WHITE_5,\n };\n }\n\n if (missedClass) {\n return {\n status: ATTENDANCE_STATUS.MISSED,\n themeColor: 'ORANGE_1',\n statusSymbol: <CrossIcon color=\"RED\" width={12} height={12} />,\n tooltipBgColor: 'ORANGE_2',\n snackbarBg: colors.ORANGE_2,\n };\n }\n\n return {\n status: ATTENDANCE_STATUS.PAUSED,\n themeColor: 'WHITE_4',\n statusSymbol: (\n <Styled.StatusSymbol $top=\"2px\" $right=\"2px\">\n <DotIcon color=\"GREEN_6\" width={8} height={8} />\n </Styled.StatusSymbol>\n ),\n tooltipBgColor: 'WHITE_5',\n snackbarBg: colors.WHITE_5,\n };\n};\n\nexport const generateCalendarGrid = (\n calendarData: TCalendarData,\n reportMonth: number,\n reportYear: number,\n): (ICalendarDay | null)[] => {\n const firstDay = new Date(reportYear, reportMonth - 1, 1).getDay();\n const daysInMonth = new Date(reportYear, reportMonth, 0).getDate();\n const grid: (ICalendarDay | null)[] = [];\n\n // Add empty cells for days before the first day of the month\n for (let i = 0; i < firstDay; i++) {\n grid.push(null);\n }\n\n // Add all days of the month\n for (let day = 1; day <= daysInMonth; day++) {\n const dateString = `${reportYear}-${reportMonth.toString().padStart(2, '0')}-${day\n .toString()\n .padStart(2, '0')}`;\n const dayClasses = calendarData[dateString] || [];\n const { status, themeColor, statusSymbol, tooltipBgColor, snackbarBg } =\n getDayStatusInfo(dayClasses);\n\n grid.push({\n date: day,\n status,\n hasClasses: dayClasses.length > 0,\n classes: dayClasses,\n themeColor: themeColor as TColorNames | null,\n statusSymbol: statusSymbol as JSX.Element,\n tooltipBgColor: tooltipBgColor as TColorNames | null,\n snackbarBg,\n });\n }\n\n return grid;\n};\n\nexport const getStatusText = (classEvent: IClassEvent) => {\n if (!classEvent.status) return '';\n\n const date = new Date(classEvent.time * 1000);\n const hours = date.getHours();\n const ampm = hours >= 12 ? 'PM' : 'AM';\n const displayHours = hours % 12 || 12;\n\n const timeStr = `${displayHours} ${ampm}`;\n\n return `${timeStr}: ${classEvent.status}`;\n};\n"],"names":["colors","getColors","getSnackbarMsg","classes","date","timings","cls","hours","_a","_b","getStatusText","getClassStatus","classEvent","ATTENDANCE_STATUS","attendanceStatsText","calendarData","attended","missed","paused","dayClasses","parts","getDayStatusInfo","attendedClass","pausedClass","missedClass","Check2Icon","PauseIcon","CrossIcon","jsx","Styled.StatusSymbol","DotIcon","generateCalendarGrid","reportMonth","reportYear","firstDay","daysInMonth","grid","i","day","dateString","status","themeColor","statusSymbol","tooltipBgColor","snackbarBg","ampm"],"mappings":";;;;;;;;AAaA,MAAMA,IAASC,EAAU,GAEZC,IAAiB,CAACC,GAAoCC,MAAiB;;AAC9E,MAAA,EAACD,KAAA,QAAAA,EAAS,QAAe,QAAA;AAEvB,QAAAE,IAAUF,EAAQ,IAAI,CAAOG,MAAA;AACjC,UAAMC,IAAQ,IAAI,KAAKD,EAAI,OAAO,GAAI,EAAE;AAEjC,WAAA,GAAGC,IAAQ,MAAM,EAAE,IAAIA,KAAS,KAAK,OAAO,IAAI;AAAA,EAAA,CACxD;AAMD,SAJgBJ,EAAQ;AAAA,IACtB,CAAAG,MAAO;;AAAA,aAAAA,EAAI,iBAAeE,IAAAL,KAAA,gBAAAA,EAAU,OAAV,gBAAAK,EAAc,eAAcF,EAAI,gBAAcG,IAAAN,KAAA,gBAAAA,EAAU,OAAV,gBAAAM,EAAc;AAAA;AAAA,EAAA,IAI/E,GAAGL,CAAI,MAAMC,EAAQ,KAAK,KAAK,CAAC;AAAA,IAAKG,IAAAL,KAAA,gBAAAA,EAAU,OAAV,gBAAAK,EAAc,WAAU,EAAE,KAGjE,CAACJ,GAAM,GAAGD,EAAQ,IAAIO,CAAa,CAAC,EAAE,KAAK;AAAA,CAAI;AACxD,GAEaC,IAAiB,CAACC,MACzBA,EAAW,aACNC,EAAkB,WAGvBD,EAAW,YACNC,EAAkB,SAGpBA,EAAkB,QAGdC,IAAsB,CAACC,MAAgC;AAClE,MAAIC,IAAW,GACXC,IAAS,GACTC,IAAS;AAEb,SAAO,OAAOH,CAAY,EAAE,QAAQ,CAAcI,MAAA;AAChD,IAAAA,EAAW,QAAQ,CAAcP,MAAA;A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L,IADO,IAAI,KAAKK,EAAW,OAAO,GAAI,EACzB,YACbiC,IAAOtC,KAAS,KAAK,OAAO;AAKlC,SAAO,GAFS,GAFKA,IAAQ,MAAM,EAEJ,IAAIsC,CAAI,EAEtB,KAAKjC,EAAW,MAAM;AACzC;"}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as c } from "react/jsx-runtime";
|
|
2
2
|
import { memo as p, useCallback as g } from "react";
|
|
3
|
-
import { IS_APP_RUNNING_IN_RN as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { MONTH_NAMES as
|
|
8
|
-
import { getSnackbarMsg as
|
|
9
|
-
import { TooltipWrapper as
|
|
10
|
-
function
|
|
11
|
-
const m = g(() => {
|
|
12
|
-
|
|
3
|
+
import { IS_APP_RUNNING_IN_RN as h } from "../../../../../constants/app-config.js";
|
|
4
|
+
import b from "../../../../ui/arrow-tooltip/arrow-tooltip.js";
|
|
5
|
+
import f from "../../../../ui/layout/flex-view.js";
|
|
6
|
+
import s from "../../../../ui/text/text.js";
|
|
7
|
+
import { MONTH_NAMES as u } from "./attendance-constants.js";
|
|
8
|
+
import { getSnackbarMsg as $, getStatusText as A } from "./attendance-utils.js";
|
|
9
|
+
import { TooltipWrapper as _, CalendarDay as T, StatusSymbol as I } from "./attendance.styled.js";
|
|
10
|
+
function S({ day: r, reportMonth: l, onDateClick: t }) {
|
|
11
|
+
const o = u[l - 1] || "", m = g(() => {
|
|
12
|
+
t == null || t({
|
|
13
13
|
type: "info",
|
|
14
|
-
message:
|
|
15
|
-
bgColor: (
|
|
14
|
+
message: $((r == null ? void 0 : r.classes) || [], `${o} ${(r == null ? void 0 : r.date) ?? ""}`) ?? "",
|
|
15
|
+
bgColor: (r == null ? void 0 : r.snackbarBg) || "WHITE_5"
|
|
16
16
|
});
|
|
17
|
-
}, [
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
17
|
+
}, [o, r == null ? void 0 : r.classes, r == null ? void 0 : r.date, r == null ? void 0 : r.snackbarBg, t]);
|
|
18
|
+
return /* @__PURE__ */ e(_, { onClick: m, children: /* @__PURE__ */ e(
|
|
19
|
+
b,
|
|
20
20
|
{
|
|
21
21
|
renderAs: "primary",
|
|
22
22
|
position: "top",
|
|
23
|
-
hidden:
|
|
24
|
-
backgroundColor: (
|
|
25
|
-
tooltipItem:
|
|
26
|
-
/* @__PURE__ */ s
|
|
27
|
-
|
|
23
|
+
hidden: h || !(r != null && r.hasClasses),
|
|
24
|
+
backgroundColor: (r == null ? void 0 : r.tooltipBgColor) || "WHITE_5",
|
|
25
|
+
tooltipItem: r != null && r.classes ? /* @__PURE__ */ n(f, { children: [
|
|
26
|
+
/* @__PURE__ */ n(s, { $align: "center", $renderAs: "ab3", $color: "BLACK_1", children: [
|
|
27
|
+
o,
|
|
28
28
|
" ",
|
|
29
|
-
|
|
29
|
+
r.date
|
|
30
30
|
] }),
|
|
31
|
-
|
|
31
|
+
r.classes.map((i) => /* @__PURE__ */ e(s, { $align: "center", $renderAs: "ab3", children: A(i) }, i.time))
|
|
32
32
|
] }) : "",
|
|
33
|
-
children: /* @__PURE__ */
|
|
34
|
-
|
|
33
|
+
children: /* @__PURE__ */ e(
|
|
34
|
+
T,
|
|
35
35
|
{
|
|
36
|
-
$background: (
|
|
36
|
+
$background: (r == null ? void 0 : r.themeColor) || "WHITE_1",
|
|
37
37
|
$justifyContent: "center",
|
|
38
38
|
$alignItems: "center",
|
|
39
|
-
children:
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */
|
|
39
|
+
children: r && /* @__PURE__ */ n(c, { children: [
|
|
40
|
+
/* @__PURE__ */ e(s, { $renderAs: "ab2", $color: "BLACK_T_38", children: r.date }),
|
|
41
|
+
/* @__PURE__ */ e(I, { children: !!r.statusSymbol && r.statusSymbol })
|
|
42
42
|
] })
|
|
43
43
|
}
|
|
44
44
|
)
|
|
45
45
|
}
|
|
46
46
|
) });
|
|
47
47
|
}
|
|
48
|
-
const k = p(
|
|
48
|
+
const k = p(S);
|
|
49
49
|
export {
|
|
50
50
|
k as default
|
|
51
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attendence-view.js","sources":["../../../../../../src/features/timeline/monthly-report/comps/attendance/attendence-view.tsx"],"sourcesContent":["import { memo, useCallback } from 'react';\n\nimport { IS_APP_RUNNING_IN_RN } from '../../../../../constants/app-config';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { MONTH_NAMES } from './attendance-constants';\nimport { getSnackbarMsg, getStatusText } from './attendance-utils';\nimport * as Styled from './attendance.styled';\nimport type { ICalenderViewProps } from './attendance-types';\n\nfunction AttendanceView({ day, reportMonth, onDateClick }: ICalenderViewProps) {\n const handleClick = useCallback(() => {\n onDateClick?.({\n type: 'info',\n message
|
|
1
|
+
{"version":3,"file":"attendence-view.js","sources":["../../../../../../src/features/timeline/monthly-report/comps/attendance/attendence-view.tsx"],"sourcesContent":["import { memo, useCallback } from 'react';\n\nimport { IS_APP_RUNNING_IN_RN } from '../../../../../constants/app-config';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { MONTH_NAMES } from './attendance-constants';\nimport { getSnackbarMsg, getStatusText } from './attendance-utils';\nimport * as Styled from './attendance.styled';\nimport type { ICalenderViewProps } from './attendance-types';\n\nfunction AttendanceView({ day, reportMonth, onDateClick }: ICalenderViewProps) {\n const currentMonth = MONTH_NAMES[reportMonth - 1] || '';\n\n const handleClick = useCallback(() => {\n onDateClick?.({\n type: 'info',\n message: getSnackbarMsg(day?.classes || [], `${currentMonth} ${day?.date ?? ''}`) ?? '',\n bgColor: day?.snackbarBg || 'WHITE_5',\n });\n }, [currentMonth, day?.classes, day?.date, day?.snackbarBg, onDateClick]);\n\n return (\n <Styled.TooltipWrapper onClick={handleClick}>\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"top\"\n hidden={IS_APP_RUNNING_IN_RN || !day?.hasClasses}\n backgroundColor={day?.tooltipBgColor || 'WHITE_5'}\n tooltipItem={\n day?.classes ? (\n <FlexView>\n <Text $align=\"center\" $renderAs=\"ab3\" $color=\"BLACK_1\">\n {currentMonth} {day.date}\n </Text>\n {day.classes.map(classEvent => (\n <Text $align=\"center\" $renderAs=\"ab3\" key={classEvent.time}>\n {getStatusText(classEvent)}\n </Text>\n ))}\n </FlexView>\n ) : (\n ''\n )\n }\n >\n <Styled.CalendarDay\n $background={day?.themeColor || 'WHITE_1'}\n $justifyContent=\"center\"\n $alignItems=\"center\"\n >\n {day && (\n <>\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_38\">\n {day.date}\n </Text>\n <Styled.StatusSymbol>{!!day.statusSymbol && day.statusSymbol}</Styled.StatusSymbol>\n </>\n )}\n </Styled.CalendarDay>\n </ArrowTooltip>\n </Styled.TooltipWrapper>\n );\n}\n\nexport default memo(AttendanceView);\n"],"names":["AttendanceView","day","reportMonth","onDateClick","currentMonth","MONTH_NAMES","handleClick","useCallback","getSnackbarMsg","jsx","Styled.TooltipWrapper","ArrowTooltip","IS_APP_RUNNING_IN_RN","jsxs","FlexView","Text","classEvent","getStatusText","Styled.CalendarDay","Fragment","Styled.StatusSymbol","AttendenceView","memo"],"mappings":";;;;;;;;;AAWA,SAASA,EAAe,EAAE,KAAAC,GAAK,aAAAC,GAAa,aAAAC,KAAmC;AAC7E,QAAMC,IAAeC,EAAYH,IAAc,CAAC,KAAK,IAE/CI,IAAcC,EAAY,MAAM;AACtB,IAAAJ,KAAA,QAAAA,EAAA;AAAA,MACZ,MAAM;AAAA,MACN,SAASK,GAAeP,KAAA,gBAAAA,EAAK,YAAW,CAAC,GAAG,GAAGG,CAAY,KAAIH,KAAA,gBAAAA,EAAK,S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,MAAeoB,IAAAC,EAAKtB,CAAc;"}
|
|
@@ -34,7 +34,7 @@ const S = ({
|
|
|
34
34
|
}, [n]), T ? /* @__PURE__ */ e(b, { height: "100dvh" }) : $ ? /* @__PURE__ */ e(t, { $flex: 1, $alignItems: "center", $justifyContent: "center", children: /* @__PURE__ */ e(X, { onTryAgain: n }) }) : /* @__PURE__ */ e(x, { children: (o == null ? void 0 : o.length) > 0 ? /* @__PURE__ */ e(t, { $gapX: 2, children: o.map((r, y) => {
|
|
35
35
|
const c = y === 0, u = r.month === 12, g = !c && u, f = L[r.year];
|
|
36
36
|
return /* @__PURE__ */ i(t, { $width: "100%", children: [
|
|
37
|
-
!c && !g && /* @__PURE__ */ e(m, { heightX: 2
|
|
37
|
+
!c && !g && /* @__PURE__ */ e(m, { heightX: 2 }),
|
|
38
38
|
g && f && /* @__PURE__ */ e(j, { $marginBottom: -122, children: /* @__PURE__ */ e(p, { src: f, alt: r.year.toString(), height: "248px" }) }),
|
|
39
39
|
/* @__PURE__ */ i(t, { $gutterX: 1, children: [
|
|
40
40
|
/* @__PURE__ */ e(F, { $renderAs: "ac4", $color: "BLACK_T_60", children: R[r.month - 1] }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monthly-timeline.js","sources":["../../../../src/features/timeline/monthly-timeline/monthly-timeline.tsx"],"sourcesContent":["import { type FC, memo, useCallback, useEffect } from 'react';\n\nimport { type IMonthlyTimelineProps } from './monthly-timeline-types';\nimport { useMonthlyTimelineGet } from './api/use-monthly-timeline-get';\nimport MonthlyTimelineView from './monthly-timeline-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport Image from '../../ui/image/image';\nimport Separator from '../../ui/separator/separator';\nimport { monthNames, yearImages } from './constants';\nimport Error from '../../ui/error/error';\nimport * as Styled from './monthly-timeline-styled';\nimport { getTimezone } from '../../../helpers/date-time';\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\n\nconst MonthlyTimeline: FC<IMonthlyTimelineProps> = ({\n userType,\n studentId,\n courseStreams,\n onReportClick,\n}) => {\n const {\n get: getTimeline,\n data: timelineData = [],\n isProcessing,\n isProcessingFailed,\n } = useMonthlyTimelineGet();\n\n const fetchData = useCallback(() => {\n getTimeline(studentId, {\n course_streams: userType === 'TEACHER' ? courseStreams : [],\n timezone: getTimezone(),\n });\n }, [courseStreams, getTimeline, studentId, userType]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n if (isProcessing) {\n return <AppLoader height=\"100dvh\" />;\n }\n\n if (isProcessingFailed) {\n return (\n <FlexView $flex={1} $alignItems=\"center\" $justifyContent=\"center\">\n <Error onTryAgain={fetchData} />\n </FlexView>\n );\n }\n\n return (\n <>\n {timelineData?.length > 0 ? (\n <FlexView $gapX={2}>\n {timelineData.map((item, index) => {\n const isFirstItem = index === 0;\n const isDecember = item.month === 12;\n const showYearImage = !isFirstItem && isDecember;\n const yearImage = yearImages[item.year];\n\n return (\n <FlexView key={`${item.month}-${item.year}`} $width=\"100%\">\n {!isFirstItem && !showYearImage && <Separator heightX={2
|
|
1
|
+
{"version":3,"file":"monthly-timeline.js","sources":["../../../../src/features/timeline/monthly-timeline/monthly-timeline.tsx"],"sourcesContent":["import { type FC, memo, useCallback, useEffect } from 'react';\n\nimport { type IMonthlyTimelineProps } from './monthly-timeline-types';\nimport { useMonthlyTimelineGet } from './api/use-monthly-timeline-get';\nimport MonthlyTimelineView from './monthly-timeline-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport Image from '../../ui/image/image';\nimport Separator from '../../ui/separator/separator';\nimport { monthNames, yearImages } from './constants';\nimport Error from '../../ui/error/error';\nimport * as Styled from './monthly-timeline-styled';\nimport { getTimezone } from '../../../helpers/date-time';\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\n\nconst MonthlyTimeline: FC<IMonthlyTimelineProps> = ({\n userType,\n studentId,\n courseStreams,\n onReportClick,\n}) => {\n const {\n get: getTimeline,\n data: timelineData = [],\n isProcessing,\n isProcessingFailed,\n } = useMonthlyTimelineGet();\n\n const fetchData = useCallback(() => {\n getTimeline(studentId, {\n course_streams: userType === 'TEACHER' ? courseStreams : [],\n timezone: getTimezone(),\n });\n }, [courseStreams, getTimeline, studentId, userType]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n if (isProcessing) {\n return <AppLoader height=\"100dvh\" />;\n }\n\n if (isProcessingFailed) {\n return (\n <FlexView $flex={1} $alignItems=\"center\" $justifyContent=\"center\">\n <Error onTryAgain={fetchData} />\n </FlexView>\n );\n }\n\n return (\n <>\n {timelineData?.length > 0 ? (\n <FlexView $gapX={2}>\n {timelineData.map((item, index) => {\n const isFirstItem = index === 0;\n const isDecember = item.month === 12;\n const showYearImage = !isFirstItem && isDecember;\n const yearImage = yearImages[item.year];\n\n return (\n <FlexView key={`${item.month}-${item.year}`} $width=\"100%\">\n {!isFirstItem && !showYearImage && <Separator heightX={2} />}\n {showYearImage && yearImage && (\n <Styled.ImageContainer $marginBottom={-122}>\n <Image src={yearImage} alt={item.year.toString()} height=\"248px\" />\n </Styled.ImageContainer>\n )}\n <FlexView $gutterX={1}>\n <Styled.DateText $renderAs=\"ac4\" $color=\"BLACK_T_60\">\n {monthNames[item.month - 1]}\n </Styled.DateText>\n <Separator heightX={1} />\n <MonthlyTimelineView\n reports={item.reports}\n month={item.month}\n year={item.year}\n onReportClick={onReportClick}\n />\n </FlexView>\n </FlexView>\n );\n })}\n </FlexView>\n ) : (\n <FlexView $justifyContent=\"center\" $alignItems=\"center\" $height=\"100%\">\n <Image src={ILLUSTRATIONS.EMPTY_REPORTS} />\n <Separator heightX={1.5} />\n <Text $renderAs=\"ab2\" color=\"BLACK_T_60\">\n Report will be available next month.\n </Text>\n </FlexView>\n )}\n </>\n );\n};\n\nexport default memo(MonthlyTimeline);\n"],"names":["MonthlyTimeline","userType","studentId","courseStreams","onReportClick","getTimeline","timelineData","isProcessing","isProcessingFailed","useMonthlyTimelineGet","fetchData","useCallback","getTimezone","useEffect","jsx","AppLoader","FlexView","Error","Fragment","item","index","isFirstItem","isDecember","showYearImage","yearImage","yearImages","jsxs","Separator","Styled.ImageContainer","Image","Styled.DateText","monthNames","MonthlyTimelineView","ILLUSTRATIONS","Text","monthlyTimeline","memo"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAMA,IAA6C,CAAC;AAAA,EAClD,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AACF,MAAM;AACE,QAAA;AAAA,IACJ,KAAKC;AAAA,IACL,MAAMC,IAAe,CAAC;AAAA,IACtB,cAAAC;AAAA,IACA,oBAAAC;AAAA,MACEC,EAAsB,GAEpBC,IAAYC,EAAY,MAAM;AAClC,IAAAN,EAAYH,GAAW;AAAA,MACrB,gBAAgBD,MAAa,YAAYE,IAAgB,CAAC;AAAA,MAC1D,UAAUS,EAAY;AAAA,IAAA,CACvB;AAAA,KACA,CAACT,GAAeE,GAAaH,GAAWD,CAAQ,CAAC;AAMpD,SAJAY,EAAU,MAAM;AACJ,IAAAH;EAAA,GACT,CAACA,CAAS,CAAC,GAEVH,IACK,gBAAAO,EAACC,GAAU,EAAA,QAAO,SAAS,CAAA,IAGhCP,IAEC,gBAAAM,EAAAE,GAAA,EAAS,OAAO,GAAG,aAAY,UAAS,iBAAgB,UACvD,UAAC,gBAAAF,EAAAG,GAAA,EAAM,YAAYP,EAAA,CAAW,EAChC,CAAA,IAMC,gBAAAI,EAAAI,GAAA,EAAA,WAAAZ,KAAA,gBAAAA,EAAc,UAAS,IACrB,gBAAAQ,EAAAE,GAAA,EAAS,OAAO,GACd,UAAaV,EAAA,IAAI,CAACa,GAAMC,MAAU;AACjC,UAAMC,IAAcD,MAAU,GACxBE,IAAaH,EAAK,UAAU,IAC5BI,IAAgB,CAACF,KAAeC,GAChCE,IAA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