@codezee/sixtify-brahma 0.2.79 → 0.2.80
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/package.json
CHANGED
|
@@ -46,13 +46,13 @@ const Timeline = ({ totalDots, highlightedIntervals, shiftStartTime, shiftEndTim
|
|
|
46
46
|
position: "absolute",
|
|
47
47
|
top: "12px",
|
|
48
48
|
zIndex: 2,
|
|
49
|
-
left: `${(((getArrowPosition(shiftStartTime, shiftEndTime, "START") - slotStartTime) % totalDots) /
|
|
49
|
+
left: `${(((getArrowPosition(shiftStartTime, shiftEndTime, "START") - slotStartTime) % totalDots) / totalDots) * 100}%`,
|
|
50
50
|
}, children: (0, jsx_runtime_1.jsx)(ArrowUp_1.ArrowUp, {}) }) }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: `Shift End: ${(0, date_1.getTimeInHHmm)(shiftEndTime)}`, arrow: true, placement: "top", children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
51
51
|
cursor: "pointer",
|
|
52
52
|
position: "absolute",
|
|
53
53
|
top: "12px",
|
|
54
54
|
zIndex: 2,
|
|
55
|
-
left: `${(((getArrowPosition(shiftStartTime, shiftEndTime, "END") - slotStartTime) % totalDots) / (totalDots - 0.
|
|
55
|
+
left: `${(((getArrowPosition(shiftStartTime, shiftEndTime, "END") - slotStartTime) % totalDots) / (totalDots - 0.6)) * 100}%`,
|
|
56
56
|
}, children: (0, jsx_runtime_1.jsx)(ArrowUp_1.ArrowUp, {}) }) }), (0, jsx_runtime_1.jsx)(material_1.Slider, { disabled: true, valueLabelDisplay: "off", marks: marks, max: totalDots - 1, step: 1, value: [], sx: {
|
|
57
57
|
zIndex: 1,
|
|
58
58
|
"& .MuiSlider-track": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimelineTrackSegments.d.ts","sourceRoot":"","sources":["../../src/Timeline/TimelineTrackSegments.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TimelineTrackSegments.d.ts","sourceRoot":"","sources":["../../src/Timeline/TimelineTrackSegments.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAErE,KAAK,0BAA0B,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,0CAInC,0BAA0B,4CAwI5B,CAAC"}
|
|
@@ -4,24 +4,32 @@ exports.TimelineTrackSegments = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const luxon_1 = require("luxon");
|
|
7
|
-
const
|
|
8
|
-
const date_1 = require("../utils/date");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
9
8
|
const Timeline_1 = require("./Timeline");
|
|
10
9
|
const TimelineTrackSegments = ({ totalDots, intervals, startTimeline, }) => {
|
|
11
10
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { position: "relative", width: "100%", height: 4 }, children: intervals?.map((interval, index) => {
|
|
12
|
-
const inTime = (0,
|
|
13
|
-
const outTime = (0,
|
|
11
|
+
const inTime = (0, utils_1.getTimeInHHmm)(interval.in_time);
|
|
12
|
+
const outTime = (0, utils_1.getTimeInHHmm)(interval.out_time);
|
|
14
13
|
const intervalInTime = luxon_1.DateTime.fromISO(interval.in_time);
|
|
15
14
|
const intervalOutTime = luxon_1.DateTime.fromISO(interval.out_time);
|
|
16
15
|
const shiftHours = intervalOutTime
|
|
17
16
|
.diff(intervalInTime, ["hours", "minutes"])
|
|
18
17
|
.toFormat("hh:mm");
|
|
19
18
|
let in_time = (0, Timeline_1.getArrowValue)(inTime);
|
|
20
|
-
in_time = in_time < startTimeline ? in_time + totalDots : in_time;
|
|
21
19
|
let out_time = (0, Timeline_1.getArrowValue)(outTime);
|
|
22
|
-
out_time = out_time < in_time ? out_time + totalDots : out_time;
|
|
23
20
|
const isValidInTime = !isNaN(in_time);
|
|
24
21
|
const isValidOutTime = !isNaN(out_time);
|
|
22
|
+
if (isValidInTime && in_time < startTimeline) {
|
|
23
|
+
in_time += totalDots;
|
|
24
|
+
}
|
|
25
|
+
if (isValidOutTime) {
|
|
26
|
+
if (out_time < startTimeline) {
|
|
27
|
+
out_time += totalDots;
|
|
28
|
+
}
|
|
29
|
+
if (isValidInTime && out_time < in_time) {
|
|
30
|
+
out_time += totalDots;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
25
33
|
let inTimeLabel = "";
|
|
26
34
|
let outTimeLabel = "";
|
|
27
35
|
if (isValidInTime) {
|
|
@@ -30,18 +38,23 @@ const TimelineTrackSegments = ({ totalDots, intervals, startTimeline, }) => {
|
|
|
30
38
|
if (isValidOutTime) {
|
|
31
39
|
outTimeLabel = `Out time : ${outTime} ${!isValidInTime ? "/ Missing punch" : ""}`;
|
|
32
40
|
}
|
|
33
|
-
const startPercent = (((in_time - startTimeline) % totalDots) / (totalDots - 1)) * 100;
|
|
34
|
-
const endPercent = (((out_time - startTimeline) % totalDots) / (totalDots - 1)) * 100;
|
|
35
41
|
const labelText = interval?.name ??
|
|
36
|
-
`In/Out: ${(0,
|
|
37
|
-
const color = interval?.color ?? (0,
|
|
42
|
+
`In/Out: ${(0, utils_1.getTimeInHHmm)(interval.in_time)} - ${(0, utils_1.getTimeInHHmm)(interval.out_time)} (${shiftHours})`;
|
|
43
|
+
const color = interval?.color ?? (0, utils_1.getColorByVariant)(interval.status_type);
|
|
44
|
+
const startDot = isValidInTime
|
|
45
|
+
? ((in_time - startTimeline) / totalDots) * 100
|
|
46
|
+
: 0;
|
|
47
|
+
const endDot = isValidOutTime
|
|
48
|
+
? ((out_time - startTimeline) / totalDots) * 100
|
|
49
|
+
: 0;
|
|
50
|
+
const widthDot = isValidInTime && isValidOutTime ? Math.max(endDot - startDot, 0) : 0;
|
|
38
51
|
return (
|
|
39
52
|
// eslint-disable-next-line sonarjs/no-array-index-key
|
|
40
53
|
(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", children: [isValidInTime && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { arrow: true, title: inTimeLabel, placement: "top", children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
41
54
|
height: 8,
|
|
42
55
|
width: 8,
|
|
43
56
|
position: "absolute",
|
|
44
|
-
left: `${
|
|
57
|
+
left: `${startDot}%`,
|
|
45
58
|
boxShadow: "none",
|
|
46
59
|
backgroundColor: color,
|
|
47
60
|
borderRadius: "50%",
|
|
@@ -50,19 +63,19 @@ const TimelineTrackSegments = ({ totalDots, intervals, startTimeline, }) => {
|
|
|
50
63
|
"&:focus, &:hover, &:active": {
|
|
51
64
|
boxShadow: "none",
|
|
52
65
|
},
|
|
53
|
-
} }) })), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { arrow: true, title: labelText, placement: "top", children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
66
|
+
} }) })), isValidInTime && isValidOutTime && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { arrow: true, title: labelText, placement: "top", children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
54
67
|
position: "absolute",
|
|
55
|
-
left: `${
|
|
56
|
-
width: `${
|
|
68
|
+
left: `${startDot}%`,
|
|
69
|
+
width: `${widthDot}%`,
|
|
57
70
|
height: 3.5,
|
|
58
71
|
top: "17.5px",
|
|
59
72
|
backgroundColor: color,
|
|
60
73
|
zIndex: 2,
|
|
61
|
-
} }) }), isValidOutTime && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { arrow: true, title: outTimeLabel, placement: "top", children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
74
|
+
} }) })), isValidOutTime && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { arrow: true, title: outTimeLabel, placement: "top", children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
62
75
|
height: 8,
|
|
63
76
|
width: 8,
|
|
64
77
|
position: "absolute",
|
|
65
|
-
|
|
78
|
+
left: `${endDot}%`,
|
|
66
79
|
boxShadow: "none",
|
|
67
80
|
backgroundColor: color,
|
|
68
81
|
borderRadius: "50%",
|