@edifice.io/collect-frontend 0.2.0 → 0.2.2-develop-pedago.2
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/lib/AppHeaderCollection-Bglbw6q9.js +188 -0
- package/lib/CXEL7IU7-DVs75C4a.js +42 -0
- package/lib/Collection-DYHQunUI.js +463 -0
- package/lib/CollectionsLayout-CPYEwl1X.js +361 -0
- package/lib/CollectionsList-Inb9z2nB.js +315 -0
- package/lib/DeleteCollectionModal-Dzsn2899.js +112 -0
- package/lib/DropdownActionTable-BLHrdk4t.js +83 -0
- package/lib/FormEdit-CwVhj3_4.js +96 -0
- package/lib/HASRA6WW-qb64R1U-.js +9093 -0
- package/lib/I3HPI4QX-DhV4n2OZ.js +33 -0
- package/lib/MathsModal-D8rTl0Sb.js +42 -0
- package/lib/MembersEdit-DDj8IWMX.js +72 -0
- package/lib/Root-DbGwe5v1.js +13 -0
- package/lib/SearchBarCollect-BAnLCwAC.js +21 -0
- package/lib/Submission-DUcQiBve.js +249 -0
- package/lib/SubmissionList-DjQ0x7eD.js +695 -0
- package/lib/emptyscreen-list-collection-CWGxO4Ss.js +4 -0
- package/lib/heic-to-DuZ6uPPi.js +72 -0
- package/lib/index-Dt9ykSDF.js +171658 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +45 -0
- package/lib/style.css +1 -0
- package/lib/submission.queries-CslqTzEP.js +83 -0
- package/lib/useGetStatusSubmission-D77F1XUy.js +55 -0
- package/package.json +4 -3
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { j as s, u, d as p, F as c, B as r, I as x, t as g, k as v, l as j, ax as C, ay as S, n as f, q as w, az as I, s as y } from "./index-Dt9ykSDF.js";
|
|
2
|
+
import { u as b, D as L } from "./DropdownActionTable-BLHrdk4t.js";
|
|
3
|
+
const M = ({
|
|
4
|
+
title: n,
|
|
5
|
+
titleId: i,
|
|
6
|
+
...e
|
|
7
|
+
}) => /* @__PURE__ */ s.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", "aria-labelledby": i, ...e, children: [
|
|
8
|
+
n ? /* @__PURE__ */ s.jsx("title", { id: i, children: n }) : null,
|
|
9
|
+
/* @__PURE__ */ s.jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M17 2a1 1 0 1 0-2 0v1H9V2a1 1 0 0 0-2 0v1H5a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3h-2zm3 7V6a1 1 0 0 0-1-1h-2v1a1 1 0 1 1-2 0V5H9v1a1 1 0 0 1-2 0V5H5a1 1 0 0 0-1 1v3zM4 11h16v9a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z", clipRule: "evenodd" })
|
|
10
|
+
] }), O = ({
|
|
11
|
+
title: n,
|
|
12
|
+
titleId: i,
|
|
13
|
+
...e
|
|
14
|
+
}) => /* @__PURE__ */ s.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", "aria-labelledby": i, ...e, children: [
|
|
15
|
+
n ? /* @__PURE__ */ s.jsx("title", { id: i, children: n }) : null,
|
|
16
|
+
/* @__PURE__ */ s.jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M15.207 3.293a1 1 0 0 0-1.59 1.176l-3.17 3.17-3.798 1.425a1 1 0 0 0-.356.229l-1.5 1.5a1 1 0 0 0 0 1.414L7.586 15l-3.793 3.793a1 1 0 1 0 1.414 1.414L9 16.414l2.793 2.793a1 1 0 0 0 1.414 0l1.5-1.5a1 1 0 0 0 .23-.356l1.423-3.797 3.17-3.17a1 1 0 0 0 1.177-1.591l-.5-.5-4.5-4.5zM15 5.914l-3.293 3.293a1 1 0 0 1-.356.23L7.554 10.86l-.64.64 2.793 2.793 2.793 2.793.64-.64 1.424-3.797a1 1 0 0 1 .229-.356L18.086 9z", clipRule: "evenodd" })
|
|
17
|
+
] }), H = ({
|
|
18
|
+
title: n,
|
|
19
|
+
titleId: i,
|
|
20
|
+
...e
|
|
21
|
+
}) => /* @__PURE__ */ s.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", "aria-labelledby": i, ...e, children: [
|
|
22
|
+
n ? /* @__PURE__ */ s.jsx("title", { id: i, children: n }) : null,
|
|
23
|
+
/* @__PURE__ */ s.jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M20.604 3.159a.91.91 0 0 1 .345 1.05l-6.364 18.182a.909.909 0 0 1-1.689.07l-3.494-7.863-7.862-3.495a.91.91 0 0 1 .069-1.688l18.158-6.356a.91.91 0 0 1 .837.1M11.175 14.11l6.742-6.742-4.29 12.258zM9.89 12.825l-5.515-2.452 12.257-4.29z", clipRule: "evenodd" })
|
|
24
|
+
] }), N = ({
|
|
25
|
+
collection: n
|
|
26
|
+
}) => {
|
|
27
|
+
const { appCode: i } = u(), { t: e } = p(i), t = b.use.onOpenInstructionModal();
|
|
28
|
+
return /* @__PURE__ */ s.jsxs(c, { gap: "16", justify: "end", children: [
|
|
29
|
+
/* @__PURE__ */ s.jsx(
|
|
30
|
+
r,
|
|
31
|
+
{
|
|
32
|
+
"data-testid": "collect-collection-actions-button-instruction",
|
|
33
|
+
variant: "outline",
|
|
34
|
+
color: "primary",
|
|
35
|
+
leftIcon: /* @__PURE__ */ s.jsx(O, {}),
|
|
36
|
+
onClick: t,
|
|
37
|
+
children: e("collection.appHeaderCollection.collection.button.instruction")
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ s.jsx(L, { collectionId: n.id, isCollection: !0, children: (l) => /* @__PURE__ */ s.jsx(
|
|
41
|
+
x,
|
|
42
|
+
{
|
|
43
|
+
...l,
|
|
44
|
+
className: "icon-button-hover-no-transition bg-white",
|
|
45
|
+
type: "button",
|
|
46
|
+
"aria-label": "label",
|
|
47
|
+
"data-testid": "collect-collection-actions-button-options",
|
|
48
|
+
color: "primary",
|
|
49
|
+
variant: "outline",
|
|
50
|
+
icon: /* @__PURE__ */ s.jsx(g, {})
|
|
51
|
+
}
|
|
52
|
+
) })
|
|
53
|
+
] });
|
|
54
|
+
}, B = j((n) => ({
|
|
55
|
+
submissionId: null,
|
|
56
|
+
submissionContent: "",
|
|
57
|
+
isUpdateSubmissionModalOpen: !1,
|
|
58
|
+
submissionHasContent: !1,
|
|
59
|
+
submissionIsLoading: !1,
|
|
60
|
+
onOpenUpdateSubmissionModal: () => n({ isUpdateSubmissionModalOpen: !0 }),
|
|
61
|
+
onCloseUpdateSubmissionModal: () => n({ isUpdateSubmissionModalOpen: !1 }),
|
|
62
|
+
setSubmissionData: (i, e) => n({ submissionContent: i, submissionHasContent: e }),
|
|
63
|
+
setSubmissionIsLoading: (i) => n({ submissionIsLoading: i }),
|
|
64
|
+
hydrateSubmissionContent: (i) => n((e) => e.submissionId === i.id ? e : {
|
|
65
|
+
submissionId: i.id,
|
|
66
|
+
submissionContent: i.content || ""
|
|
67
|
+
})
|
|
68
|
+
})), A = v(
|
|
69
|
+
B
|
|
70
|
+
), z = ({
|
|
71
|
+
handleUpdateSubmission: n
|
|
72
|
+
}) => {
|
|
73
|
+
const { appCode: i } = u(), { t: e } = p(i), t = b.use.isPastDeadline(), {
|
|
74
|
+
submissionHasContent: l,
|
|
75
|
+
submissionIsLoading: d,
|
|
76
|
+
onOpenUpdateSubmissionModal: a
|
|
77
|
+
} = A((o) => ({
|
|
78
|
+
onOpenUpdateSubmissionModal: o.onOpenUpdateSubmissionModal,
|
|
79
|
+
submissionHasContent: o.submissionHasContent,
|
|
80
|
+
submissionIsLoading: o.submissionIsLoading
|
|
81
|
+
}));
|
|
82
|
+
return /* @__PURE__ */ s.jsxs(c, { gap: "16", justify: "end", children: [
|
|
83
|
+
/* @__PURE__ */ s.jsx(
|
|
84
|
+
r,
|
|
85
|
+
{
|
|
86
|
+
"data-testid": "collect-submission-app-header-actions-draft-button",
|
|
87
|
+
variant: "outline",
|
|
88
|
+
color: "primary",
|
|
89
|
+
leftIcon: /* @__PURE__ */ s.jsx(S, {}),
|
|
90
|
+
disabled: t,
|
|
91
|
+
isLoading: d,
|
|
92
|
+
onClick: () => n == null ? void 0 : n({
|
|
93
|
+
status: C.DRAFT
|
|
94
|
+
}),
|
|
95
|
+
children: e("collection.appHeaderSubmission.submission.button.draft")
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ s.jsx(
|
|
99
|
+
r,
|
|
100
|
+
{
|
|
101
|
+
"data-testid": "collect-submission-app-header-actions-send-button",
|
|
102
|
+
variant: "filled",
|
|
103
|
+
color: "primary",
|
|
104
|
+
leftIcon: /* @__PURE__ */ s.jsx(H, {}),
|
|
105
|
+
disabled: t || !l,
|
|
106
|
+
onClick: () => a(),
|
|
107
|
+
children: e("collection.appHeaderSubmission.submission.button.send")
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
] });
|
|
111
|
+
};
|
|
112
|
+
var m = /* @__PURE__ */ ((n) => (n.COLLECTION = "COLLECTION", n.SUBMISSION = "SUBMISSION", n))(m || {});
|
|
113
|
+
const R = ({
|
|
114
|
+
collection: n,
|
|
115
|
+
onClickBack: i,
|
|
116
|
+
context: e,
|
|
117
|
+
handleUpdateSubmission: t
|
|
118
|
+
}) => {
|
|
119
|
+
const { appCode: l } = u(), { t: d } = p(l), { lg: a, md: o } = f(), { formatDate: h } = w();
|
|
120
|
+
return /* @__PURE__ */ s.jsxs("div", { className: `py-16 border-bottom bg-white ${o ? "px-48" : "px-16"}`, children: [
|
|
121
|
+
/* @__PURE__ */ s.jsx(c, { align: "center", gap: "8", children: /* @__PURE__ */ s.jsx(
|
|
122
|
+
r,
|
|
123
|
+
{
|
|
124
|
+
"data-testid": "collect-submission-app-header-button-back",
|
|
125
|
+
className: "text-gray-700",
|
|
126
|
+
color: "tertiary",
|
|
127
|
+
leftIcon: /* @__PURE__ */ s.jsx(I, { width: 20, height: 20 }),
|
|
128
|
+
type: "button",
|
|
129
|
+
variant: "ghost",
|
|
130
|
+
size: "sm",
|
|
131
|
+
onClick: i,
|
|
132
|
+
children: d("collection.back")
|
|
133
|
+
}
|
|
134
|
+
) }),
|
|
135
|
+
/* @__PURE__ */ s.jsxs(
|
|
136
|
+
c,
|
|
137
|
+
{
|
|
138
|
+
className: "w-100 mt-24",
|
|
139
|
+
justify: "between",
|
|
140
|
+
align: a ? "center" : "end",
|
|
141
|
+
gap: "12",
|
|
142
|
+
direction: a ? "row" : "column",
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ s.jsxs(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
className: `${o && "d-flex"} ${!a && "w-100"}`,
|
|
148
|
+
style: { maxWidth: a ? "70%" : "100%" },
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ s.jsx(
|
|
151
|
+
"h2",
|
|
152
|
+
{
|
|
153
|
+
className: `text-truncate ${o ? "me-12" : "mb-12 text-truncate-2"}`,
|
|
154
|
+
children: n.name
|
|
155
|
+
}
|
|
156
|
+
),
|
|
157
|
+
/* @__PURE__ */ s.jsx(
|
|
158
|
+
y,
|
|
159
|
+
{
|
|
160
|
+
className: "lh-base",
|
|
161
|
+
style: { height: "3rem" },
|
|
162
|
+
variant: {
|
|
163
|
+
level: "info",
|
|
164
|
+
type: "notification"
|
|
165
|
+
},
|
|
166
|
+
children: /* @__PURE__ */ s.jsxs(c, { align: "center", gap: "8", children: [
|
|
167
|
+
/* @__PURE__ */ s.jsx(M, { height: 20, width: 20 }),
|
|
168
|
+
`${d("collection.appHeaderCollection.deadline")} ${h(n.deadline)}`
|
|
169
|
+
] })
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
e === m.COLLECTION ? /* @__PURE__ */ s.jsx(N, { collection: n }) : /* @__PURE__ */ s.jsx(z, { handleUpdateSubmission: t })
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
] });
|
|
180
|
+
};
|
|
181
|
+
export {
|
|
182
|
+
R as A,
|
|
183
|
+
m as C,
|
|
184
|
+
M as S,
|
|
185
|
+
O as a,
|
|
186
|
+
H as b,
|
|
187
|
+
A as u
|
|
188
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./HASRA6WW-qb64R1U-.js";
|
|
2
|
+
import { aP as v, aQ as C, aR as e } from "./index-Dt9ykSDF.js";
|
|
3
|
+
var h = (t) => {
|
|
4
|
+
const [r, o] = s({
|
|
5
|
+
prefix: "TanstackQueryDevtools"
|
|
6
|
+
}), a = v(), l = C(() => {
|
|
7
|
+
const n = r.theme_preference || c;
|
|
8
|
+
return n !== "system" ? n : a();
|
|
9
|
+
});
|
|
10
|
+
return e(d.Provider, {
|
|
11
|
+
value: t,
|
|
12
|
+
get children() {
|
|
13
|
+
return e(u, {
|
|
14
|
+
disabled: !0,
|
|
15
|
+
localStore: r,
|
|
16
|
+
setLocalStore: o,
|
|
17
|
+
get children() {
|
|
18
|
+
return e(i.Provider, {
|
|
19
|
+
value: l,
|
|
20
|
+
get children() {
|
|
21
|
+
return e(m, {
|
|
22
|
+
get children() {
|
|
23
|
+
return e(P, {
|
|
24
|
+
localStore: r,
|
|
25
|
+
setLocalStore: o,
|
|
26
|
+
get onClose() {
|
|
27
|
+
return t.onClose;
|
|
28
|
+
},
|
|
29
|
+
showPanelViewOnly: !0
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}, p = h;
|
|
40
|
+
export {
|
|
41
|
+
p as default
|
|
42
|
+
};
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import { r as b, k as W, l as V, j as s, F as d, ad as B, s as N, ae as R, u as v, d as E, aj as Q, H as M, B as I, ag as P, L, h as O, ak as y, al as $, am as G, D as f, n as A, ab as j, q as z, an as _, E as q, ao as K, ap as k, aq as Y, G as w, ar as J, a as X, W as Z, as as ss, P as es, at as ts } from "./index-Dt9ykSDF.js";
|
|
2
|
+
import { S as ns, A as is, C as as } from "./AppHeaderCollection-Bglbw6q9.js";
|
|
3
|
+
import { T as C, D as os } from "./DeleteCollectionModal-Dzsn2899.js";
|
|
4
|
+
import { u as cs, a as ls, s as rs } from "./submission.queries-CslqTzEP.js";
|
|
5
|
+
import { u as F } from "./useGetStatusSubmission-D77F1XUy.js";
|
|
6
|
+
import { u as D } from "./DropdownActionTable-BLHrdk4t.js";
|
|
7
|
+
import { E as ds } from "./emptyscreen-list-collection-CWGxO4Ss.js";
|
|
8
|
+
const U = (e) => {
|
|
9
|
+
var m;
|
|
10
|
+
const { data: a, isLoading: t, fetchNextPage: l, hasNextPage: c } = cs(e == null ? void 0 : e.id), [o, x] = b.useState(
|
|
11
|
+
null
|
|
12
|
+
), i = (n) => o === n.id, g = (n) => o === n.id ? "bg-gray-300" : "";
|
|
13
|
+
return {
|
|
14
|
+
submissions: ((m = a == null ? void 0 : a.pages) == null ? void 0 : m.flatMap((n) => n.items)) ?? [],
|
|
15
|
+
isLoading: t,
|
|
16
|
+
hasNextPage: c,
|
|
17
|
+
isHovered: i,
|
|
18
|
+
setHoveredSubmissionId: x,
|
|
19
|
+
getBgColor: g,
|
|
20
|
+
fetchNextPage: l
|
|
21
|
+
};
|
|
22
|
+
}, us = V((e) => ({
|
|
23
|
+
selectedSubmissionListMenu: null,
|
|
24
|
+
setSelectedSubmissionListMenu: (a) => e({ selectedSubmissionListMenu: a })
|
|
25
|
+
})), T = W(
|
|
26
|
+
us
|
|
27
|
+
), H = ({
|
|
28
|
+
submission: e
|
|
29
|
+
}) => {
|
|
30
|
+
const { getAvatarURL: a } = R(), { getSubmissionStatus: t } = F(), l = D.use.isPastDeadline(), c = t({
|
|
31
|
+
status: e.status,
|
|
32
|
+
isPastDeadline: l
|
|
33
|
+
}), o = a(e.createdBy.entId, "user");
|
|
34
|
+
return /* @__PURE__ */ s.jsxs(d, { justify: "between", align: "center", className: "w-100", gap: "8", children: [
|
|
35
|
+
/* @__PURE__ */ s.jsxs(d, { align: "center", gap: "12", style: { minWidth: 0 }, children: [
|
|
36
|
+
/* @__PURE__ */ s.jsx(
|
|
37
|
+
B,
|
|
38
|
+
{
|
|
39
|
+
alt: e.createdBy.displayName,
|
|
40
|
+
size: "xs",
|
|
41
|
+
src: o,
|
|
42
|
+
variant: "circle"
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ s.jsx("p", { className: "text-truncate", children: e.createdBy.displayName })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ s.jsx(N, { variant: c.variant, children: c.text })
|
|
48
|
+
] });
|
|
49
|
+
}, ms = ({
|
|
50
|
+
collection: e
|
|
51
|
+
}) => {
|
|
52
|
+
const { appCode: a } = v(), { t } = E(a), {
|
|
53
|
+
setHoveredSubmissionId: l,
|
|
54
|
+
getBgColor: c,
|
|
55
|
+
submissions: o,
|
|
56
|
+
fetchNextPage: x,
|
|
57
|
+
hasNextPage: i,
|
|
58
|
+
isLoading: g
|
|
59
|
+
} = U(e), { setSelectedSubmissionListMenu: m, selectedSubmissionListMenu: n } = T();
|
|
60
|
+
b.useEffect(() => {
|
|
61
|
+
if (o.length === 0)
|
|
62
|
+
return;
|
|
63
|
+
o.some(
|
|
64
|
+
(h) => h.id === (n == null ? void 0 : n.id)
|
|
65
|
+
) || m(o[0]);
|
|
66
|
+
}, [
|
|
67
|
+
n == null ? void 0 : n.id,
|
|
68
|
+
m,
|
|
69
|
+
o
|
|
70
|
+
]);
|
|
71
|
+
const p = (u) => {
|
|
72
|
+
m(u);
|
|
73
|
+
};
|
|
74
|
+
return /* @__PURE__ */ s.jsxs("div", { className: "py-24 border-end h-100 bg-white rounded-start-4", children: [
|
|
75
|
+
/* @__PURE__ */ s.jsx("div", { children: /* @__PURE__ */ s.jsxs(d, { gap: "8", align: "center", className: "px-24 mb-16", children: [
|
|
76
|
+
/* @__PURE__ */ s.jsx(
|
|
77
|
+
d,
|
|
78
|
+
{
|
|
79
|
+
className: "bg-secondary-200 rounded",
|
|
80
|
+
align: "center",
|
|
81
|
+
justify: "center",
|
|
82
|
+
style: { minWidth: "36px", height: "36px" },
|
|
83
|
+
children: /* @__PURE__ */ s.jsx(Q, {})
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ s.jsx(M, { level: "h4", headingStyle: "h4", className: "text-truncate", children: t("collection.submissionList.title") }),
|
|
87
|
+
/* @__PURE__ */ s.jsx(
|
|
88
|
+
N,
|
|
89
|
+
{
|
|
90
|
+
variant: {
|
|
91
|
+
type: "chip"
|
|
92
|
+
},
|
|
93
|
+
children: o.length
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
] }) }),
|
|
97
|
+
g ? /* @__PURE__ */ s.jsx(L, {}) : o.length > 0 && /* @__PURE__ */ s.jsxs("div", { className: "table-submissions", children: [
|
|
98
|
+
/* @__PURE__ */ s.jsx(C, { "data-testid": "collect-collection-submissions-list-table", children: /* @__PURE__ */ s.jsx(C.Tbody, { children: o.map((u) => {
|
|
99
|
+
const h = c(u);
|
|
100
|
+
return /* @__PURE__ */ s.jsx(
|
|
101
|
+
C.Tr,
|
|
102
|
+
{
|
|
103
|
+
"data-testid": "collect-collection-submissions-list-row",
|
|
104
|
+
onMouseEnter: () => l(u.id),
|
|
105
|
+
onMouseLeave: () => l(null),
|
|
106
|
+
onClick: () => p(u),
|
|
107
|
+
children: /* @__PURE__ */ s.jsx(
|
|
108
|
+
C.Td,
|
|
109
|
+
{
|
|
110
|
+
className: `p-16 c-pointer ${h} ${(n == null ? void 0 : n.id) === u.id ? "bg-secondary-200" : ""}`,
|
|
111
|
+
style: { maxWidth: 0 },
|
|
112
|
+
children: /* @__PURE__ */ s.jsx(H, { submission: u })
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
},
|
|
116
|
+
u.id
|
|
117
|
+
);
|
|
118
|
+
}) }) }),
|
|
119
|
+
i && /* @__PURE__ */ s.jsx(d, { justify: "center", className: "mt-16", children: /* @__PURE__ */ s.jsx(
|
|
120
|
+
I,
|
|
121
|
+
{
|
|
122
|
+
"data-testid": "collect-collection-submissions-list-button-more",
|
|
123
|
+
className: "px-48",
|
|
124
|
+
type: "button",
|
|
125
|
+
color: "secondary",
|
|
126
|
+
variant: "filled",
|
|
127
|
+
rightIcon: /* @__PURE__ */ s.jsx(P, {}),
|
|
128
|
+
onClick: () => x(),
|
|
129
|
+
children: t("collection.see.more")
|
|
130
|
+
}
|
|
131
|
+
) })
|
|
132
|
+
] })
|
|
133
|
+
] });
|
|
134
|
+
}, xs = ({
|
|
135
|
+
collection: e
|
|
136
|
+
}) => {
|
|
137
|
+
const { appCode: a } = v(), { t } = E(a), l = O(), { isInstructionModalOpen: c, onCloseInstructionModal: o } = D((i) => ({
|
|
138
|
+
isInstructionModalOpen: i.isInstructionModalOpen,
|
|
139
|
+
onCloseInstructionModal: i.onCloseInstructionModal
|
|
140
|
+
})), x = () => {
|
|
141
|
+
o(), l(`/id/${e.id}/form`);
|
|
142
|
+
};
|
|
143
|
+
return /* @__PURE__ */ s.jsxs(
|
|
144
|
+
y,
|
|
145
|
+
{
|
|
146
|
+
id: "instruction-modal",
|
|
147
|
+
isOpen: c,
|
|
148
|
+
onModalClose: o,
|
|
149
|
+
size: "lg",
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ s.jsx(y.Header, { onModalClose: o, children: t("collection.submission.instruction.title") }),
|
|
152
|
+
/* @__PURE__ */ s.jsx(y.Body, { children: /* @__PURE__ */ s.jsx(
|
|
153
|
+
$,
|
|
154
|
+
{
|
|
155
|
+
content: e.content,
|
|
156
|
+
mode: "read",
|
|
157
|
+
toolbar: "none",
|
|
158
|
+
variant: "ghost"
|
|
159
|
+
}
|
|
160
|
+
) }),
|
|
161
|
+
/* @__PURE__ */ s.jsxs(y.Footer, { children: [
|
|
162
|
+
/* @__PURE__ */ s.jsx(
|
|
163
|
+
I,
|
|
164
|
+
{
|
|
165
|
+
"data-testid": "collect-collection-modal-instruction-button-close",
|
|
166
|
+
color: "tertiary",
|
|
167
|
+
variant: "ghost",
|
|
168
|
+
onClick: o,
|
|
169
|
+
children: t("collection.cancel")
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ s.jsx(
|
|
173
|
+
I,
|
|
174
|
+
{
|
|
175
|
+
"data-testid": "collect-collection-modal-instruction-button-edit",
|
|
176
|
+
onClick: x,
|
|
177
|
+
leftIcon: /* @__PURE__ */ s.jsx(G, {}),
|
|
178
|
+
children: t("collection.modify")
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] })
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
}, hs = ({
|
|
186
|
+
collection: e
|
|
187
|
+
}) => {
|
|
188
|
+
const { appCode: a } = v(), { t } = E(a), { getAvatarURL: l } = R(), { submissions: c, fetchNextPage: o, hasNextPage: x, isLoading: i } = U(e), { getSubmissionStatus: g } = F(), { setSelectedSubmissionListMenu: m, selectedSubmissionListMenu: n } = T((r) => ({
|
|
189
|
+
selectedSubmissionListMenu: r.selectedSubmissionListMenu,
|
|
190
|
+
setSelectedSubmissionListMenu: r.setSelectedSubmissionListMenu
|
|
191
|
+
})), p = D.use.isPastDeadline();
|
|
192
|
+
b.useEffect(() => {
|
|
193
|
+
if (c.length === 0)
|
|
194
|
+
return;
|
|
195
|
+
c.some(
|
|
196
|
+
(S) => S.id === (n == null ? void 0 : n.id)
|
|
197
|
+
) || m(c[0] ?? null);
|
|
198
|
+
}, [
|
|
199
|
+
n == null ? void 0 : n.id,
|
|
200
|
+
m,
|
|
201
|
+
c
|
|
202
|
+
]);
|
|
203
|
+
const u = c.find((r) => r.id === (n == null ? void 0 : n.id)) ?? c[0];
|
|
204
|
+
if (!u)
|
|
205
|
+
return null;
|
|
206
|
+
const h = (r) => {
|
|
207
|
+
m(r);
|
|
208
|
+
};
|
|
209
|
+
return /* @__PURE__ */ s.jsx("div", { className: "position-relative w-100 p-8 ", children: /* @__PURE__ */ s.jsx("div", { className: "bg-white", children: i ? /* @__PURE__ */ s.jsx(L, {}) : /* @__PURE__ */ s.jsxs(
|
|
210
|
+
f,
|
|
211
|
+
{
|
|
212
|
+
block: !0,
|
|
213
|
+
"data-testid": "collect-collection-submissions-list-dropdown-mobile",
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ s.jsx(
|
|
216
|
+
f.Trigger,
|
|
217
|
+
{
|
|
218
|
+
label: /* @__PURE__ */ s.jsx(
|
|
219
|
+
H,
|
|
220
|
+
{
|
|
221
|
+
submission: u
|
|
222
|
+
},
|
|
223
|
+
u.id
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
),
|
|
227
|
+
/* @__PURE__ */ s.jsxs(f.Menu, { children: [
|
|
228
|
+
c.map((r) => {
|
|
229
|
+
const S = g({
|
|
230
|
+
status: r.status,
|
|
231
|
+
isPastDeadline: p
|
|
232
|
+
});
|
|
233
|
+
return /* @__PURE__ */ s.jsx(
|
|
234
|
+
f.Item,
|
|
235
|
+
{
|
|
236
|
+
onClick: () => h(r),
|
|
237
|
+
"data-testid": "collect-collection-submissions-list-dropdown-item-mobile",
|
|
238
|
+
children: /* @__PURE__ */ s.jsxs(
|
|
239
|
+
d,
|
|
240
|
+
{
|
|
241
|
+
justify: "between",
|
|
242
|
+
align: "center",
|
|
243
|
+
className: "w-100",
|
|
244
|
+
gap: "8",
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ s.jsxs(d, { align: "center", gap: "12", style: { minWidth: 0 }, children: [
|
|
247
|
+
/* @__PURE__ */ s.jsx(
|
|
248
|
+
B,
|
|
249
|
+
{
|
|
250
|
+
alt: r.createdBy.displayName,
|
|
251
|
+
size: "xs",
|
|
252
|
+
src: l(r.createdBy.entId, "user"),
|
|
253
|
+
variant: "circle"
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ s.jsx("p", { className: "text-truncate", children: r.createdBy.displayName })
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ s.jsx(N, { variant: S.variant, children: S.text })
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
},
|
|
263
|
+
r.id
|
|
264
|
+
);
|
|
265
|
+
}),
|
|
266
|
+
x && /* @__PURE__ */ s.jsx(d, { justify: "center", className: "mt-8", children: /* @__PURE__ */ s.jsx(
|
|
267
|
+
I,
|
|
268
|
+
{
|
|
269
|
+
"data-testid": "collect-collection-submissions-list-dropdown-button-more-mobile",
|
|
270
|
+
className: "px-48",
|
|
271
|
+
type: "button",
|
|
272
|
+
color: "secondary",
|
|
273
|
+
variant: "filled",
|
|
274
|
+
rightIcon: /* @__PURE__ */ s.jsx(P, {}),
|
|
275
|
+
onClick: () => o(),
|
|
276
|
+
children: t("collection.see.more")
|
|
277
|
+
}
|
|
278
|
+
) })
|
|
279
|
+
] })
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
) }) });
|
|
283
|
+
}, gs = ({
|
|
284
|
+
collectionId: e
|
|
285
|
+
}) => {
|
|
286
|
+
const { appCode: a } = v(), { t } = E(a), l = Y(), { lg: c } = A(), [o, x] = b.useState(!1), { selectedSubmissionListMenu: i, setSelectedSubmissionListMenu: g } = T(), m = (i == null ? void 0 : i.status) === j.VERIFIED, { formatDate: n } = z(), p = ls(), u = async (h) => {
|
|
287
|
+
if (i)
|
|
288
|
+
try {
|
|
289
|
+
x(!0), await p.mutateAsync({
|
|
290
|
+
collectionId: e,
|
|
291
|
+
submissionId: i.id,
|
|
292
|
+
data: {
|
|
293
|
+
status: h ? k.VERIFIED : k.SUBMITTED
|
|
294
|
+
}
|
|
295
|
+
}), g({
|
|
296
|
+
...i,
|
|
297
|
+
status: h ? j.VERIFIED : j.SUBMITTED
|
|
298
|
+
}), l.success(t("collection.toast.success.submission.statusUpdate"));
|
|
299
|
+
} catch (r) {
|
|
300
|
+
console.error("Error updating submission status:", r), l.error(t("collection.toast.error.submission.statusUpdate"));
|
|
301
|
+
} finally {
|
|
302
|
+
x(!1);
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
return /* @__PURE__ */ s.jsxs(
|
|
306
|
+
d,
|
|
307
|
+
{
|
|
308
|
+
className: "p-24 bg-white rounded-end-4 h-100",
|
|
309
|
+
direction: "column",
|
|
310
|
+
gap: "16",
|
|
311
|
+
children: [
|
|
312
|
+
/* @__PURE__ */ s.jsxs(
|
|
313
|
+
d,
|
|
314
|
+
{
|
|
315
|
+
className: "mb-16",
|
|
316
|
+
justify: "between",
|
|
317
|
+
direction: c ? "row" : "column",
|
|
318
|
+
align: c ? "center" : "start",
|
|
319
|
+
gap: "16",
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ s.jsxs(d, { gap: "8", align: "center", children: [
|
|
322
|
+
/* @__PURE__ */ s.jsx(
|
|
323
|
+
d,
|
|
324
|
+
{
|
|
325
|
+
className: "bg-secondary-200 rounded",
|
|
326
|
+
align: "center",
|
|
327
|
+
justify: "center",
|
|
328
|
+
style: { minWidth: "36px", height: "36px" },
|
|
329
|
+
children: /* @__PURE__ */ s.jsx(_, {})
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ s.jsx(M, { level: "h4", headingStyle: "h4", className: "text-truncate", children: `${t("collection.submissionRender.title")} ${i == null ? void 0 : i.createdBy.displayName}` })
|
|
333
|
+
] }),
|
|
334
|
+
/* @__PURE__ */ s.jsx(d, { justify: "end", children: i && [j.SUBMITTED, j.VERIFIED].includes(
|
|
335
|
+
i.status
|
|
336
|
+
) && /* @__PURE__ */ s.jsx(
|
|
337
|
+
N,
|
|
338
|
+
{
|
|
339
|
+
className: "lh-base",
|
|
340
|
+
style: { height: "3rem" },
|
|
341
|
+
variant: {
|
|
342
|
+
level: "info",
|
|
343
|
+
type: "notification"
|
|
344
|
+
},
|
|
345
|
+
children: /* @__PURE__ */ s.jsxs(d, { align: "center", gap: "8", children: [
|
|
346
|
+
/* @__PURE__ */ s.jsx(ns, { height: 20, width: 20 }),
|
|
347
|
+
`${t("collection.submissionRender.date")} ${n(i.updatedAt)}`
|
|
348
|
+
] })
|
|
349
|
+
}
|
|
350
|
+
) })
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
),
|
|
354
|
+
i && /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
355
|
+
/* @__PURE__ */ s.jsx(
|
|
356
|
+
$,
|
|
357
|
+
{
|
|
358
|
+
id: "submissionRead",
|
|
359
|
+
content: i.content ?? "",
|
|
360
|
+
mode: "read",
|
|
361
|
+
variant: "ghost"
|
|
362
|
+
}
|
|
363
|
+
),
|
|
364
|
+
i.status === j.EMPTY ? /* @__PURE__ */ s.jsx(
|
|
365
|
+
q,
|
|
366
|
+
{
|
|
367
|
+
imageSrc: ds,
|
|
368
|
+
title: t("collection.collectionList.emptyScreen.title"),
|
|
369
|
+
text: t("collection.submissionRender.emptyScreen.description")
|
|
370
|
+
}
|
|
371
|
+
) : i.status !== j.DRAFT ? /* @__PURE__ */ s.jsx(d, { justify: "end", children: /* @__PURE__ */ s.jsx(
|
|
372
|
+
"div",
|
|
373
|
+
{
|
|
374
|
+
className: `border rounded p-8 ${m ? "bg-secondary-200 border-secondary" : ""}`,
|
|
375
|
+
children: /* @__PURE__ */ s.jsx(
|
|
376
|
+
K,
|
|
377
|
+
{
|
|
378
|
+
"data-testid": "collect-collection-submissions-list-checkbox-validate",
|
|
379
|
+
checked: m,
|
|
380
|
+
label: t("collection.submissionRender.checkbox.label"),
|
|
381
|
+
onChange: () => u(!m),
|
|
382
|
+
disabled: o
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
}
|
|
386
|
+
) }) : null
|
|
387
|
+
] })
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
}, js = ({
|
|
392
|
+
collection: e
|
|
393
|
+
}) => {
|
|
394
|
+
const a = O(), { lg: t } = A(), l = D.use.setIsPastDeadline();
|
|
395
|
+
return l(new Date(e.deadline) < /* @__PURE__ */ new Date()), b.useEffect(() => {
|
|
396
|
+
l(new Date(e.deadline) < /* @__PURE__ */ new Date());
|
|
397
|
+
}, [e.deadline]), /* @__PURE__ */ s.jsxs(
|
|
398
|
+
d,
|
|
399
|
+
{
|
|
400
|
+
className: "bg-gray-200 mx-n16 flex-fill border-bottom-0 border",
|
|
401
|
+
direction: "column",
|
|
402
|
+
children: [
|
|
403
|
+
/* @__PURE__ */ s.jsx(
|
|
404
|
+
is,
|
|
405
|
+
{
|
|
406
|
+
collection: e,
|
|
407
|
+
context: as.COLLECTION,
|
|
408
|
+
onClickBack: () => a("/list-collections")
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
/* @__PURE__ */ s.jsxs(w, { className: "flex-grow-1 m-16 gap-24", children: [
|
|
412
|
+
/* @__PURE__ */ s.jsx(
|
|
413
|
+
w.Col,
|
|
414
|
+
{
|
|
415
|
+
sm: "3",
|
|
416
|
+
md: "3",
|
|
417
|
+
lg: "3",
|
|
418
|
+
xl: "4",
|
|
419
|
+
className: "d-none d-lg-block",
|
|
420
|
+
as: "aside",
|
|
421
|
+
children: /* @__PURE__ */ s.jsx(ms, { collection: e })
|
|
422
|
+
}
|
|
423
|
+
),
|
|
424
|
+
/* @__PURE__ */ s.jsxs(
|
|
425
|
+
w.Col,
|
|
426
|
+
{
|
|
427
|
+
sm: "4",
|
|
428
|
+
md: "8",
|
|
429
|
+
lg: "5",
|
|
430
|
+
xl: "8",
|
|
431
|
+
className: `${t ? "cancel-gap me-0" : ""}`,
|
|
432
|
+
children: [
|
|
433
|
+
!t && /* @__PURE__ */ s.jsx(hs, { collection: e }),
|
|
434
|
+
/* @__PURE__ */ s.jsx(gs, { collectionId: e.id })
|
|
435
|
+
]
|
|
436
|
+
}
|
|
437
|
+
)
|
|
438
|
+
] }),
|
|
439
|
+
/* @__PURE__ */ s.jsx(
|
|
440
|
+
os,
|
|
441
|
+
{
|
|
442
|
+
onDeleteSuccess: () => a("/list-collections")
|
|
443
|
+
}
|
|
444
|
+
),
|
|
445
|
+
/* @__PURE__ */ s.jsx(xs, { collection: e })
|
|
446
|
+
]
|
|
447
|
+
}
|
|
448
|
+
);
|
|
449
|
+
}, Ns = (e) => async ({ params: a }) => {
|
|
450
|
+
const t = Number(a.collectionId);
|
|
451
|
+
return await e.ensureQueryData(ts(t)), await e.prefetchInfiniteQuery(
|
|
452
|
+
rs(t)
|
|
453
|
+
), null;
|
|
454
|
+
}, vs = () => {
|
|
455
|
+
const e = J(), a = X(Z.COLLECTION_CREATE), { data: t, isLoading: l } = ss(
|
|
456
|
+
Number(e.collectionId)
|
|
457
|
+
);
|
|
458
|
+
return l ? /* @__PURE__ */ s.jsx(L, {}) : !a || !t ? /* @__PURE__ */ s.jsx(es, {}) : /* @__PURE__ */ s.jsx(js, { collection: t });
|
|
459
|
+
};
|
|
460
|
+
export {
|
|
461
|
+
vs as Collection,
|
|
462
|
+
Ns as loader
|
|
463
|
+
};
|