@cuemath/leap 2.8.35-beta.0 → 2.8.36-beta-0.1
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/communication/pub-sub/constants.js +2 -1
- package/dist/features/communication/pub-sub/constants.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-core.js.map +1 -1
- package/dist/features/cue-canvas/hooks/use-canvas-sync-broker.js +63 -54
- package/dist/features/cue-canvas/hooks/use-canvas-sync-broker.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js +130 -117
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/added-resource-and-filters.js +71 -77
- package/dist/features/milestone/milestone-resources/resources-assign/added-resource-and-filters.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/api/get-resource.js +5 -4
- package/dist/features/milestone/milestone-resources/resources-assign/api/get-resource.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/comps/filter-item/filter-item-styled.js +8 -9
- package/dist/features/milestone/milestone-resources/resources-assign/comps/filter-item/filter-item-styled.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/comps/filter-item/filter-item.js +10 -10
- package/dist/features/milestone/milestone-resources/resources-assign/comps/filter-item/filter-item.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/constant.js +6 -0
- package/dist/features/milestone/milestone-resources/resources-assign/constant.js.map +1 -0
- package/dist/features/milestone/milestone-resources/resources-assign/resource-items/no-resource-screen.js +27 -17
- package/dist/features/milestone/milestone-resources/resources-assign/resource-items/no-resource-screen.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/resource-items/resource-items-styled.js +13 -11
- package/dist/features/milestone/milestone-resources/resources-assign/resource-items/resource-items-styled.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/resource-items/resource-items.js +40 -50
- package/dist/features/milestone/milestone-resources/resources-assign/resource-items/resource-items.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/resources-assign-styled.js +13 -12
- package/dist/features/milestone/milestone-resources/resources-assign/resources-assign-styled.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/resources-assign.js +186 -143
- package/dist/features/milestone/milestone-resources/resources-assign/resources-assign.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/utils.js +8 -4
- package/dist/features/milestone/milestone-resources/resources-assign/utils.js.map +1 -1
- package/dist/features/ui/theme/tab.js +2 -2
- package/dist/features/ui/theme/tab.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/package.json +1 -1
@@ -1,88 +1,78 @@
|
|
1
|
-
import { jsxs as
|
1
|
+
import { jsxs as m, jsx as r, Fragment as A } from "react/jsx-runtime";
|
2
2
|
import E from "../../../../../node_modules/lodash.debounce/index.js";
|
3
|
-
import { memo as
|
4
|
-
import
|
3
|
+
import { memo as _, useRef as y, useMemo as b, useEffect as x } from "react";
|
4
|
+
import C from "../../../../../assets/line-icons/icons/sheet.js";
|
5
5
|
import N from "../../../../ui/layout/flex-view.js";
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import { RESOURCE_ASSIGN_ANALYTICS_EVENTS as
|
9
|
-
import
|
10
|
-
import { ResourceItemWrapper as
|
11
|
-
const k =
|
6
|
+
import X from "../../../../ui/text/text.js";
|
7
|
+
import j from "../comps/resource-item/resource-item.js";
|
8
|
+
import { RESOURCE_ASSIGN_ANALYTICS_EVENTS as w } from "../resource-assign-analytics-events.js";
|
9
|
+
import L from "./no-resource-screen.js";
|
10
|
+
import { ResourceItemWrapper as a, ButtonWrapper as P, StyledButton as T } from "./resource-items-styled.js";
|
11
|
+
const k = _((u) => {
|
12
12
|
const {
|
13
13
|
pageNumber: t,
|
14
14
|
totalPages: i,
|
15
15
|
resourceItems: l,
|
16
16
|
selectedResource: o,
|
17
|
-
assigningInProgress:
|
17
|
+
assigningInProgress: f,
|
18
18
|
isFilterAdded: p,
|
19
|
-
onResourceAdditionOrDeletion:
|
20
|
-
onResourceAssign:
|
21
|
-
onViewResource:
|
22
|
-
onPageNumberUpdate:
|
23
|
-
} =
|
19
|
+
onResourceAdditionOrDeletion: g,
|
20
|
+
onResourceAssign: h,
|
21
|
+
onViewResource: $,
|
22
|
+
onPageNumberUpdate: d
|
23
|
+
} = u, c = y(null), R = b(
|
24
24
|
() => ({
|
25
25
|
node_ids: o.map(({ node_id: e }) => e)
|
26
26
|
}),
|
27
27
|
[o]
|
28
28
|
);
|
29
|
-
return
|
29
|
+
return x(() => {
|
30
30
|
const e = c.current;
|
31
31
|
if (e) {
|
32
32
|
const n = E(() => {
|
33
33
|
const s = e ? e.scrollTop / (e.scrollHeight - e.clientHeight) : 0;
|
34
|
-
t && i && s > 0.85 && t < i &&
|
34
|
+
t && i && s > 0.85 && t < i && d(t + 1);
|
35
35
|
}, 300);
|
36
36
|
return e.addEventListener("scroll", n), () => {
|
37
37
|
e.removeEventListener("scroll", n);
|
38
38
|
};
|
39
39
|
}
|
40
|
-
}, [c, t, i,
|
41
|
-
/* @__PURE__ */ r(
|
42
|
-
/* @__PURE__ */ r(
|
43
|
-
] }) : /* @__PURE__ */ r(
|
44
|
-
/* @__PURE__ */ r(
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
resource: e,
|
58
|
-
onResourceAdditionOrDeletion: f,
|
59
|
-
onViewResource: h,
|
60
|
-
selected: R
|
61
|
-
},
|
62
|
-
`${n}_${s}`
|
63
|
-
);
|
64
|
-
})
|
65
|
-
}
|
66
|
-
),
|
40
|
+
}, [c, t, i, d]), l.length === 0 ? p ? /* @__PURE__ */ m(N, { $height: "100%", $alignItems: "center", $justifyContent: "center", children: [
|
41
|
+
/* @__PURE__ */ r(C, { opacity: 0.38 }),
|
42
|
+
/* @__PURE__ */ r(X, { $renderAs: "ub1-bold", $color: "BLACK_T_38", children: "No sheets match the selected filters" })
|
43
|
+
] }) : /* @__PURE__ */ r(a, { $alignItems: "center", $justifyContent: "center", $overflowHidden: !0, children: /* @__PURE__ */ r(L, {}) }) : /* @__PURE__ */ m(A, { children: [
|
44
|
+
/* @__PURE__ */ r(a, { $gapX: 1.5, $gutterX: 1.5, $flexGapX: 1.125, ref: c, children: l.map((e) => {
|
45
|
+
const { id: n, node_id: s } = e, I = o.some((S) => S.node_id === s);
|
46
|
+
return /* @__PURE__ */ r(
|
47
|
+
j,
|
48
|
+
{
|
49
|
+
resource: e,
|
50
|
+
onResourceAdditionOrDeletion: g,
|
51
|
+
onViewResource: $,
|
52
|
+
selected: I
|
53
|
+
},
|
54
|
+
`${n}_${s}`
|
55
|
+
);
|
56
|
+
}) }),
|
67
57
|
o.length > 0 && /* @__PURE__ */ r(
|
68
|
-
|
58
|
+
P,
|
69
59
|
{
|
70
60
|
$flexDirection: "row",
|
71
61
|
$justifyContent: "flex-end",
|
72
62
|
$gapX: 1,
|
73
63
|
$gutterX: 1,
|
74
64
|
children: /* @__PURE__ */ r(
|
75
|
-
|
65
|
+
T,
|
76
66
|
{
|
77
67
|
renderAs: "primary",
|
78
68
|
label: "Assign",
|
79
69
|
shape: "square",
|
80
70
|
size: "small",
|
81
71
|
widthX: 8.5,
|
82
|
-
analyticsLabel:
|
83
|
-
analyticsProps:
|
84
|
-
onClick:
|
85
|
-
busy:
|
72
|
+
analyticsLabel: w.RESOURCE_ASSIGNED,
|
73
|
+
analyticsProps: R,
|
74
|
+
onClick: h,
|
75
|
+
busy: f
|
86
76
|
}
|
87
77
|
)
|
88
78
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resource-items.js","sources":["../../../../../../src/features/milestone/milestone-resources/resources-assign/resource-items/resource-items.tsx"],"sourcesContent":["import type { IResourceItems } from './resource-items-types';\nimport type { FC } from 'react';\n\nimport debounce from 'lodash.debounce';\nimport { memo, useEffect, useMemo, useRef } from 'react';\n\nimport SheetIcon from '../../../../../assets/line-icons/icons/sheet';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport ResourceItem from '../comps/resource-item/resource-item';\nimport { RESOURCE_ASSIGN_ANALYTICS_EVENTS } from '../resource-assign-analytics-events';\nimport NoResourceScreen from './no-resource-screen';\nimport * as Styled from './resource-items-styled';\n\nconst ResourceItems: FC<IResourceItems> = memo(props => {\n const {\n pageNumber,\n totalPages,\n resourceItems,\n selectedResource,\n assigningInProgress,\n isFilterAdded,\n onResourceAdditionOrDeletion,\n onResourceAssign,\n onViewResource,\n onPageNumberUpdate,\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const analyticsProps = useMemo(\n () => ({\n node_ids: selectedResource.map(({ node_id: nodeId }) => nodeId),\n }),\n [selectedResource],\n );\n\n useEffect(() => {\n const scrollElement = containerRef.current;\n\n if (scrollElement) {\n const handleScroll = debounce(() => {\n const scrollPercentage = scrollElement\n ? scrollElement.scrollTop / (scrollElement.scrollHeight - scrollElement.clientHeight)\n : 0;\n\n if (pageNumber && totalPages)\n if (scrollPercentage > 0.85 && pageNumber < totalPages) {\n onPageNumberUpdate(pageNumber + 1);\n }\n }, 300);\n\n scrollElement.addEventListener('scroll', handleScroll);\n\n return () => {\n scrollElement.removeEventListener('scroll', handleScroll);\n };\n }\n }, [containerRef, pageNumber, totalPages, onPageNumberUpdate]);\n\n if (resourceItems.length === 0) {\n return isFilterAdded ? (\n <FlexView $height=\"100%\" $alignItems=\"center\" $justifyContent=\"center\">\n <SheetIcon opacity={0.38} />\n <Text $renderAs=\"ub1-bold\" $color=\"BLACK_T_38\">\n No sheets match the selected filters\n </Text>\n </FlexView>\n ) : (\n <NoResourceScreen />\n );\n }\n\n return (\n <>\n <Styled.ResourceItemWrapper
|
1
|
+
{"version":3,"file":"resource-items.js","sources":["../../../../../../src/features/milestone/milestone-resources/resources-assign/resource-items/resource-items.tsx"],"sourcesContent":["import type { IResourceItems } from './resource-items-types';\nimport type { FC } from 'react';\n\nimport debounce from 'lodash.debounce';\nimport { memo, useEffect, useMemo, useRef } from 'react';\n\nimport SheetIcon from '../../../../../assets/line-icons/icons/sheet';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport ResourceItem from '../comps/resource-item/resource-item';\nimport { RESOURCE_ASSIGN_ANALYTICS_EVENTS } from '../resource-assign-analytics-events';\nimport NoResourceScreen from './no-resource-screen';\nimport * as Styled from './resource-items-styled';\n\nconst ResourceItems: FC<IResourceItems> = memo(props => {\n const {\n pageNumber,\n totalPages,\n resourceItems,\n selectedResource,\n assigningInProgress,\n isFilterAdded,\n onResourceAdditionOrDeletion,\n onResourceAssign,\n onViewResource,\n onPageNumberUpdate,\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const analyticsProps = useMemo(\n () => ({\n node_ids: selectedResource.map(({ node_id: nodeId }) => nodeId),\n }),\n [selectedResource],\n );\n\n useEffect(() => {\n const scrollElement = containerRef.current;\n\n if (scrollElement) {\n const handleScroll = debounce(() => {\n const scrollPercentage = scrollElement\n ? scrollElement.scrollTop / (scrollElement.scrollHeight - scrollElement.clientHeight)\n : 0;\n\n if (pageNumber && totalPages)\n if (scrollPercentage > 0.85 && pageNumber < totalPages) {\n onPageNumberUpdate(pageNumber + 1);\n }\n }, 300);\n\n scrollElement.addEventListener('scroll', handleScroll);\n\n return () => {\n scrollElement.removeEventListener('scroll', handleScroll);\n };\n }\n }, [containerRef, pageNumber, totalPages, onPageNumberUpdate]);\n\n if (resourceItems.length === 0) {\n return isFilterAdded ? (\n <FlexView $height=\"100%\" $alignItems=\"center\" $justifyContent=\"center\">\n <SheetIcon opacity={0.38} />\n <Text $renderAs=\"ub1-bold\" $color=\"BLACK_T_38\">\n No sheets match the selected filters\n </Text>\n </FlexView>\n ) : (\n <Styled.ResourceItemWrapper $alignItems=\"center\" $justifyContent=\"center\" $overflowHidden>\n <NoResourceScreen />\n </Styled.ResourceItemWrapper>\n );\n }\n\n return (\n <>\n <Styled.ResourceItemWrapper $gapX={1.5} $gutterX={1.5} $flexGapX={1.125} ref={containerRef}>\n {resourceItems.map(item => {\n const { id, node_id: nodeId } = item;\n const selected = selectedResource.some(resource => resource.node_id === nodeId);\n\n return (\n <ResourceItem\n key={`${id}_${nodeId}`}\n resource={item}\n onResourceAdditionOrDeletion={onResourceAdditionOrDeletion}\n onViewResource={onViewResource}\n selected={selected}\n />\n );\n })}\n </Styled.ResourceItemWrapper>\n\n {selectedResource.length > 0 && (\n <Styled.ButtonWrapper\n $flexDirection=\"row\"\n $justifyContent=\"flex-end\"\n $gapX={1}\n $gutterX={1}\n >\n <Styled.StyledButton\n renderAs=\"primary\"\n label=\"Assign\"\n shape=\"square\"\n size=\"small\"\n widthX={8.5}\n analyticsLabel={RESOURCE_ASSIGN_ANALYTICS_EVENTS.RESOURCE_ASSIGNED}\n analyticsProps={analyticsProps}\n onClick={onResourceAssign}\n busy={assigningInProgress}\n />\n </Styled.ButtonWrapper>\n )}\n </>\n );\n});\n\nexport default ResourceItems;\n"],"names":["ResourceItems","memo","props","pageNumber","totalPages","resourceItems","selectedResource","assigningInProgress","isFilterAdded","onResourceAdditionOrDeletion","onResourceAssign","onViewResource","onPageNumberUpdate","containerRef","useRef","analyticsProps","useMemo","nodeId","useEffect","scrollElement","handleScroll","debounce","scrollPercentage","FlexView","jsx","SheetIcon","Text","Styled.ResourceItemWrapper","NoResourceScreen","jsxs","Fragment","item","id","selected","resource","ResourceItem","Styled.ButtonWrapper","Styled.StyledButton","RESOURCE_ASSIGN_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;AAcM,MAAAA,IAAoCC,EAAK,CAASC,MAAA;AAChD,QAAA;AAAA,IACJ,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,8BAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,EACE,IAAAV,GAEEW,IAAeC,EAAuB,IAAI,GAC1CC,IAAiBC;AAAA,IACrB,OAAO;AAAA,MACL,UAAUV,EAAiB,IAAI,CAAC,EAAE,SAASW,QAAaA,CAAM;AAAA,IAAA;AAAA,IAEhE,CAACX,CAAgB;AAAA,EAAA;AA0Bf,SAvBJY,EAAU,MAAM;AACd,UAAMC,IAAgBN,EAAa;AAEnC,QAAIM,GAAe;AACX,YAAAC,IAAeC,EAAS,MAAM;AAClC,cAAMC,IAAmBH,IACrBA,EAAc,aAAaA,EAAc,eAAeA,EAAc,gBACtE;AAEJ,QAAIhB,KAAcC,KACZkB,IAAmB,QAAQnB,IAAaC,KAC1CQ,EAAmBT,IAAa,CAAC;AAAA,SAEpC,GAAG;AAEQ,aAAAgB,EAAA,iBAAiB,UAAUC,CAAY,GAE9C,MAAM;AACG,QAAAD,EAAA,oBAAoB,UAAUC,CAAY;AAAA,MAAA;AAAA,IAE5D;AAAA,KACC,CAACP,GAAcV,GAAYC,GAAYQ,CAAkB,CAAC,GAEzDP,EAAc,WAAW,IACpBG,sBACJe,GAAS,EAAA,SAAQ,QAAO,aAAY,UAAS,iBAAgB,UAC5D,UAAA;AAAA,IAAC,gBAAAC,EAAAC,GAAA,EAAU,SAAS,KAAM,CAAA;AAAA,sBACzBC,GAAK,EAAA,WAAU,YAAW,QAAO,cAAa,UAE/C,wCAAA;AAAA,EAAA,EACF,CAAA,IAEA,gBAAAF,EAACG,GAAA,EAA2B,aAAY,UAAS,iBAAgB,UAAS,iBAAe,IACvF,UAAA,gBAAAH,EAACI,KAAiB,EACpB,CAAA,IAMA,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAN,EAACG,GAAA,EAA2B,OAAO,KAAK,UAAU,KAAK,WAAW,OAAO,KAAKd,GAC3E,UAAAR,EAAc,IAAI,CAAQ0B,MAAA;AACzB,YAAM,EAAE,IAAAC,GAAI,SAASf,EAAA,IAAWc,GAC1BE,IAAW3B,EAAiB,KAAK,CAAY4B,MAAAA,EAAS,YAAYjB,CAAM;AAG5E,aAAA,gBAAAO;AAAA,QAACW;AAAA,QAAA;AAAA,UAEC,UAAUJ;AAAA,UACV,8BAAAtB;AAAA,UACA,gBAAAE;AAAA,UACA,UAAAsB;AAAA,QAAA;AAAA,QAJK,GAAGD,CAAE,IAAIf,CAAM;AAAA,MAAA;AAAA,IAOzB,CAAA,GACH;AAAA,IAECX,EAAiB,SAAS,KACzB,gBAAAkB;AAAA,MAACY;AAAAA,MAAA;AAAA,QACC,gBAAe;AAAA,QACf,iBAAgB;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,QAEV,UAAA,gBAAAZ;AAAA,UAACa;AAAAA,UAAA;AAAA,YACC,UAAS;AAAA,YACT,OAAM;AAAA,YACN,OAAM;AAAA,YACN,MAAK;AAAA,YACL,QAAQ;AAAA,YACR,gBAAgBC,EAAiC;AAAA,YACjD,gBAAAvB;AAAA,YACA,SAASL;AAAA,YACT,MAAMH;AAAA,UAAA;AAAA,QACR;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,CAAC;"}
|
package/dist/features/milestone/milestone-resources/resources-assign/resources-assign-styled.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import r from "styled-components";
|
2
|
+
import t from "../../../ui/layout/flex-view.js";
|
3
3
|
import i from "../../../ui/text/text.js";
|
4
|
-
const a = t
|
4
|
+
const a = r(t)(({ theme: o, $noBorder: e }) => {
|
5
5
|
const { WHITE_5: s } = o.colors;
|
6
6
|
return `
|
7
7
|
${!e && `border-bottom: 1px solid ${s}`};
|
@@ -10,13 +10,14 @@ const a = t(r)(({ theme: o, $noBorder: e }) => {
|
|
10
10
|
width: calc(100% - 48px);
|
11
11
|
}
|
12
12
|
`;
|
13
|
-
}), c =
|
13
|
+
}), c = r.div(({ theme: o }) => `
|
14
14
|
position: absolute;
|
15
15
|
left: 0;
|
16
16
|
right: 0;
|
17
17
|
top: 0;
|
18
18
|
bottom: 0;
|
19
|
-
background: ${o.colors.
|
19
|
+
background: ${o.colors.WHITE_T_15};
|
20
|
+
backdrop-filter: blur(8px);
|
20
21
|
z-index: 2;
|
21
22
|
|
22
23
|
& * {
|
@@ -32,31 +33,31 @@ const a = t(r)(({ theme: o, $noBorder: e }) => {
|
|
32
33
|
height: ${o.layout.gutter * 5}px;
|
33
34
|
filter: brightness(0);
|
34
35
|
}
|
35
|
-
`), d =
|
36
|
+
`), d = r(i)`
|
36
37
|
position: absolute;
|
37
38
|
top: 72%;
|
38
39
|
left: 50%;
|
39
40
|
transform: translate(-50%, -50%);
|
40
|
-
`, u = t
|
41
|
+
`, u = r(t)(({ theme: o }) => `
|
41
42
|
overflow-y: auto;
|
42
43
|
border-right: 1px solid ${o.colors.WHITE_5};
|
43
|
-
`), b = t
|
44
|
+
`), b = r(t)`
|
44
45
|
overflow-y: auto;
|
45
|
-
`,
|
46
|
+
`, x = r(t)(({ theme: o, $selected: e }) => `
|
46
47
|
border-bottom-width: 1px;
|
47
48
|
border-bottom-style: solid;
|
48
49
|
border-bottom-color: ${e ? o.colors.BLACK : o.colors.WHITE_5};
|
49
50
|
cursor: pointer;
|
50
|
-
`),
|
51
|
+
`), f = r(t)(() => `
|
51
52
|
min-width: 20px;
|
52
53
|
`);
|
53
54
|
export {
|
54
55
|
b as FilterListWrapper,
|
55
|
-
|
56
|
+
x as FilterTabWrapper,
|
56
57
|
a as HeaderWrapper,
|
57
58
|
c as LoaderWrapper,
|
58
59
|
d as NoResourceText,
|
59
|
-
|
60
|
+
f as ResourceCountWrapper,
|
60
61
|
u as SearchContainer
|
61
62
|
};
|
62
63
|
//# sourceMappingURL=resources-assign-styled.js.map
|
package/dist/features/milestone/milestone-resources/resources-assign/resources-assign-styled.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resources-assign-styled.js","sources":["../../../../../src/features/milestone/milestone-resources/resources-assign/resources-assign-styled.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\n\ninterface IHeaderWrapper {\n $noBorder?: boolean;\n}\n\nconst HeaderWrapper = styled(FlexView)<IHeaderWrapper>(({ theme, $noBorder }) => {\n const { WHITE_5 } = theme.colors;\n\n return `\n ${!$noBorder && `border-bottom: 1px solid ${WHITE_5}`};\n\n & > div {\n width: calc(100% - 48px);\n }\n `;\n});\n\nconst LoaderWrapper = styled.div(({ theme }) => {\n return `\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n background: ${theme.colors.
|
1
|
+
{"version":3,"file":"resources-assign-styled.js","sources":["../../../../../src/features/milestone/milestone-resources/resources-assign/resources-assign-styled.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\n\ninterface IHeaderWrapper {\n $noBorder?: boolean;\n}\n\nconst HeaderWrapper = styled(FlexView)<IHeaderWrapper>(({ theme, $noBorder }) => {\n const { WHITE_5 } = theme.colors;\n\n return `\n ${!$noBorder && `border-bottom: 1px solid ${WHITE_5}`};\n\n & > div {\n width: calc(100% - 48px);\n }\n `;\n});\n\nconst LoaderWrapper = styled.div(({ theme }) => {\n return `\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n background: ${theme.colors.WHITE_T_15};\n backdrop-filter: blur(8px);\n z-index: 2;\n\n & * {\n pointer-events: none;\n }\n\n & img {\n top: 50%;\n position: absolute;\n left: 50%;\n transform: translate(-50%, -50%);\n width: ${theme.layout.gutter * 5}px;\n height: ${theme.layout.gutter * 5}px;\n filter: brightness(0);\n }\n `;\n});\n\nconst NoResourceText = styled(Text)`\n position: absolute;\n top: 72%;\n left: 50%;\n transform: translate(-50%, -50%);\n`;\n\nconst SearchContainer = styled(FlexView)(({ theme }) => {\n return `\n overflow-y: auto;\n border-right: 1px solid ${theme.colors.WHITE_5};\n `;\n});\n\nconst FilterListWrapper = styled(FlexView)`\n overflow-y: auto;\n`;\n\ninterface IFilterTabWrapper {\n $selected: boolean;\n}\n\nconst FilterTabWrapper = styled(FlexView)<IFilterTabWrapper>(({ theme, $selected }) => {\n return `\n border-bottom-width: 1px;\n border-bottom-style: solid;\n border-bottom-color: ${$selected ? theme.colors.BLACK : theme.colors.WHITE_5};\n cursor: pointer;\n `;\n});\n\nconst ResourceCountWrapper = styled(FlexView)(() => {\n return `\n min-width: 20px;\n `;\n});\n\nexport {\n FilterListWrapper,\n FilterTabWrapper,\n HeaderWrapper,\n LoaderWrapper,\n NoResourceText,\n ResourceCountWrapper,\n SearchContainer,\n};\n"],"names":["HeaderWrapper","styled","FlexView","theme","$noBorder","WHITE_5","LoaderWrapper","NoResourceText","Text","SearchContainer","FilterListWrapper","FilterTabWrapper","$selected","ResourceCountWrapper"],"mappings":";;;AASM,MAAAA,IAAgBC,EAAOC,CAAQ,EAAkB,CAAC,EAAE,OAAAC,GAAO,WAAAC,QAAgB;AACzE,QAAA,EAAE,SAAAC,EAAQ,IAAIF,EAAM;AAEnB,SAAA;AAAA,MACH,CAACC,KAAa,4BAA4BC,CAAO,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAMzD,CAAC,GAEKC,IAAgBL,EAAO,IAAI,CAAC,EAAE,OAAAE,QAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAMWA,EAAM,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAa1BA,EAAM,OAAO,SAAS,CAAC;AAAA,kBACtBA,EAAM,OAAO,SAAS,CAAC;AAAA;AAAA;AAAA,KAIxC,GAEKI,IAAiBN,EAAOO,CAAI;AAAA;AAAA;AAAA;AAAA;AAAA,GAO5BC,IAAkBR,EAAOC,CAAQ,EAAE,CAAC,EAAE,OAAAC,QACnC;AAAA;AAAA,8BAEqBA,EAAM,OAAO,OAAO;AAAA,GAEjD,GAEKO,IAAoBT,EAAOC,CAAQ;AAAA;AAAA,GAQnCS,IAAmBV,EAAOC,CAAQ,EAAqB,CAAC,EAAE,OAAAC,GAAO,WAAAS,QAC9D;AAAA;AAAA;AAAA,2BAGkBA,IAAYT,EAAM,OAAO,QAAQA,EAAM,OAAO,OAAO;AAAA;AAAA,GAG/E,GAEKU,IAAuBZ,EAAOC,CAAQ,EAAE,MACrC;AAAA;AAAA,GAGR;"}
|
@@ -1,189 +1,232 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import { useUIContext as
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import
|
16
|
-
import
|
17
|
-
import {
|
18
|
-
|
1
|
+
import { jsx as t, jsxs as _ } from "react/jsx-runtime";
|
2
|
+
import { h as ie } from "../../../../node_modules/humanize-plus/dist/humanize.js";
|
3
|
+
import { memo as ce, useState as o, useRef as le, useCallback as g, useEffect as z, useMemo as M } from "react";
|
4
|
+
import ue from "../../../../assets/line-icons/icons/back2.js";
|
5
|
+
import de from "../../../ui/buttons/button/button.js";
|
6
|
+
import { useUIContext as he } from "../../../ui/context/context.js";
|
7
|
+
import me from "../../../ui/inputs/searchable-input/searchable-input.js";
|
8
|
+
import f from "../../../ui/layout/flex-view.js";
|
9
|
+
import pe from "../../../ui/loader/app-loader/app-loader.js";
|
10
|
+
import ge from "../../../ui/text/text.js";
|
11
|
+
import fe from "./added-resource-and-filters.js";
|
12
|
+
import { getResourceSearchAPI as Re } from "./api/get-resource.js";
|
13
|
+
import { usePostMilestoneResource as Ae } from "./api/goal-resource-assign.js";
|
14
|
+
import { usePostLPARResource as _e } from "./api/lpar-resource-assign.js";
|
15
|
+
import { RESOURCE_ASSIGN_ANALYTICS_EVENTS as Se } from "./resource-assign-analytics-events.js";
|
16
|
+
import Ie from "./resource-items/resource-items.js";
|
17
|
+
import { SearchContainer as Ce, HeaderWrapper as Ee, LoaderWrapper as Pe } from "./resources-assign-styled.js";
|
18
|
+
import { checkIfFiltersAreAdded as N, getCanShowDefaultLoadingScreen as $e } from "./utils.js";
|
19
|
+
const ye = ce((G) => {
|
19
20
|
const {
|
20
|
-
studentId:
|
21
|
-
stream:
|
22
|
-
onResourceAssign:
|
23
|
-
onError:
|
24
|
-
onExitResourceAssign:
|
25
|
-
onViewResource:
|
26
|
-
userMilestoneId:
|
27
|
-
programId:
|
28
|
-
} =
|
29
|
-
stream:
|
30
|
-
page:
|
21
|
+
studentId: l,
|
22
|
+
stream: w,
|
23
|
+
onResourceAssign: x,
|
24
|
+
onError: R,
|
25
|
+
onExitResourceAssign: H,
|
26
|
+
onViewResource: v,
|
27
|
+
userMilestoneId: u,
|
28
|
+
programId: d
|
29
|
+
} = G, { onEvent: D } = he(), [h, F] = o(1), [A, L] = o(""), [Q, O] = o(""), [i, S] = o({
|
30
|
+
stream: w,
|
31
|
+
page: h,
|
31
32
|
per_page: 50,
|
32
|
-
user_id:
|
33
|
-
user_milestone_id:
|
34
|
-
program_id:
|
35
|
-
}), [
|
33
|
+
user_id: l,
|
34
|
+
user_milestone_id: u,
|
35
|
+
program_id: d
|
36
|
+
}), [I, W] = o([]), [a, T] = o([]), [m, X] = o(), [C, E] = o(!1), [q, P] = o(!1), [$, B] = o({
|
37
|
+
boards: [],
|
38
|
+
grades: [],
|
39
|
+
node_types: []
|
40
|
+
}), c = le(null), k = g(
|
36
41
|
(e) => {
|
37
|
-
|
42
|
+
if (e)
|
43
|
+
R(e);
|
44
|
+
else {
|
45
|
+
const r = `${ie.pluralize(a.length, "Resource")} ${a.length > 1 ? "have" : "has"} been assigned`;
|
46
|
+
x(r);
|
47
|
+
}
|
38
48
|
},
|
39
|
-
[
|
40
|
-
), {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
onComplete: $
|
49
|
-
}), H = (e) => {
|
50
|
-
P((s) => ({ ...s, ...e }));
|
51
|
-
}, T = l(
|
52
|
-
(e, s) => {
|
49
|
+
[R, x, a]
|
50
|
+
), { post: U, isProcessing: Y } = Ae({
|
51
|
+
onComplete: k
|
52
|
+
}), { post: V, isProcessing: J } = _e({
|
53
|
+
onComplete: k
|
54
|
+
}), K = (e) => {
|
55
|
+
S((r) => ({ ...r, ...e }));
|
56
|
+
}, j = g(
|
57
|
+
(e, r) => {
|
53
58
|
if (e === "select") {
|
54
|
-
const
|
55
|
-
|
59
|
+
const s = I.find((n) => n.node_id === r);
|
60
|
+
s && T((n) => [...n, s]);
|
56
61
|
} else
|
57
|
-
|
58
|
-
(
|
62
|
+
T(
|
63
|
+
(s) => s.filter((n) => n.node_id !== r)
|
59
64
|
);
|
60
65
|
},
|
61
|
-
[
|
62
|
-
),
|
63
|
-
|
64
|
-
|
65
|
-
page: e
|
66
|
-
}), D(e);
|
67
|
-
}, W = (e) => {
|
68
|
-
N(e);
|
69
|
-
}, X = l(
|
66
|
+
[I]
|
67
|
+
), Z = (e) => {
|
68
|
+
L(e);
|
69
|
+
}, ee = g(
|
70
70
|
(e) => {
|
71
|
-
|
72
|
-
search_term:
|
73
|
-
}),
|
74
|
-
...
|
75
|
-
search_term: e ? "" :
|
71
|
+
D(Se.RESOURCE_SEARCH_INPUT_VALUE, {
|
72
|
+
search_term: A
|
73
|
+
}), S((r) => ({
|
74
|
+
...r,
|
75
|
+
search_term: e ? "" : A
|
76
76
|
}));
|
77
77
|
},
|
78
|
-
[
|
79
|
-
),
|
80
|
-
(
|
81
|
-
|
82
|
-
|
78
|
+
[A, D]
|
79
|
+
), y = g(
|
80
|
+
async (e) => {
|
81
|
+
if (e || F(1), E(!0), N(i) || i.stream) {
|
82
|
+
c.current && c.current.abort();
|
83
|
+
const r = new AbortController();
|
84
|
+
c.current = r, await Re({
|
85
|
+
id: l,
|
86
|
+
query: e ? { ...i, page: e } : i,
|
87
|
+
meta: null,
|
88
|
+
abortSignal: c.current.signal
|
89
|
+
}).then((s) => {
|
90
|
+
if (s) {
|
91
|
+
const { __CODE__: n, __ERROR__: b, isProcessingFailed: ae } = s;
|
92
|
+
if (n >= 400 && n < 500)
|
93
|
+
R((b == null ? void 0 : b.message) ?? "Error while fetching the resource");
|
94
|
+
else if (n === 500)
|
95
|
+
P(ae), O("Internal server error, Please try again");
|
96
|
+
else {
|
97
|
+
const { data: p } = s || {};
|
98
|
+
p && (B({
|
99
|
+
boards: p.filters.boards,
|
100
|
+
grades: p.filters.grades,
|
101
|
+
node_types: p.filters.node_types
|
102
|
+
}), X(p), E(!1));
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}).catch(() => {
|
106
|
+
E(!1), P(!0);
|
107
|
+
});
|
108
|
+
}
|
109
|
+
},
|
110
|
+
[l, i, c, R]
|
111
|
+
), re = (e) => {
|
112
|
+
y(e), F(e);
|
113
|
+
}, se = () => {
|
114
|
+
P(!1), O(""), L(""), S({
|
115
|
+
stream: w,
|
116
|
+
page: h,
|
117
|
+
per_page: 50,
|
118
|
+
user_id: l,
|
119
|
+
user_milestone_id: u,
|
120
|
+
program_id: d
|
121
|
+
});
|
122
|
+
}, te = g(() => {
|
123
|
+
u ? U(
|
83
124
|
{
|
84
|
-
node_ids:
|
125
|
+
node_ids: a.map((e) => e.node_id)
|
85
126
|
},
|
86
|
-
{ userMilestoneId:
|
87
|
-
) :
|
127
|
+
{ userMilestoneId: u }
|
128
|
+
) : d && V(
|
88
129
|
{
|
89
|
-
nodes:
|
130
|
+
nodes: a.map(({ node_id: e }) => ({
|
90
131
|
id: e,
|
91
132
|
attempt_location: "ANY"
|
92
133
|
})),
|
93
|
-
program_id:
|
134
|
+
program_id: d
|
94
135
|
},
|
95
|
-
{ studentId:
|
136
|
+
{ studentId: l }
|
96
137
|
);
|
97
138
|
}, [
|
98
|
-
|
139
|
+
U,
|
140
|
+
u,
|
141
|
+
a,
|
142
|
+
V,
|
99
143
|
d,
|
100
|
-
|
101
|
-
O,
|
102
|
-
m,
|
103
|
-
h
|
144
|
+
l
|
104
145
|
]);
|
105
|
-
|
106
|
-
|
107
|
-
}, [
|
108
|
-
|
109
|
-
const
|
110
|
-
return Array.from(new Map(
|
146
|
+
z(() => (y(), () => {
|
147
|
+
c.current && c.current.abort();
|
148
|
+
}), [y]), z(() => {
|
149
|
+
m && W((e) => {
|
150
|
+
const r = h !== 1 ? [...e, ...m.results] : m.results;
|
151
|
+
return Array.from(new Map(r.map((s) => [s.id, s])).values());
|
111
152
|
});
|
112
|
-
}, [
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
153
|
+
}, [m, h]);
|
154
|
+
const { total_pages: oe = 0 } = m || {}, ne = M(() => N(i), [i]);
|
155
|
+
return M(
|
156
|
+
() => $e(C, $),
|
157
|
+
[C, $]
|
158
|
+
) ? /* @__PURE__ */ t(pe, { height: "100vh" }) : q ? /* @__PURE__ */ t(f, { $height: "100vh", $alignItems: "center", $justifyContent: "center", children: /* @__PURE__ */ _(f, { $flexGapX: 1.5, $alignItems: "center", $justifyContent: "center", children: [
|
159
|
+
/* @__PURE__ */ t(ge, { $renderAs: "h6", children: Q || "Oops! Something went wrong. Please try again later." }),
|
160
|
+
/* @__PURE__ */ t(
|
161
|
+
de,
|
162
|
+
{
|
163
|
+
widthX: 14,
|
164
|
+
size: "small",
|
165
|
+
shape: "square",
|
166
|
+
renderAs: "primary",
|
167
|
+
label: "Try again",
|
168
|
+
analyticsLabel: "resource_get_api_failed",
|
169
|
+
onClick: se
|
170
|
+
}
|
171
|
+
)
|
172
|
+
] }) }) : /* @__PURE__ */ _(f, { $flexDirection: "row", $height: "100vh", children: [
|
173
|
+
/* @__PURE__ */ _(Ce, { $width: "60%", children: [
|
174
|
+
/* @__PURE__ */ t(
|
175
|
+
Ee,
|
134
176
|
{
|
135
177
|
$heightX: 4,
|
136
178
|
$background: "WHITE_3",
|
137
179
|
$alignItems: "center",
|
138
180
|
$justifyContent: "center",
|
139
|
-
children: /* @__PURE__ */
|
140
|
-
|
181
|
+
children: /* @__PURE__ */ t(
|
182
|
+
me,
|
141
183
|
{
|
142
|
-
value:
|
143
|
-
onSearchTextChange:
|
184
|
+
value: A,
|
185
|
+
onSearchTextChange: Z,
|
144
186
|
renderAs: "primary",
|
145
187
|
width: "99%",
|
146
188
|
size: "regular",
|
147
189
|
label: "Type topic name...",
|
148
|
-
onEnter:
|
190
|
+
onEnter: ee,
|
149
191
|
searchOnClear: !0,
|
150
|
-
onPrefixElementClick:
|
151
|
-
prefixElement: /* @__PURE__ */
|
192
|
+
onPrefixElementClick: H,
|
193
|
+
prefixElement: /* @__PURE__ */ t(ue, {})
|
152
194
|
}
|
153
195
|
)
|
154
196
|
}
|
155
197
|
),
|
156
|
-
/* @__PURE__ */
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
198
|
+
/* @__PURE__ */ _(f, { $height: "calc(100vh - 64px)", $position: "relative", children: [
|
199
|
+
C && /* @__PURE__ */ t(Pe, {}),
|
200
|
+
/* @__PURE__ */ t(
|
201
|
+
Ie,
|
202
|
+
{
|
203
|
+
resourceItems: I,
|
204
|
+
selectedResource: a,
|
205
|
+
pageNumber: h,
|
206
|
+
totalPages: oe,
|
207
|
+
assigningInProgress: Y || J,
|
208
|
+
isFilterAdded: ne,
|
209
|
+
onResourceAdditionOrDeletion: j,
|
210
|
+
onResourceAssign: te,
|
211
|
+
onViewResource: v,
|
212
|
+
onPageNumberUpdate: re
|
213
|
+
}
|
214
|
+
)
|
215
|
+
] })
|
171
216
|
] }),
|
172
|
-
/* @__PURE__ */
|
173
|
-
|
217
|
+
/* @__PURE__ */ t(f, { $width: "40%", children: /* @__PURE__ */ t(
|
218
|
+
fe,
|
174
219
|
{
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
onFilterUpdate: H,
|
181
|
-
onViewResource: E
|
220
|
+
resourceFilters: $,
|
221
|
+
selectedResources: a,
|
222
|
+
onResourceDeSelection: j,
|
223
|
+
onFilterUpdate: K,
|
224
|
+
onViewResource: v
|
182
225
|
}
|
183
226
|
) })
|
184
227
|
] });
|
185
|
-
}),
|
228
|
+
}), We = ye;
|
186
229
|
export {
|
187
|
-
|
230
|
+
We as default
|
188
231
|
};
|
189
232
|
//# sourceMappingURL=resources-assign.js.map
|