@edifice.io/collect-frontend 0.2.2-develop-pedago.2 → 0.2.2-develop-pedago.3

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.
Files changed (36) hide show
  1. package/lib/AppHeaderCollection-CdMZTmC6.js +170 -0
  2. package/lib/{CXEL7IU7-DVs75C4a.js → CXEL7IU7-BLUeaFt5.js} +2 -2
  3. package/lib/Collection-CUCjNGrr.js +472 -0
  4. package/lib/CollectionsLayout-DVYmui3o.js +187 -0
  5. package/lib/CollectionsList-Ba1LoCCN.js +310 -0
  6. package/lib/DeleteCollectionModal-CtmfiR2H.js +71 -0
  7. package/lib/DropdownActionTable-BhSk2sde.js +84 -0
  8. package/lib/FormEdit-DZFkw7z9.js +102 -0
  9. package/lib/{HASRA6WW-qb64R1U-.js → HASRA6WW-BPaxT9L-.js} +269 -269
  10. package/lib/{I3HPI4QX-DhV4n2OZ.js → I3HPI4QX-BuVHGkjY.js} +2 -2
  11. package/lib/MembersEdit-CblCChDS.js +77 -0
  12. package/lib/Root--z47Brfh.js +17 -0
  13. package/lib/SearchBarCollect-DBKaVVDV.js +23 -0
  14. package/lib/Submission-AzDGz_dM.js +257 -0
  15. package/lib/SubmissionList-Db_nRSqg.js +197 -0
  16. package/lib/index-HU8ua_Ev.js +3297 -0
  17. package/lib/index.js +7 -43
  18. package/lib/{submission.queries-CslqTzEP.js → submission.queries-Cr0bP5uv.js} +20 -17
  19. package/lib/useGetStatusSubmission-DxHmLPxr.js +57 -0
  20. package/package.json +1 -1
  21. package/lib/AppHeaderCollection-Bglbw6q9.js +0 -188
  22. package/lib/Collection-DYHQunUI.js +0 -463
  23. package/lib/CollectionsLayout-CPYEwl1X.js +0 -361
  24. package/lib/CollectionsList-Inb9z2nB.js +0 -315
  25. package/lib/DeleteCollectionModal-Dzsn2899.js +0 -112
  26. package/lib/DropdownActionTable-BLHrdk4t.js +0 -83
  27. package/lib/FormEdit-CwVhj3_4.js +0 -96
  28. package/lib/MathsModal-D8rTl0Sb.js +0 -42
  29. package/lib/MembersEdit-DDj8IWMX.js +0 -72
  30. package/lib/Root-DbGwe5v1.js +0 -13
  31. package/lib/SearchBarCollect-BAnLCwAC.js +0 -21
  32. package/lib/Submission-DUcQiBve.js +0 -249
  33. package/lib/SubmissionList-DjQ0x7eD.js +0 -695
  34. package/lib/heic-to-DuZ6uPPi.js +0 -72
  35. package/lib/index-Dt9ykSDF.js +0 -171658
  36. package/lib/useGetStatusSubmission-D77F1XUy.js +0 -55
@@ -1,463 +0,0 @@
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
- };