@cuemath/leap 3.0.21 → 3.0.22-aa0
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/assets/line-icons/icons/check.js +3 -3
- package/dist/assets/line-icons/icons/check.js.map +1 -1
- package/dist/assets/line-icons/icons/hw.js +32 -0
- package/dist/assets/line-icons/icons/hw.js.map +1 -0
- package/dist/assets/line-icons/icons/puzzle-icon.js +51 -0
- package/dist/assets/line-icons/icons/puzzle-icon.js.map +1 -0
- package/dist/assets/line-icons/icons/share.js +48 -0
- package/dist/assets/line-icons/icons/share.js.map +1 -0
- package/dist/assets/line-icons/icons/tile.js +54 -0
- package/dist/assets/line-icons/icons/tile.js.map +1 -0
- package/dist/features/communication/pub-sub/constants.js +1 -0
- package/dist/features/communication/pub-sub/constants.js.map +1 -1
- package/dist/features/cue-canvas/bottombar/homework-controls.js +73 -0
- package/dist/features/cue-canvas/bottombar/homework-controls.js.map +1 -0
- package/dist/features/cue-canvas/cue-canvas-context.js +8 -5
- package/dist/features/cue-canvas/cue-canvas-context.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-core.js +51 -47
- package/dist/features/cue-canvas/cue-canvas-core.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-helpers.js +31 -25
- package/dist/features/cue-canvas/cue-canvas-helpers.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-provider.js +14 -12
- package/dist/features/cue-canvas/cue-canvas-provider.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas.js +61 -59
- package/dist/features/cue-canvas/cue-canvas.js.map +1 -1
- package/dist/features/cue-canvas/cue-cavas-styled.js +29 -29
- package/dist/features/cue-canvas/hooks/use-canvas-sync-broker.js +50 -46
- package/dist/features/cue-canvas/hooks/use-canvas-sync-broker.js.map +1 -1
- package/dist/features/cue-canvas/hooks/use-cue-canvas-actions.js +18 -14
- package/dist/features/cue-canvas/hooks/use-cue-canvas-actions.js.map +1 -1
- package/dist/features/cue-canvas/hooks/use-upload-helper.js +23 -0
- package/dist/features/cue-canvas/hooks/use-upload-helper.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/homework/helper.js +20 -0
- package/dist/features/cue-canvas/sidebar/homework/helper.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-menu.js +33 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-menu.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-request.js +61 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-request.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-styled.js +25 -0
- package/dist/features/cue-canvas/sidebar/homework/homework-styled.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/homework/homework.js +32 -0
- package/dist/features/cue-canvas/sidebar/homework/homework.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/api/get-puzzles.js +13 -0
- package/dist/features/cue-canvas/sidebar/puzzles/api/get-puzzles.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filter-selection-menu.js +60 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filter-selection-menu.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filters-section.js +44 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filters-section.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filters.js +107 -0
- package/dist/features/cue-canvas/sidebar/puzzles/filters.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/hooks/use-fetch-cue-canvas-activity.js +42 -0
- package/dist/features/cue-canvas/sidebar/puzzles/hooks/use-fetch-cue-canvas-activity.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/launch-puzzle.js +84 -0
- package/dist/features/cue-canvas/sidebar/puzzles/launch-puzzle.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu-header.js +36 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu-header.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu.js +133 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles-styled.js +96 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles-styled.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles.js +29 -0
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/puzzles/utils.js +120 -0
- package/dist/features/cue-canvas/sidebar/puzzles/utils.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/sidebar-styled.js +32 -0
- package/dist/features/cue-canvas/sidebar/sidebar-styled.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/sidebar.js +29 -0
- package/dist/features/cue-canvas/sidebar/sidebar.js.map +1 -0
- package/dist/features/cue-canvas/sidebar/tiles/tile.js +16 -0
- package/dist/features/cue-canvas/sidebar/tiles/tile.js.map +1 -0
- package/dist/features/hooks/use-debounce.js +16 -0
- package/dist/features/hooks/use-debounce.js.map +1 -0
- package/dist/features/ui/stepper/stepper.js +7 -7
- package/dist/features/worksheet/worksheet/hooks/use-s3-helper.js +22 -19
- package/dist/features/worksheet/worksheet/hooks/use-s3-helper.js.map +1 -1
- package/dist/index.d.ts +46 -6
- package/dist/index.js +487 -481
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import i, { css as l } from "styled-components";
|
2
2
|
import a from "../../assets/line-icons/icons/check.js";
|
3
3
|
import d from "../../assets/line-icons/icons/down.js";
|
4
4
|
import h from "../../assets/line-icons/icons/highlighter.js";
|
@@ -10,45 +10,45 @@ import $ from "../../assets/line-icons/icons/undo.js";
|
|
10
10
|
import m from "../../assets/line-icons/icons/unlock.js";
|
11
11
|
import p from "../ui/layout/flex-view.js";
|
12
12
|
import { CANVAS_COLORS as c } from "./constants/constants.js";
|
13
|
-
const S =
|
13
|
+
const S = i(u)(({
|
14
14
|
theme: r,
|
15
15
|
$active: o,
|
16
16
|
$activeColor: t,
|
17
17
|
$shouldAnimate: s
|
18
18
|
}) => {
|
19
|
-
const { colors:
|
19
|
+
const { colors: e } = r, n = o ? c[t] : e.REAL_BLACK_50;
|
20
20
|
return l`
|
21
21
|
position: relative;
|
22
22
|
transition: top 0.3s ease-in-out;
|
23
23
|
top: ${o && s ? "0px" : "8px"};
|
24
24
|
cursor: ${o ? "auto" : "pointer"};
|
25
25
|
.pencil-dark-shade {
|
26
|
-
fill: ${o ? n :
|
26
|
+
fill: ${o ? n : e.GREY_3};
|
27
27
|
}
|
28
28
|
|
29
29
|
.pencil-light-shade {
|
30
|
-
fill: ${o ? n :
|
30
|
+
fill: ${o ? n : e.GREY_2};
|
31
31
|
opacity: ${o ? 0.3 : 1};
|
32
32
|
}
|
33
33
|
|
34
34
|
${!o && l`
|
35
35
|
&:hover {
|
36
36
|
.pencil-dark-shade {
|
37
|
-
fill: ${
|
37
|
+
fill: ${e.GREY_4};
|
38
38
|
}
|
39
39
|
.pencil-light-shade {
|
40
|
-
fill: ${
|
40
|
+
fill: ${e.GREY_2};
|
41
41
|
}
|
42
42
|
}
|
43
43
|
`}
|
44
44
|
`;
|
45
|
-
}), G =
|
45
|
+
}), G = i(g)(({
|
46
46
|
theme: r,
|
47
47
|
$active: o,
|
48
48
|
$activeColor: t,
|
49
49
|
$shouldAnimate: s
|
50
50
|
}) => {
|
51
|
-
const { colors:
|
51
|
+
const { colors: e } = r, n = o ? c[t] : e.REAL_BLACK_50;
|
52
52
|
return l`
|
53
53
|
cursor: ${o ? "auto" : "pointer"};
|
54
54
|
position: relative;
|
@@ -56,36 +56,36 @@ const S = e(u)(({
|
|
56
56
|
top: ${o && s ? "0px" : "8px"};
|
57
57
|
|
58
58
|
.ruler-rect-color {
|
59
|
-
fill: ${o ? n :
|
59
|
+
fill: ${o ? n : e.GREY_3};
|
60
60
|
}
|
61
61
|
|
62
62
|
.ruler-stripe-base {
|
63
|
-
fill: ${o ? n :
|
63
|
+
fill: ${o ? n : e.GREY_2};
|
64
64
|
opacity: ${o ? 0.2 : 1};
|
65
65
|
}
|
66
66
|
|
67
67
|
.ruler-small-stripe {
|
68
|
-
fill: ${
|
68
|
+
fill: ${e.REAL_BLACK};
|
69
69
|
}
|
70
70
|
|
71
71
|
${!o && l`
|
72
72
|
&:hover {
|
73
73
|
.ruler-rect-color {
|
74
|
-
fill: ${
|
74
|
+
fill: ${e.GREY_4};
|
75
75
|
}
|
76
76
|
.ruler-stripe-base {
|
77
|
-
fill: ${
|
77
|
+
fill: ${e.GREY_3};
|
78
78
|
}
|
79
79
|
}
|
80
80
|
`}
|
81
81
|
`;
|
82
|
-
}), W =
|
82
|
+
}), W = i(h)(({
|
83
83
|
$active: r,
|
84
84
|
theme: o,
|
85
85
|
$activeColor: t,
|
86
86
|
$shouldAnimate: s
|
87
87
|
}) => {
|
88
|
-
const { colors:
|
88
|
+
const { colors: e } = o, n = r ? c[t] : e.REAL_BLACK_50;
|
89
89
|
return l`
|
90
90
|
cursor: ${r ? "auto" : "pointer"};
|
91
91
|
position: relative;
|
@@ -123,13 +123,13 @@ const S = e(u)(({
|
|
123
123
|
}
|
124
124
|
`}
|
125
125
|
`;
|
126
|
-
}), Y =
|
126
|
+
}), Y = i(x)(({
|
127
127
|
$active: r,
|
128
128
|
theme: o,
|
129
129
|
$activeColor: t,
|
130
130
|
$shouldAnimate: s
|
131
131
|
}) => {
|
132
|
-
const { colors:
|
132
|
+
const { colors: e } = o, n = r ? c[t] : e.REAL_BLACK_50;
|
133
133
|
return l`
|
134
134
|
cursor: ${r ? "auto" : "pointer"};
|
135
135
|
position: relative;
|
@@ -169,13 +169,13 @@ const S = e(u)(({
|
|
169
169
|
}
|
170
170
|
`}
|
171
171
|
`;
|
172
|
-
}), w =
|
172
|
+
}), w = i(f)`
|
173
173
|
width: 20px;
|
174
174
|
height: 20px;
|
175
|
-
`, H =
|
175
|
+
`, H = i(m)`
|
176
176
|
width: 20px;
|
177
177
|
height: 20px;
|
178
|
-
`, P =
|
178
|
+
`, P = i(p)(
|
179
179
|
({ theme: r, $active: o }) => {
|
180
180
|
const { colors: t } = r;
|
181
181
|
return l`
|
@@ -215,13 +215,13 @@ const S = e(u)(({
|
|
215
215
|
`}
|
216
216
|
`;
|
217
217
|
}
|
218
|
-
), T =
|
218
|
+
), T = i(a)`
|
219
219
|
path {
|
220
220
|
stroke: ${"white"};
|
221
221
|
}
|
222
|
-
`, U =
|
222
|
+
`, U = i($)`
|
223
223
|
transform: scaleX(-1);
|
224
|
-
`, j =
|
224
|
+
`, j = i(p)`
|
225
225
|
position: absolute;
|
226
226
|
display: flex;
|
227
227
|
justify-content: center;
|
@@ -229,7 +229,7 @@ const S = e(u)(({
|
|
229
229
|
transition:
|
230
230
|
opacity 0.5s ease,
|
231
231
|
transform 0.5s ease;
|
232
|
-
`, D =
|
232
|
+
`, D = i(p)(
|
233
233
|
({ $canScribble: r, $canRender: o, $renderAs: t }) => `
|
234
234
|
display: ${o ? "block" : "none"};
|
235
235
|
opacity: ${r ? 1 : 0.5};
|
@@ -242,18 +242,18 @@ const S = e(u)(({
|
|
242
242
|
`}
|
243
243
|
|
244
244
|
`
|
245
|
-
), O =
|
245
|
+
), O = i(p)(
|
246
246
|
({ $color: r }) => `
|
247
247
|
background: ${c[r]};
|
248
248
|
`
|
249
|
-
), V =
|
249
|
+
), V = i(d)`
|
250
250
|
pointer-events: none;
|
251
251
|
transition: transform 0.5s ease;
|
252
252
|
transform: ${({ $isAnimating: r }) => r ? "rotate(180deg)" : "rotate(0deg)"};
|
253
|
-
`, z =
|
253
|
+
`, z = i(p)`
|
254
254
|
overflow: hidden;
|
255
255
|
border-right: 1px solid ${({ theme: r }) => r.colors.GREY_1};
|
256
|
-
`, F =
|
256
|
+
`, F = i(p)`
|
257
257
|
position: absolute;
|
258
258
|
padding: 8px 8px 0 8px;
|
259
259
|
overflow: hidden;
|
@@ -1,71 +1,75 @@
|
|
1
1
|
import { useMessageBrokerChannel as q } from "@cuemath/cue-message-broker";
|
2
2
|
import { useState as x, useRef as w, useMemo as E, useCallback as h } from "react";
|
3
|
-
const
|
4
|
-
userId:
|
5
|
-
data:
|
6
|
-
height:
|
7
|
-
responseId:
|
8
|
-
|
9
|
-
|
3
|
+
const p = (r) => ({
|
4
|
+
userId: r.userId,
|
5
|
+
data: r.data,
|
6
|
+
height: r.height,
|
7
|
+
responseId: r.responseId,
|
8
|
+
gridName: r.gridName,
|
9
|
+
dimension: r.dimension
|
10
|
+
}), F = (r, g, f, m = "canvas") => {
|
11
|
+
const [b, l] = x(
|
10
12
|
() => {
|
11
|
-
var o,
|
12
|
-
const
|
13
|
-
if (!
|
14
|
-
for (const { message:
|
15
|
-
const e = (o =
|
13
|
+
var o, n;
|
14
|
+
const c = {};
|
15
|
+
if (!f) return c;
|
16
|
+
for (const { message: i } of f) {
|
17
|
+
const e = (o = i.payload) == null ? void 0 : o.eventPayload, s = e == null ? void 0 : e.responseId;
|
16
18
|
if (!(e != null && e.responseId)) continue;
|
17
|
-
const t =
|
18
|
-
s &&
|
19
|
+
const t = p(e);
|
20
|
+
s && c[s] ? (n = c[s]) == null || n.push(t) : c[s] = [t];
|
19
21
|
}
|
20
|
-
return
|
22
|
+
return c;
|
21
23
|
}
|
22
|
-
), u = w({}),
|
24
|
+
), u = w({}), S = E(
|
23
25
|
() => ({
|
24
|
-
channelId:
|
25
|
-
ttl: 0,
|
26
|
-
logger:
|
26
|
+
channelId: r,
|
27
|
+
ttl: m === "canvas" ? 0 : 24,
|
28
|
+
logger: g
|
27
29
|
}),
|
28
|
-
[
|
29
|
-
),
|
30
|
-
u.current = { ...u.current, [
|
31
|
-
}, []),
|
32
|
-
(
|
33
|
-
const
|
34
|
-
|
35
|
-
var
|
36
|
-
const { payload: e } =
|
37
|
-
if (!o &&
|
38
|
-
|
30
|
+
[r, g, m]
|
31
|
+
), C = h((c, o) => {
|
32
|
+
u.current = { ...u.current, [c]: o };
|
33
|
+
}, []), D = h(
|
34
|
+
(c, o) => {
|
35
|
+
const n = {};
|
36
|
+
c.forEach((i) => {
|
37
|
+
var I;
|
38
|
+
const { payload: e } = i.message, { eventPayload: s } = e, t = s == null ? void 0 : s.responseId, R = s == null ? void 0 : s.data, B = s == null ? void 0 : s.userId, j = s == null ? void 0 : s.height, k = u.current[t];
|
39
|
+
if (!o && k)
|
40
|
+
k({
|
39
41
|
data: R,
|
40
42
|
height: j,
|
41
43
|
userId: B,
|
42
|
-
responseId: t
|
44
|
+
responseId: t,
|
45
|
+
gridName: s == null ? void 0 : s.gridName,
|
46
|
+
dimension: s == null ? void 0 : s.dimension
|
43
47
|
});
|
44
48
|
else {
|
45
|
-
const
|
46
|
-
t &&
|
49
|
+
const d = p(s);
|
50
|
+
t && n[t] ? (I = n[t]) == null || I.push(d) : n[t] = [d];
|
47
51
|
}
|
48
|
-
}), Object.keys(
|
49
|
-
const e = { ...
|
50
|
-
return Object.keys(
|
52
|
+
}), Object.keys(n).length > 0 && l((i) => {
|
53
|
+
const e = { ...i };
|
54
|
+
return Object.keys(n).forEach((s) => {
|
51
55
|
var t;
|
52
|
-
s && e[s] ? (t = e[s]) == null || t.push(...
|
56
|
+
s && e[s] ? (t = e[s]) == null || t.push(...n[s] ?? []) : e[s] = n[s] ?? [];
|
53
57
|
}), e;
|
54
58
|
});
|
55
59
|
},
|
56
60
|
[]
|
57
|
-
), { publish:
|
58
|
-
channelOptions:
|
59
|
-
consumerFn:
|
61
|
+
), { publish: M, channelStatus: N, channel: a } = q({
|
62
|
+
channelOptions: S,
|
63
|
+
consumerFn: D
|
60
64
|
}), O = h(() => {
|
61
|
-
|
62
|
-
}, [
|
65
|
+
a && a.destroyChannel();
|
66
|
+
}, [a]);
|
63
67
|
return {
|
64
|
-
publishStrokes:
|
65
|
-
channelStatus:
|
68
|
+
publishStrokes: M,
|
69
|
+
channelStatus: N,
|
66
70
|
closeChannel: O,
|
67
|
-
initialStrokesData:
|
68
|
-
registerCallback:
|
71
|
+
initialStrokesData: b,
|
72
|
+
registerCallback: C
|
69
73
|
};
|
70
74
|
}, $ = F;
|
71
75
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-canvas-sync-broker.js","sources":["../../../../src/features/cue-canvas/hooks/use-canvas-sync-broker.ts"],"sourcesContent":["import type {
|
1
|
+
{"version":3,"file":"use-canvas-sync-broker.js","sources":["../../../../src/features/cue-canvas/hooks/use-canvas-sync-broker.ts"],"sourcesContent":["import type {\n IActionData,\n IViewport,\n TCueCanvasChangeDataObject,\n TCueCanvasGridName,\n TRenderAs,\n} from '../types/cue-canvas';\n\nimport { useMessageBrokerChannel, type IChannelMessage } from '@cuemath/cue-message-broker';\nimport { useMemo, useCallback, useState, useRef } from 'react';\n\ninterface IMessage {\n eventName: string;\n eventPayload: {\n responseId: string;\n data: TCueCanvasChangeDataObject;\n userId: string;\n height: number;\n gridName?: TCueCanvasGridName;\n dimension?: IViewport;\n };\n}\n\nconst extractStrokeData = (payload: IMessage['eventPayload']): IActionData => ({\n userId: payload.userId,\n data: payload.data,\n height: payload.height,\n responseId: payload.responseId,\n gridName: payload.gridName,\n dimension: payload.dimension,\n});\n\nconst useCanvasSyncBroker = (\n channelId: string,\n logEvent: (type: string, payload?: Record<string, unknown>) => void,\n initialCanvasData?: Array<IChannelMessage>,\n type: TRenderAs = 'canvas',\n) => {\n const [initialStrokesData, setInitialStrokesData] = useState<Record<string, IActionData[]>>(\n () => {\n const map: Record<string, IActionData[]> = {};\n\n if (!initialCanvasData) return map;\n\n for (const { message } of initialCanvasData) {\n const payload = (message.payload as IMessage)?.eventPayload;\n const qrId = payload?.responseId;\n\n if (!payload?.responseId) continue;\n\n const strokeData = extractStrokeData(payload);\n\n if (qrId && map[qrId]) {\n map[qrId]?.push(strokeData);\n } else {\n map[qrId] = [strokeData];\n }\n }\n\n return map;\n },\n );\n const callbacksMapRef = useRef<Record<string, (data: IActionData) => void>>({});\n\n const channelOptions = useMemo(\n () => ({\n channelId,\n ttl: type === 'canvas' ? 0 : 24,\n logger: logEvent,\n }),\n [channelId, logEvent, type],\n );\n\n const registerCallback = useCallback((qrId: string, cb: (data: IActionData) => void) => {\n callbacksMapRef.current = { ...callbacksMapRef.current, [qrId]: cb };\n }, []);\n\n const onMessageReceive = useCallback(\n (messages: Array<IChannelMessage>, initialData?: boolean) => {\n const strokesPerWidgetMap: Record<string, Array<IActionData>> = {};\n\n messages.forEach(message => {\n const { payload } = message.message;\n const { eventPayload } = payload as IMessage;\n const qrId = eventPayload?.responseId as string;\n const strokes = eventPayload?.data;\n const userId = eventPayload?.userId;\n const canvasHeight = eventPayload?.height;\n const widgetOnReceiveCallback = callbacksMapRef.current[qrId];\n\n if (!initialData && widgetOnReceiveCallback) {\n widgetOnReceiveCallback({\n data: strokes,\n height: canvasHeight,\n userId,\n responseId: qrId,\n gridName: eventPayload?.gridName,\n dimension: eventPayload?.dimension,\n });\n } else {\n const strokeData = extractStrokeData(eventPayload);\n\n if (qrId && strokesPerWidgetMap[qrId]) {\n strokesPerWidgetMap[qrId]?.push(strokeData);\n } else {\n strokesPerWidgetMap[qrId] = [strokeData];\n }\n }\n });\n\n if (Object.keys(strokesPerWidgetMap).length > 0) {\n setInitialStrokesData(prevData => {\n const currentData = { ...prevData };\n\n Object.keys(strokesPerWidgetMap).forEach(key => {\n if (key && currentData[key]) {\n currentData[key]?.push(...(strokesPerWidgetMap[key] ?? []));\n } else {\n currentData[key] = strokesPerWidgetMap[key] ?? [];\n }\n });\n\n return currentData;\n });\n }\n },\n [],\n );\n\n const { publish, channelStatus, channel } = useMessageBrokerChannel({\n channelOptions,\n consumerFn: onMessageReceive,\n });\n\n const closeChannel = useCallback(() => {\n if (channel) {\n channel.destroyChannel();\n }\n }, [channel]);\n\n return {\n publishStrokes: publish,\n channelStatus,\n closeChannel,\n initialStrokesData,\n registerCallback,\n };\n};\n\nexport default useCanvasSyncBroker;\n"],"names":["extractStrokeData","payload","useCanvasSyncBroker","channelId","logEvent","initialCanvasData","type","initialStrokesData","setInitialStrokesData","useState","map","message","_a","qrId","strokeData","_b","callbacksMapRef","useRef","channelOptions","useMemo","registerCallback","useCallback","cb","onMessageReceive","messages","initialData","strokesPerWidgetMap","eventPayload","strokes","userId","canvasHeight","widgetOnReceiveCallback","prevData","currentData","key","publish","channelStatus","channel","useMessageBrokerChannel","closeChannel","useCanvasSyncBroker$1"],"mappings":";;AAuBA,MAAMA,IAAoB,CAACC,OAAoD;AAAA,EAC7E,QAAQA,EAAQ;AAAA,EAChB,MAAMA,EAAQ;AAAA,EACd,QAAQA,EAAQ;AAAA,EAChB,YAAYA,EAAQ;AAAA,EACpB,UAAUA,EAAQ;AAAA,EAClB,WAAWA,EAAQ;AACrB,IAEMC,IAAsB,CAC1BC,GACAC,GACAC,GACAC,IAAkB,aACf;AACG,QAAA,CAACC,GAAoBC,CAAqB,IAAIC;AAAA,IAClD,MAAM;;AACJ,YAAMC,IAAqC,CAAA;AAEvC,UAAA,CAACL,EAA0B,QAAAK;AAEpB,iBAAA,EAAE,SAAAC,EAAQ,KAAKN,GAAmB;AACrC,cAAAJ,KAAWW,IAAAD,EAAQ,YAAR,gBAAAC,EAA8B,cACzCC,IAAOZ,KAAA,gBAAAA,EAAS;AAElB,YAAA,EAACA,KAAA,QAAAA,EAAS,YAAY;AAEpB,cAAAa,IAAad,EAAkBC,CAAO;AAExC,QAAAY,KAAQH,EAAIG,CAAI,KACdE,IAAAL,EAAAG,CAAI,MAAJ,QAAAE,EAAO,KAAKD,KAEZJ,EAAAG,CAAI,IAAI,CAACC,CAAU;AAAA,MAE3B;AAEO,aAAAJ;AAAA,IACT;AAAA,EAAA,GAEIM,IAAkBC,EAAoD,CAAA,CAAE,GAExEC,IAAiBC;AAAA,IACrB,OAAO;AAAA,MACL,WAAAhB;AAAA,MACA,KAAKG,MAAS,WAAW,IAAI;AAAA,MAC7B,QAAQF;AAAA,IAAA;AAAA,IAEV,CAACD,GAAWC,GAAUE,CAAI;AAAA,EAAA,GAGtBc,IAAmBC,EAAY,CAACR,GAAcS,MAAoC;AACtE,IAAAN,EAAA,UAAU,EAAE,GAAGA,EAAgB,SAAS,CAACH,CAAI,GAAGS;EAClE,GAAG,CAAE,CAAA,GAECC,IAAmBF;AAAA,IACvB,CAACG,GAAkCC,MAA0B;AAC3D,YAAMC,IAA0D,CAAA;AAEhE,MAAAF,EAAS,QAAQ,CAAWb,MAAA;;AACpB,cAAA,EAAE,SAAAV,EAAQ,IAAIU,EAAQ,SACtB,EAAE,cAAAgB,EAAiB,IAAA1B,GACnBY,IAAOc,KAAA,gBAAAA,EAAc,YACrBC,IAAUD,KAAA,gBAAAA,EAAc,MACxBE,IAASF,KAAA,gBAAAA,EAAc,QACvBG,IAAeH,KAAA,gBAAAA,EAAc,QAC7BI,IAA0Bf,EAAgB,QAAQH,CAAI;AAExD,YAAA,CAACY,KAAeM;AACM,UAAAA,EAAA;AAAA,YACtB,MAAMH;AAAA,YACN,QAAQE;AAAA,YACR,QAAAD;AAAA,YACA,YAAYhB;AAAA,YACZ,UAAUc,KAAA,gBAAAA,EAAc;AAAA,YACxB,WAAWA,KAAA,gBAAAA,EAAc;AAAA,UAAA,CAC1B;AAAA,aACI;AACC,gBAAAb,IAAad,EAAkB2B,CAAY;AAE7C,UAAAd,KAAQa,EAAoBb,CAAI,KACdD,IAAAc,EAAAb,CAAI,MAAJ,QAAAD,EAAO,KAAKE,KAEZY,EAAAb,CAAI,IAAI,CAACC,CAAU;AAAA,QAE3C;AAAA,MAAA,CACD,GAEG,OAAO,KAAKY,CAAmB,EAAE,SAAS,KAC5ClB,EAAsB,CAAYwB,MAAA;AAC1B,cAAAC,IAAc,EAAE,GAAGD;AAEzB,sBAAO,KAAKN,CAAmB,EAAE,QAAQ,CAAOQ,MAAA;;AAC1C,UAAAA,KAAOD,EAAYC,CAAG,KACZtB,IAAAqB,EAAAC,CAAG,MAAH,QAAAtB,EAAM,KAAK,GAAIc,EAAoBQ,CAAG,KAAK,CAAA,KAEvDD,EAAYC,CAAG,IAAIR,EAAoBQ,CAAG,KAAK,CAAA;AAAA,QACjD,CACD,GAEMD;AAAA,MAAA,CACR;AAAA,IAEL;AAAA,IACA,CAAC;AAAA,EAAA,GAGG,EAAE,SAAAE,GAAS,eAAAC,GAAe,SAAAC,EAAA,IAAYC,EAAwB;AAAA,IAClE,gBAAApB;AAAA,IACA,YAAYK;AAAA,EAAA,CACb,GAEKgB,IAAelB,EAAY,MAAM;AACrC,IAAIgB,KACFA,EAAQ,eAAe;AAAA,EACzB,GACC,CAACA,CAAO,CAAC;AAEL,SAAA;AAAA,IACL,gBAAgBF;AAAA,IAChB,eAAAC;AAAA,IACA,cAAAG;AAAA,IACA,oBAAAhC;AAAA,IACA,kBAAAa;AAAA,EAAA;AAEJ,GAEAoB,IAAetC;"}
|
@@ -1,28 +1,32 @@
|
|
1
|
-
import { useContext as
|
2
|
-
import
|
3
|
-
const
|
1
|
+
import { useContext as a, useMemo as m } from "react";
|
2
|
+
import v from "../cue-canvas-context.js";
|
3
|
+
const A = () => {
|
4
4
|
const {
|
5
|
-
activeInstance:
|
6
|
-
setActiveTool:
|
5
|
+
activeInstance: o,
|
6
|
+
setActiveTool: t,
|
7
7
|
activeTool: e,
|
8
|
-
setActiveInstance:
|
8
|
+
setActiveInstance: r,
|
9
9
|
activeColor: s,
|
10
|
-
setActiveColor:
|
11
|
-
|
10
|
+
setActiveColor: i,
|
11
|
+
homeworkId: n,
|
12
|
+
setHomeworkId: c
|
13
|
+
} = a(v), l = m(
|
12
14
|
() => e ? ["pen", "ruler", "highlighter", "marker"].includes(e) : !1,
|
13
15
|
[e]
|
14
16
|
);
|
15
17
|
return {
|
16
|
-
activeInstance:
|
17
|
-
setActiveTool:
|
18
|
+
activeInstance: o,
|
19
|
+
setActiveTool: t,
|
18
20
|
activeTool: e,
|
19
|
-
setActiveInstance:
|
21
|
+
setActiveInstance: r,
|
20
22
|
activeColor: s,
|
21
|
-
setActiveColor:
|
22
|
-
isWritingToolActive:
|
23
|
+
setActiveColor: i,
|
24
|
+
isWritingToolActive: l,
|
25
|
+
homeworkId: n,
|
26
|
+
setHomeworkId: c
|
23
27
|
};
|
24
28
|
};
|
25
29
|
export {
|
26
|
-
|
30
|
+
A as useCueCanvasActions
|
27
31
|
};
|
28
32
|
//# sourceMappingURL=use-cue-canvas-actions.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-cue-canvas-actions.js","sources":["../../../../src/features/cue-canvas/hooks/use-cue-canvas-actions.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\n\nimport PolyContext from '../cue-canvas-context';\n\nexport const useCueCanvasActions = () => {\n const {\n activeInstance,\n setActiveTool,\n activeTool,\n setActiveInstance,\n activeColor,\n setActiveColor,\n } = useContext(PolyContext);\n\n const isWritingToolActive = useMemo(\n () => (activeTool ? ['pen', 'ruler', 'highlighter', 'marker'].includes(activeTool) : false),\n [activeTool],\n );\n\n return {\n activeInstance,\n setActiveTool,\n activeTool,\n setActiveInstance,\n activeColor,\n setActiveColor,\n isWritingToolActive,\n };\n};\n"],"names":["useCueCanvasActions","activeInstance","setActiveTool","activeTool","setActiveInstance","activeColor","setActiveColor","useContext","PolyContext","isWritingToolActive","useMemo"],"mappings":";;AAIO,MAAMA,IAAsB,MAAM;AACjC,QAAA;AAAA,IACJ,gBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,IACEC,EAAWC,CAAW,GAEpBC,IAAsBC;AAAA,IAC1B,
|
1
|
+
{"version":3,"file":"use-cue-canvas-actions.js","sources":["../../../../src/features/cue-canvas/hooks/use-cue-canvas-actions.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\n\nimport PolyContext from '../cue-canvas-context';\n\nexport const useCueCanvasActions = () => {\n const {\n activeInstance,\n setActiveTool,\n activeTool,\n setActiveInstance,\n activeColor,\n setActiveColor,\n homeworkId,\n setHomeworkId,\n } = useContext(PolyContext);\n\n const isWritingToolActive = useMemo(\n () => (activeTool ? ['pen', 'ruler', 'highlighter', 'marker'].includes(activeTool) : false),\n [activeTool],\n );\n\n return {\n activeInstance,\n setActiveTool,\n activeTool,\n setActiveInstance,\n activeColor,\n setActiveColor,\n isWritingToolActive,\n homeworkId,\n setHomeworkId,\n };\n};\n"],"names":["useCueCanvasActions","activeInstance","setActiveTool","activeTool","setActiveInstance","activeColor","setActiveColor","homeworkId","setHomeworkId","useContext","PolyContext","isWritingToolActive","useMemo"],"mappings":";;AAIO,MAAMA,IAAsB,MAAM;AACjC,QAAA;AAAA,IACJ,gBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,EAAA,IACEC,EAAWC,CAAW,GAEpBC,IAAsBC;AAAA,IAC1B,MAAOT,IAAa,CAAC,OAAO,SAAS,eAAe,QAAQ,EAAE,SAASA,CAAU,IAAI;AAAA,IACrF,CAACA,CAAU;AAAA,EAAA;AAGN,SAAA;AAAA,IACL,gBAAAF;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,qBAAAK;AAAA,IACA,YAAAJ;AAAA,IACA,eAAAC;AAAA,EAAA;AAEJ;"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { useRef as d, useCallback as c } from "react";
|
2
|
+
import m from "../../worksheet/worksheet/hooks/use-s3-helper.js";
|
3
|
+
const p = { type: "cuemath_whiteboard" }, h = (a) => {
|
4
|
+
const { userId: o, renderAs: u, userType: s } = a, l = d(), r = m({
|
5
|
+
studentId: o,
|
6
|
+
query: p,
|
7
|
+
enabled: u === "whiteboard" && s === "TEACHER"
|
8
|
+
}), t = c(
|
9
|
+
async (n) => {
|
10
|
+
const e = await r({
|
11
|
+
fileKey: "media/cuemath-whiteboard/",
|
12
|
+
images: [{ file: n, url: "" }]
|
13
|
+
});
|
14
|
+
return e && e.length > 0 ? e[0] ?? "error" : "error";
|
15
|
+
},
|
16
|
+
[r]
|
17
|
+
);
|
18
|
+
return l.current = t, t;
|
19
|
+
};
|
20
|
+
export {
|
21
|
+
h as default
|
22
|
+
};
|
23
|
+
//# sourceMappingURL=use-upload-helper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-upload-helper.js","sources":["../../../../src/features/cue-canvas/hooks/use-upload-helper.ts"],"sourcesContent":["import type { TUserTypes } from '../../ui/types';\nimport type { TRenderAs } from '../types/cue-canvas';\n\nimport { useCallback } from 'react';\nimport { useRef } from 'react';\n\nimport useS3ImageUploadHelper from '../../worksheet/worksheet/hooks/use-s3-helper';\n\ninterface IUseUploadHelper {\n userId: string;\n renderAs: TRenderAs;\n userType: TUserTypes;\n}\nconst QUERY = { type: 'cuemath_whiteboard' };\n\nconst useUploadHelper = (props: IUseUploadHelper) => {\n const { userId, renderAs, userType } = props;\n const uploadImageRef = useRef<(file: File) => Promise<string>>();\n const uploadImages = useS3ImageUploadHelper({\n studentId: userId,\n query: QUERY,\n enabled: renderAs === 'whiteboard' && userType === 'TEACHER',\n });\n\n const uploadImageToS3 = useCallback(\n async (file: File) => {\n const urls = await uploadImages({\n fileKey: `media/cuemath-whiteboard/`,\n images: [{ file: file, url: '' }],\n });\n\n if (urls && urls.length > 0) {\n const url = urls[0] ?? 'error';\n\n return url;\n }\n\n return 'error';\n },\n [uploadImages],\n );\n\n uploadImageRef.current = uploadImageToS3;\n\n return uploadImageToS3;\n};\n\nexport default useUploadHelper;\n"],"names":["QUERY","useUploadHelper","props","userId","renderAs","userType","uploadImageRef","useRef","uploadImages","useS3ImageUploadHelper","uploadImageToS3","useCallback","file","urls"],"mappings":";;AAaA,MAAMA,IAAQ,EAAE,MAAM,wBAEhBC,IAAkB,CAACC,MAA4B;AACnD,QAAM,EAAE,QAAAC,GAAQ,UAAAC,GAAU,UAAAC,EAAA,IAAaH,GACjCI,IAAiBC,KACjBC,IAAeC,EAAuB;AAAA,IAC1C,WAAWN;AAAA,IACX,OAAOH;AAAA,IACP,SAASI,MAAa,gBAAgBC,MAAa;AAAA,EAAA,CACpD,GAEKK,IAAkBC;AAAA,IACtB,OAAOC,MAAe;AACd,YAAAC,IAAO,MAAML,EAAa;AAAA,QAC9B,SAAS;AAAA,QACT,QAAQ,CAAC,EAAE,MAAAI,GAAY,KAAK,IAAI;AAAA,MAAA,CACjC;AAEG,aAAAC,KAAQA,EAAK,SAAS,IACZA,EAAK,CAAC,KAAK,UAKlB;AAAA,IACT;AAAA,IACA,CAACL,CAAY;AAAA,EAAA;AAGf,SAAAF,EAAe,UAAUI,GAElBA;AACT;"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
const m = (t) => {
|
2
|
+
const e = typeof t == "string" ? new Date(t) : new Date(t * 1e3), o = e.getDate(), r = e.getMonth() + 1;
|
3
|
+
return { year: e.getFullYear(), month: r, date: o };
|
4
|
+
};
|
5
|
+
function a(t) {
|
6
|
+
const n = /* @__PURE__ */ new Date();
|
7
|
+
return n.setMonth(t - 1), n.toLocaleString("en-US", {
|
8
|
+
month: "short"
|
9
|
+
});
|
10
|
+
}
|
11
|
+
const c = (t) => {
|
12
|
+
var e;
|
13
|
+
return (e = a(+t)) == null ? void 0 : e.toUpperCase();
|
14
|
+
};
|
15
|
+
export {
|
16
|
+
m as getDateInInputFormat,
|
17
|
+
c as getMonthNameforNumber,
|
18
|
+
a as toMonthName
|
19
|
+
};
|
20
|
+
//# sourceMappingURL=helper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helper.js","sources":["../../../../../src/features/cue-canvas/sidebar/homework/helper.ts"],"sourcesContent":["export const getDateInInputFormat = (inputDate: number | string) => {\n const isDateInString = typeof inputDate === 'string';\n const dateToBeConverted = isDateInString ? new Date(inputDate) : new Date(inputDate * 1000);\n\n const dateNum = dateToBeConverted.getDate();\n const monthNum = dateToBeConverted.getMonth() + 1;\n const year = dateToBeConverted.getFullYear();\n\n return { year, month: monthNum, date: dateNum };\n};\n\nexport function toMonthName(monthNumber: number) {\n const date = new Date();\n\n date.setMonth(monthNumber - 1);\n\n return date.toLocaleString('en-US', {\n month: 'short',\n });\n}\nexport const getMonthNameforNumber = (num: number) => {\n const monthName = toMonthName(+num)?.toUpperCase();\n\n return monthName;\n};\n"],"names":["getDateInInputFormat","inputDate","dateToBeConverted","dateNum","monthNum","toMonthName","monthNumber","date","getMonthNameforNumber","num","_a"],"mappings":"AAAa,MAAAA,IAAuB,CAACC,MAA+B;AAE5D,QAAAC,IADiB,OAAOD,KAAc,WACD,IAAI,KAAKA,CAAS,IAAI,IAAI,KAAKA,IAAY,GAAI,GAEpFE,IAAUD,EAAkB,WAC5BE,IAAWF,EAAkB,SAAA,IAAa;AAGhD,SAAO,EAAE,MAFIA,EAAkB,eAEhB,OAAOE,GAAU,MAAMD,EAAQ;AAChD;AAEO,SAASE,EAAYC,GAAqB;AACzC,QAAAC,wBAAW;AAEZ,SAAAA,EAAA,SAASD,IAAc,CAAC,GAEtBC,EAAK,eAAe,SAAS;AAAA,IAClC,OAAO;AAAA,EAAA,CACR;AACH;AACa,MAAAC,IAAwB,CAACC,MAAgB;AApBzC,MAAAC;AAuBJ,UAFWA,IAAAL,EAAY,CAACI,CAAG,MAAhB,gBAAAC,EAAmB;AAGvC;"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
2
|
+
import { memo as l } from "react";
|
3
|
+
import m from "../../../../assets/line-icons/icons/cross.js";
|
4
|
+
import s from "../../../ui/buttons/clickable/clickable.js";
|
5
|
+
import r from "../../../ui/layout/flex-view.js";
|
6
|
+
import i from "../../../ui/text/text.js";
|
7
|
+
import $ from "./homework-request.js";
|
8
|
+
import { MenuContainer as d } from "./homework-styled.js";
|
9
|
+
const a = ({ onSelect: n, hwRequests: c }) => /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(r, { children: /* @__PURE__ */ t(
|
10
|
+
r,
|
11
|
+
{
|
12
|
+
$flexDirection: "row",
|
13
|
+
$alignItems: "center",
|
14
|
+
$justifyContent: "center",
|
15
|
+
$flexWrap: !0,
|
16
|
+
$gutterX: 0.5,
|
17
|
+
$gapX: 0.5,
|
18
|
+
children: [
|
19
|
+
/* @__PURE__ */ t(r, { $flexDirection: "row", $gapX: 0.5, children: [
|
20
|
+
/* @__PURE__ */ t(r, { $width: "184px", $gutterX: 1, children: [
|
21
|
+
/* @__PURE__ */ e(i, { $color: "WHITE", $renderAs: "eyebrow2", children: "HOMEWORK" }),
|
22
|
+
/* @__PURE__ */ e(i, { $color: "WHITE", $renderAs: "eyebrow2", children: "HELP REQUESTS" })
|
23
|
+
] }),
|
24
|
+
/* @__PURE__ */ e(s, { onClick: n, label: "close activities menu", children: /* @__PURE__ */ e(m, { color: "WHITE" }) })
|
25
|
+
] }),
|
26
|
+
c.map((o) => /* @__PURE__ */ e(r, { $gutterX: 0.25, $gapX: 0.5, children: /* @__PURE__ */ e($, { hwRequest: o, onSelect: n, studentName: o.student_name }) }, o.created_on_ts))
|
27
|
+
]
|
28
|
+
}
|
29
|
+
) }) }), w = l(a);
|
30
|
+
export {
|
31
|
+
w as default
|
32
|
+
};
|
33
|
+
//# sourceMappingURL=homework-menu.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"homework-menu.js","sources":["../../../../../src/features/cue-canvas/sidebar/homework/homework-menu.tsx"],"sourcesContent":["import type { IHomeWorkMenuProps } from './homework-types';\n\nimport { memo } from 'react';\n\nimport CrossIcon from '../../../../assets/line-icons/icons/cross';\nimport Clickable from '../../../ui/buttons/clickable/clickable';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\nimport HWRequest from './homework-request';\nimport * as Styled from './homework-styled';\n\nconst HomeWorkMenu: React.FC<IHomeWorkMenuProps> = ({ onSelect, hwRequests }) => {\n return (\n <Styled.MenuContainer>\n <FlexView>\n <FlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $flexWrap\n $gutterX={0.5}\n $gapX={0.5}\n >\n <FlexView $flexDirection=\"row\" $gapX={0.5}>\n <FlexView $width={'184px'} $gutterX={1}>\n <Text $color=\"WHITE\" $renderAs=\"eyebrow2\">\n HOMEWORK\n </Text>\n <Text $color=\"WHITE\" $renderAs=\"eyebrow2\">\n HELP REQUESTS\n </Text>\n </FlexView>\n <Clickable onClick={onSelect} label=\"close activities menu\">\n <CrossIcon color=\"WHITE\" />\n </Clickable>\n </FlexView>\n\n {hwRequests.map(item => (\n <FlexView $gutterX={0.25} $gapX={0.5} key={item.created_on_ts}>\n <HWRequest hwRequest={item} onSelect={onSelect} studentName={item.student_name} />\n </FlexView>\n ))}\n </FlexView>\n </FlexView>\n </Styled.MenuContainer>\n );\n};\n\nexport default memo(HomeWorkMenu);\n"],"names":["HomeWorkMenu","onSelect","hwRequests","jsx","Styled.MenuContainer","FlexView","jsxs","Text","Clickable","CrossIcon","item","HWRequest","HomeWorkMenu$1","memo"],"mappings":";;;;;;;;AAWA,MAAMA,IAA6C,CAAC,EAAE,UAAAC,GAAU,YAAAC,QAE3D,gBAAAC,EAAAC,GAAA,EACC,4BAACC,GACC,EAAA,UAAA,gBAAAC;AAAA,EAACD;AAAA,EAAA;AAAA,IACC,gBAAe;AAAA,IACf,aAAY;AAAA,IACZ,iBAAgB;AAAA,IAChB,WAAS;AAAA,IACT,UAAU;AAAA,IACV,OAAO;AAAA,IAEP,UAAA;AAAA,MAAA,gBAAAC,EAACD,GAAS,EAAA,gBAAe,OAAM,OAAO,KACpC,UAAA;AAAA,QAAA,gBAAAC,EAACD,GAAS,EAAA,QAAQ,SAAS,UAAU,GACnC,UAAA;AAAA,UAAA,gBAAAF,EAACI,GAAK,EAAA,QAAO,SAAQ,WAAU,YAAW,UAE1C,YAAA;AAAA,4BACCA,GAAK,EAAA,QAAO,SAAQ,WAAU,YAAW,UAE1C,iBAAA;AAAA,QAAA,GACF;AAAA,QACA,gBAAAJ,EAACK,GAAU,EAAA,SAASP,GAAU,OAAM,yBAClC,UAAC,gBAAAE,EAAAM,GAAA,EAAU,OAAM,QAAA,CAAQ,EAC3B,CAAA;AAAA,MAAA,GACF;AAAA,MAECP,EAAW,IAAI,CACdQ,MAAA,gBAAAP,EAACE,KAAS,UAAU,MAAM,OAAO,KAC/B,UAAA,gBAAAF,EAACQ,KAAU,WAAWD,GAAM,UAAAT,GAAoB,aAAaS,EAAK,cAAc,EADvC,GAAAA,EAAK,aAEhD,CACD;AAAA,IAAA;AAAA,EAAA;AAAA,EAEL,CAAA,EACF,CAAA,GAIWE,IAAAC,EAAKb,CAAY;"}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import { jsx as o, jsxs as q } from "react/jsx-runtime";
|
2
|
+
import { h as c } from "../../../../node_modules/humanize-plus/dist/humanize.js";
|
3
|
+
import { memo as $, useCallback as k } from "react";
|
4
|
+
import W from "../../../ui/buttons/clickable/clickable.js";
|
5
|
+
import _ from "../../../ui/layout/flex-view.js";
|
6
|
+
import d from "../../../ui/text/text.js";
|
7
|
+
import { useCueCanvasActions as y } from "../../hooks/use-cue-canvas-actions.js";
|
8
|
+
import { getDateInInputFormat as E, getMonthNameforNumber as T } from "./helper.js";
|
9
|
+
import { HWImageContainer as v } from "./homework-styled.js";
|
10
|
+
import l from "../../../../node_modules/uuid/dist/esm-browser/v4.js";
|
11
|
+
const D = (u) => {
|
12
|
+
var a;
|
13
|
+
const { hwRequest: h, onSelect: r, studentName: p } = u, {
|
14
|
+
problem_description: n,
|
15
|
+
problem_image_urls: e,
|
16
|
+
created_on_ts: f,
|
17
|
+
homework_id: s
|
18
|
+
} = h, { setHomeworkId: m, activeInstance: t } = y(), g = k(() => {
|
19
|
+
const x = l();
|
20
|
+
if (e && e.length > 0) {
|
21
|
+
const i = {
|
22
|
+
data: {
|
23
|
+
[x]: [
|
24
|
+
void 0,
|
25
|
+
{
|
26
|
+
name: "text",
|
27
|
+
html: n,
|
28
|
+
x: 500,
|
29
|
+
y: 75,
|
30
|
+
rot: 0
|
31
|
+
}
|
32
|
+
]
|
33
|
+
}
|
34
|
+
};
|
35
|
+
e.forEach((C) => {
|
36
|
+
const H = l(), R = C + `?${Date.now()}`;
|
37
|
+
i.data[H] = [
|
38
|
+
void 0,
|
39
|
+
{
|
40
|
+
name: "image",
|
41
|
+
href: R,
|
42
|
+
x: 48,
|
43
|
+
y: 72,
|
44
|
+
rot: 0,
|
45
|
+
width: 400
|
46
|
+
}
|
47
|
+
];
|
48
|
+
}), t == null || t.replaceCanvas(i);
|
49
|
+
}
|
50
|
+
r(), m(s);
|
51
|
+
}, [t, n, s, e, r, m]), { date: w, month: I } = E(f), b = `${c.ordinal(w)} ${c.titleCase((a = T(I)) == null ? void 0 : a.toLowerCase())}`;
|
52
|
+
return /* @__PURE__ */ o(W, { label: "HW Request Item", onClick: g, children: /* @__PURE__ */ q(_, { $alignItems: "center", $justifyContent: "center", $borderRadius: 8, $background: "WHITE", children: [
|
53
|
+
/* @__PURE__ */ o(v, { src: e[0], alt: "Homework Request" }),
|
54
|
+
/* @__PURE__ */ o(d, { $renderAs: "body3", color: "WHITE", children: p }),
|
55
|
+
/* @__PURE__ */ o(d, { $renderAs: "body3", color: "WHITE", children: b })
|
56
|
+
] }) });
|
57
|
+
}, V = $(D);
|
58
|
+
export {
|
59
|
+
V as default
|
60
|
+
};
|
61
|
+
//# sourceMappingURL=homework-request.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"homework-request.js","sources":["../../../../../src/features/cue-canvas/sidebar/homework/homework-request.tsx"],"sourcesContent":["import type { IReplaceCanvas } from '../../types/cue-canvas';\nimport type { IHomeWorkRequestProps } from './homework-types';\n\nimport { ordinal, titleCase } from 'humanize-plus';\nimport { memo, useCallback } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport Clickable from '../../../ui/buttons/clickable/clickable';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\nimport { useCueCanvasActions } from '../../hooks/use-cue-canvas-actions';\nimport { getDateInInputFormat, getMonthNameforNumber } from './helper';\nimport * as Styled from './homework-styled';\n\nconst HomeWorkRequest: React.FC<IHomeWorkRequestProps> = props => {\n const { hwRequest, onSelect, studentName } = props;\n const {\n problem_description: hwRequestDesc,\n problem_image_urls: hwRequestImages,\n created_on_ts: createdOnTs,\n homework_id: hwRequestId,\n } = hwRequest;\n const { setHomeworkId, activeInstance } = useCueCanvasActions();\n\n const onSelectHwRequest = useCallback(() => {\n const textId = uuidv4();\n\n if (hwRequestImages && hwRequestImages.length > 0) {\n const actionData: IReplaceCanvas = {\n data: {\n [textId]: [\n undefined,\n {\n name: 'text',\n html: hwRequestDesc,\n x: 500,\n y: 75,\n rot: 0,\n },\n ],\n },\n };\n\n hwRequestImages.forEach(image => {\n const imgId = uuidv4();\n const imageUrl = image + `?${Date.now()}`;\n\n actionData.data[imgId] = [\n undefined,\n {\n name: 'image',\n href: imageUrl,\n x: 48,\n y: 72,\n rot: 0,\n width: 400,\n },\n ];\n });\n\n activeInstance?.replaceCanvas(actionData);\n }\n // const url = new URL(window.location.href);\n // url.searchParams.set('homeworkId', hwRequestId);\n // console.log('url', url);\n // window.history.replaceState({}, '', url.toString());\n onSelect();\n setHomeworkId(hwRequestId);\n }, [activeInstance, hwRequestDesc, hwRequestId, hwRequestImages, onSelect, setHomeworkId]);\n\n const { date, month } = getDateInInputFormat(createdOnTs);\n\n const dateString = `${ordinal(date)} ${titleCase(getMonthNameforNumber(month)?.toLowerCase())}`;\n\n return (\n <Clickable label=\"HW Request Item\" onClick={onSelectHwRequest}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" $borderRadius={8} $background=\"WHITE\">\n <Styled.HWImageContainer src={hwRequestImages[0]} alt=\"Homework Request\" />\n <Text $renderAs=\"body3\" color=\"WHITE\">\n {studentName}\n </Text>\n <Text $renderAs=\"body3\" color=\"WHITE\">\n {dateString}\n </Text>\n </FlexView>\n </Clickable>\n );\n};\n\nexport default memo(HomeWorkRequest);\n"],"names":["HomeWorkRequest","props","hwRequest","onSelect","studentName","hwRequestDesc","hwRequestImages","createdOnTs","hwRequestId","setHomeworkId","activeInstance","useCueCanvasActions","onSelectHwRequest","useCallback","textId","uuidv4","actionData","image","imgId","imageUrl","date","month","getDateInInputFormat","dateString","ordinal","titleCase","_a","getMonthNameforNumber","jsx","Clickable","jsxs","FlexView","Styled.HWImageContainer","Text","HWRequest","memo"],"mappings":";;;;;;;;;;AAcA,MAAMA,IAAmD,CAASC,MAAA;;AAChE,QAAM,EAAE,WAAAC,GAAW,UAAAC,GAAU,aAAAC,EAAA,IAAgBH,GACvC;AAAA,IACJ,qBAAqBI;AAAA,IACrB,oBAAoBC;AAAA,IACpB,eAAeC;AAAA,IACf,aAAaC;AAAA,EACX,IAAAN,GACE,EAAE,eAAAO,GAAe,gBAAAC,EAAe,IAAIC,EAAoB,GAExDC,IAAoBC,EAAY,MAAM;AAC1C,UAAMC,IAASC;AAEX,QAAAT,KAAmBA,EAAgB,SAAS,GAAG;AACjD,YAAMU,IAA6B;AAAA,QACjC,MAAM;AAAA,UACJ,CAACF,CAAM,GAAG;AAAA,YACR;AAAA,YACA;AAAA,cACE,MAAM;AAAA,cACN,MAAMT;AAAA,cACN,GAAG;AAAA,cACH,GAAG;AAAA,cACH,KAAK;AAAA,YACP;AAAA,UACF;AAAA,QACF;AAAA,MAAA;AAGF,MAAAC,EAAgB,QAAQ,CAASW,MAAA;AAC/B,cAAMC,IAAQH,KACRI,IAAWF,IAAQ,IAAI,KAAK,IAAK,CAAA;AAE5B,QAAAD,EAAA,KAAKE,CAAK,IAAI;AAAA,UACvB;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,MAAMC;AAAA,YACN,GAAG;AAAA,YACH,GAAG;AAAA,YACH,KAAK;AAAA,YACL,OAAO;AAAA,UACT;AAAA,QAAA;AAAA,MACF,CACD,GAEDT,KAAA,QAAAA,EAAgB,cAAcM;AAAA,IAChC;AAKS,IAAAb,KACTM,EAAcD,CAAW;AAAA,EAAA,GACxB,CAACE,GAAgBL,GAAeG,GAAaF,GAAiBH,GAAUM,CAAa,CAAC,GAEnF,EAAE,MAAAW,GAAM,OAAAC,EAAM,IAAIC,EAAqBf,CAAW,GAElDgB,IAAa,GAAGC,UAAQJ,CAAI,CAAC,IAAIK,aAAUC,IAAAC,EAAsBN,CAAK,MAA3B,gBAAAK,EAA8B,aAAa,CAAC;AAE7F,SACG,gBAAAE,EAAAC,GAAA,EAAU,OAAM,mBAAkB,SAASjB,GAC1C,UAAA,gBAAAkB,EAACC,GAAS,EAAA,aAAY,UAAS,iBAAgB,UAAS,eAAe,GAAG,aAAY,SACpF,UAAA;AAAA,IAAC,gBAAAH,EAAAI,GAAA,EAAwB,KAAK1B,EAAgB,CAAC,GAAG,KAAI,oBAAmB;AAAA,sBACxE2B,GAAK,EAAA,WAAU,SAAQ,OAAM,SAC3B,UACH7B,GAAA;AAAA,sBACC6B,GAAK,EAAA,WAAU,SAAQ,OAAM,SAC3B,UACHV,GAAA;AAAA,EAAA,EACF,CAAA,EACF,CAAA;AAEJ,GAEeW,IAAAC,EAAKnC,CAAe;"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import o from "styled-components";
|
2
|
+
import t from "../../../ui/layout/flex-view.js";
|
3
|
+
const i = o(t)`
|
4
|
+
position: absolute;
|
5
|
+
top: 38px;
|
6
|
+
left: -87px; //32px + 32 px for icon +8+8(separator) +7 gutter
|
7
|
+
width: 248px;
|
8
|
+
height: 438px;
|
9
|
+
border-radius: 6px;
|
10
|
+
background: #292734;
|
11
|
+
box-shadow: 0px 4px 8px ${({ theme: r }) => r.colors.BLACK_T_20};
|
12
|
+
overflow-y: auto;
|
13
|
+
`, a = o.img.attrs({ loading: "lazy" })`
|
14
|
+
width: 184px;
|
15
|
+
height: 128px;
|
16
|
+
border-top-left-radius: 8px;
|
17
|
+
border-top-right-radius: 8px;
|
18
|
+
border-bottom-left-radius: 0;
|
19
|
+
border-bottom-right-radius: 0;
|
20
|
+
`;
|
21
|
+
export {
|
22
|
+
a as HWImageContainer,
|
23
|
+
i as MenuContainer
|
24
|
+
};
|
25
|
+
//# sourceMappingURL=homework-styled.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"homework-styled.js","sources":["../../../../../src/features/cue-canvas/sidebar/homework/homework-styled.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport FlexView from '../../../ui/layout/flex-view';\n\nconst MenuContainer = styled(FlexView)`\n position: absolute;\n top: 38px;\n left: -87px; //32px + 32 px for icon +8+8(separator) +7 gutter\n width: 248px;\n height: 438px;\n border-radius: 6px;\n background: #292734;\n box-shadow: 0px 4px 8px ${({ theme }) => theme.colors.BLACK_T_20};\n overflow-y: auto;\n`;\nconst HWImageContainer = styled.img.attrs({ loading: 'lazy' })`\n width: 184px;\n height: 128px;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n`;\n\nexport { MenuContainer, HWImageContainer };\n"],"names":["MenuContainer","styled","FlexView","theme","HWImageContainer"],"mappings":";;AAIM,MAAAA,IAAgBC,EAAOC,CAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAQT,CAAC,EAAE,OAAAC,EAAA,MAAYA,EAAM,OAAO,UAAU;AAAA;AAAA,GAG5DC,IAAmBH,EAAO,IAAI,MAAM,EAAE,SAAS,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
2
|
+
import { memo as k, useRef as d, useCallback as c, useEffect as p } from "react";
|
3
|
+
import C from "../../../../assets/line-icons/icons/hw.js";
|
4
|
+
import w from "../../../ui/buttons/clickable/clickable.js";
|
5
|
+
import v from "../../../ui/hooks/use-context-menu-click-handler.js";
|
6
|
+
import b from "../../../ui/layout/flex-view.js";
|
7
|
+
import { StyledWrapper as H } from "../../cue-cavas-styled.js";
|
8
|
+
import { useCueCanvasActions as W } from "../../hooks/use-cue-canvas-actions.js";
|
9
|
+
import x from "./homework-menu.js";
|
10
|
+
const M = (a) => {
|
11
|
+
const { activeSidebar: e, setActiveSidebar: o, hwRequests: f } = a, { activeInstance: t } = W(), n = d(null), h = c(
|
12
|
+
() => o((s) => s === "homework" ? void 0 : s),
|
13
|
+
[o]
|
14
|
+
), { menuVisible: l, onMenuClick: i } = v(
|
15
|
+
n,
|
16
|
+
void 0,
|
17
|
+
!0,
|
18
|
+
h
|
19
|
+
), m = c(() => {
|
20
|
+
e === "tile" && (t == null || t.toggleTiles(!1)), o(e === "homework" ? void 0 : "homework"), i();
|
21
|
+
}, [e, t, i, o]);
|
22
|
+
return p(() => {
|
23
|
+
e === "tile" && l && i();
|
24
|
+
}, [e, l, i]), /* @__PURE__ */ u(b, { $position: "relative", ref: n, children: [
|
25
|
+
/* @__PURE__ */ r(w, { onClick: m, label: "homework help", children: /* @__PURE__ */ r(H, { $active: e === "homework", children: /* @__PURE__ */ r(C, { width: 20, height: 20, fill: e === "homework" ? "WHITE" : "BLACK" }) }) }),
|
26
|
+
l && /* @__PURE__ */ r(x, { onSelect: m, hwRequests: f })
|
27
|
+
] });
|
28
|
+
}, V = k(M);
|
29
|
+
export {
|
30
|
+
V as default
|
31
|
+
};
|
32
|
+
//# sourceMappingURL=homework.js.map
|