@edifice.io/collect-frontend 1.0.0 → 1.0.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.
Files changed (114) hide show
  1. package/lib/components/AppActionHeader.d.ts +1 -0
  2. package/lib/components/AppActionHeaderContext.d.ts +11 -0
  3. package/lib/components/AppHeaderCollection.d.ts +12 -0
  4. package/lib/components/CollectApp/CollectApp.d.ts +26 -0
  5. package/lib/components/CollectApp/CollectAppContext.d.ts +13 -0
  6. package/lib/components/CollectAppActionHeader.d.ts +4 -0
  7. package/lib/components/InstructionCard.d.ts +5 -0
  8. package/lib/components/SearchBarCollect.d.ts +3 -0
  9. package/lib/components/SubmissionCard.d.ts +7 -0
  10. package/lib/config/constants.d.ts +6 -0
  11. package/lib/features/collect-form/components/CollectForm.d.ts +24 -0
  12. package/lib/features/collect-form/components/index.d.ts +3 -0
  13. package/lib/features/collect-form/hooks/index.d.ts +2 -0
  14. package/lib/features/collect-form/hooks/useCreateCollectionForm.d.ts +20 -0
  15. package/lib/features/collect-form/index.d.ts +3 -0
  16. package/lib/features/collection-actions/components/CollectionActions.d.ts +4 -0
  17. package/lib/features/collection-list/components/CollectionListTable.d.ts +1 -0
  18. package/lib/features/collection-list/components/CollectionListTableBody.d.ts +4 -0
  19. package/lib/features/collection-list/components/CollectionListTableFooter.d.ts +12 -0
  20. package/lib/features/collection-list/components/CollectionListTableHead.d.ts +1 -0
  21. package/lib/features/collection-list/hooks/useCollectionListTableBody.d.ts +7 -0
  22. package/lib/features/collection-list/hooks/useCollectionListTableHead.d.ts +12 -0
  23. package/lib/features/collection-list/hooks/useCollectionPagination.d.ts +11 -0
  24. package/lib/features/collection-list/store/collectionListStore.d.ts +26 -0
  25. package/lib/features/collection-submissions-list/components/CollectionSubmissionsList.d.ts +4 -0
  26. package/lib/features/collection-submissions-list/components/CollectionSubmissionsListMobile.d.ts +4 -0
  27. package/lib/features/collection-submissions-list/components/CollectionSubmissionsListTr.d.ts +4 -0
  28. package/lib/features/collection-submissions-list/components/CollectionSubmissionsListView.d.ts +4 -0
  29. package/lib/features/collection-submissions-list/components/CollectionSubmissionsRender.d.ts +3 -0
  30. package/lib/features/collection-submissions-list/hooks/useCollectionSubmissionsList.d.ts +10 -0
  31. package/lib/features/collection-submissions-list/store/collectionSubmissionListStore.d.ts +16 -0
  32. package/lib/features/creation-wizard/CreationWizard.d.ts +2 -0
  33. package/lib/features/creation-wizard/components/FormCreate.d.ts +7 -0
  34. package/lib/features/creation-wizard/components/Members.d.ts +9 -0
  35. package/lib/features/creation-wizard/components/WizardContext.d.ts +8 -0
  36. package/lib/features/creation-wizard/components/WizardHeader.d.ts +3 -0
  37. package/lib/features/creation-wizard/components/WizardLayout.d.ts +3 -0
  38. package/lib/features/creation-wizard/hooks/useAddMember.d.ts +15 -0
  39. package/lib/features/creation-wizard/sharing.utils.d.ts +12 -0
  40. package/lib/features/creation-wizard/store/wizardStore.d.ts +15 -0
  41. package/lib/features/dropdown-actions/components/DropdownActionTable.d.ts +7 -0
  42. package/lib/features/dropdown-actions/hooks/useDropdownActionTable.d.ts +13 -0
  43. package/lib/features/menu/components/CollectMenu.d.ts +5 -0
  44. package/lib/features/menu/components/DesktopMenu.d.ts +1 -0
  45. package/lib/features/menu/components/MenuContext.d.ts +13 -0
  46. package/lib/features/menu/components/MobileMenu.d.ts +1 -0
  47. package/lib/features/menu/store/menuStore.d.ts +20 -0
  48. package/lib/features/modal/components/DeleteCollectionModal.d.ts +3 -0
  49. package/lib/features/modal/components/InstructionModal.d.ts +4 -0
  50. package/lib/features/modal/components/UpdateSubmissionModal.d.ts +9 -0
  51. package/lib/features/modal/hooks/useDeleteCollectionModal.d.ts +5 -0
  52. package/lib/features/submission/components/SubmissionEdit.d.ts +4 -0
  53. package/lib/features/submission/components/SubmissionView.d.ts +5 -0
  54. package/lib/features/submission-actions/components/SubmissionActions.d.ts +6 -0
  55. package/lib/features/submission-list/components/SubmissionFilter.d.ts +1 -0
  56. package/lib/features/submission-list/components/SubmissionsListView.d.ts +1 -0
  57. package/lib/features/submission-list/hooks/useSubmissionPagination.d.ts +7 -0
  58. package/lib/features/submission-list/store/submissionListStore.d.ts +24 -0
  59. package/lib/hooks/useGetStatusSubmission.d.ts +12 -0
  60. package/lib/hooks/useSearch.d.ts +18 -0
  61. package/lib/hooks/useStepNavigations.d.ts +5 -0
  62. package/lib/hooks/useSubmissionForm.d.ts +12 -0
  63. package/lib/hooks/useWizard.d.ts +13 -0
  64. package/lib/i18n.d.ts +2 -0
  65. package/lib/index.d.ts +14 -1
  66. package/lib/index.js +14676 -15
  67. package/lib/main.d.ts +0 -0
  68. package/lib/models/collect.d.ts +12 -0
  69. package/lib/models/menu.d.ts +5 -0
  70. package/lib/pages/Collection.d.ts +4 -0
  71. package/lib/pages/CollectionsLayout.d.ts +2 -0
  72. package/lib/pages/CollectionsList.d.ts +3 -0
  73. package/lib/pages/FormEdit.d.ts +4 -0
  74. package/lib/pages/MembersEdit.d.ts +4 -0
  75. package/lib/pages/MineSubmission.d.ts +6 -0
  76. package/lib/pages/NotFound.d.ts +1 -0
  77. package/lib/pages/PageError.d.ts +1 -0
  78. package/lib/pages/Root.d.ts +2 -0
  79. package/lib/pages/Submission.d.ts +4 -0
  80. package/lib/pages/SubmissionList.d.ts +3 -0
  81. package/lib/providers/index.d.ts +6 -0
  82. package/lib/routes/wizard/wizard.d.ts +2 -0
  83. package/lib/services/api/collection.service.d.ts +14 -0
  84. package/lib/services/api/submission.services.d.ts +8 -0
  85. package/lib/services/api/user.service.d.ts +77 -0
  86. package/lib/services/queries/collection.queries.d.ts +76 -0
  87. package/lib/services/queries/index.d.ts +1 -0
  88. package/lib/services/queries/submission.queries.d.ts +36 -0
  89. package/lib/services/queries/user.queries.d.ts +76 -0
  90. package/lib/store/collectionActionStore.d.ts +29 -0
  91. package/lib/store/createSelectors.d.ts +10 -0
  92. package/lib/store/submissionActionStore.d.ts +32 -0
  93. package/lib/store/userActionStore.d.ts +26 -0
  94. package/lib/style.css +1 -1
  95. package/package.json +7 -6
  96. package/lib/AppHeaderCollection-CnQ2pqtl.js +0 -172
  97. package/lib/CXEL7IU7-Dei8UEaR.js +0 -42
  98. package/lib/Collection-BcJujQH9.js +0 -472
  99. package/lib/CollectionsLayout-BWau0fFT.js +0 -41
  100. package/lib/CollectionsList-DoYvRzYy.js +0 -324
  101. package/lib/DeleteCollectionModal-C8NPFHjI.js +0 -71
  102. package/lib/DropdownActionTable-CJA3djIr.js +0 -84
  103. package/lib/FormEdit-DrlhrKl6.js +0 -102
  104. package/lib/HASRA6WW-Lcj-6-Jg.js +0 -9093
  105. package/lib/I3HPI4QX-BiqSZkoI.js +0 -33
  106. package/lib/MembersEdit--SFUJ5dS.js +0 -77
  107. package/lib/Root-4Xv-j-fs.js +0 -20
  108. package/lib/SearchBarCollect-DBKaVVDV.js +0 -23
  109. package/lib/Submission-Bi1puhNG.js +0 -257
  110. package/lib/SubmissionList-BUexy8AF.js +0 -197
  111. package/lib/emptyscreen-list-collection-CWGxO4Ss.js +0 -4
  112. package/lib/index-DPvhGf6m.js +0 -3485
  113. package/lib/submission.queries-rlTI0q9h.js +0 -86
  114. package/lib/useGetStatusSubmission-DxHmLPxr.js +0 -57
@@ -1,41 +0,0 @@
1
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
- import { WORKFLOW_RIGHTS as u } from "@edifice.io/collect-client-rest";
3
- import { useEdificeClient as f, useHasWorkflow as h, useBreakpoint as C, Flex as L, AppHeader as S, Breadcrumb as g, Grid as r, LoadingScreen as x } from "@edifice.io/react";
4
- import { Suspense as N } from "react";
5
- import { useLocation as I, Navigate as O, Outlet as A } from "react-router-dom";
6
- import { ah as E, M as a, A as T, d as w } from "./index-DPvhGf6m.js";
7
- const B = async () => null, F = () => {
8
- const { currentApp: l } = f(), { pathname: s } = I(), n = h(u.COLLECTION_CREATE), { header: c, showMenu: i } = E(), { lg: d } = C(), m = c !== !1, o = i !== !1, p = s === "/" || s === `/${a.LIST_COLLECTIONS}`;
9
- return n !== void 0 && !n && p ? /* @__PURE__ */ e(O, { to: `/${a.LIST_SUBMISSIONS}`, replace: !0 }) : /* @__PURE__ */ t(L, { direction: "column", className: "flex-grow-1", children: [
10
- m && /* @__PURE__ */ e(S, { render: () => /* @__PURE__ */ e(T, {}), children: /* @__PURE__ */ e(g, { app: l }) }),
11
- /* @__PURE__ */ t(r, { className: "flex-grow-1", children: [
12
- o && /* @__PURE__ */ e(
13
- r.Col,
14
- {
15
- sm: "3",
16
- md: "3",
17
- lg: "2",
18
- xl: "3",
19
- className: "d-none d-lg-block",
20
- as: "aside",
21
- children: /* @__PURE__ */ e(w, {})
22
- }
23
- ),
24
- /* @__PURE__ */ e(
25
- r.Col,
26
- {
27
- sm: "4",
28
- md: "8",
29
- lg: o ? "6" : "12",
30
- xl: o ? "9" : "12",
31
- className: `${o && d ? "cancel-gap" : ""}`,
32
- children: /* @__PURE__ */ e(N, { fallback: /* @__PURE__ */ e(x, {}), children: /* @__PURE__ */ e(A, {}) })
33
- }
34
- )
35
- ] })
36
- ] });
37
- };
38
- export {
39
- F as Component,
40
- B as loader
41
- };
@@ -1,324 +0,0 @@
1
- import { jsx as e, Fragment as T, jsxs as u } from "react/jsx-runtime";
2
- import { useState as D, useMemo as L, useCallback as B, useEffect as E } from "react";
3
- import { S as A } from "./SearchBarCollect-DBKaVVDV.js";
4
- import { J as F, aj as M, W as O, u as R } from "./index-DPvhGf6m.js";
5
- import { useDate as $, Table as m, Flex as I, Badge as k, IconButton as S, useEdificeClient as v, EmptyScreen as G, LoadingScreen as j } from "@edifice.io/react";
6
- import { useTranslation as N } from "react-i18next";
7
- import { E as Q } from "./emptyscreen-list-collection-CWGxO4Ss.js";
8
- import { D as W } from "./DeleteCollectionModal-C8NPFHjI.js";
9
- import { SortDirection as b, CollectionSortField as y } from "@edifice.io/collect-client-rest";
10
- import { create as _ } from "zustand";
11
- import { IconOptions as H, IconRafterLeft as z, IconRafterRight as J, IconListOrder as K, IconArrowUp as U, IconArrowDown as Y } from "@edifice.io/react/icons";
12
- import { t as Z } from "i18next";
13
- import { useNavigate as q } from "react-router-dom";
14
- import { D as V } from "./DropdownActionTable-CJA3djIr.js";
15
- const X = {
16
- search: "",
17
- sortBy: y.DEADLINE,
18
- sortDirection: b.DESC
19
- }, x = F(
20
- _((n) => ({
21
- ...X,
22
- setSearch: (o) => n({ search: o }),
23
- setFilters: (o) => n(o),
24
- setSortCollectionList: (o, a) => n({ sortBy: o, sortDirection: a })
25
- }))
26
- ), ee = () => {
27
- const { search: n, sortBy: o, sortDirection: a } = x(), { data: r, fetchNextPage: d, hasNextPage: s, isFetchingNextPage: i, isLoading: g } = M({
28
- search: n || void 0,
29
- sortBy: o,
30
- sortDirection: a
31
- }), [t, l] = D(1), c = L(() => {
32
- var C, p;
33
- const h = (C = r == null ? void 0 : r.pages) == null ? void 0 : C[r.pages.length - 1];
34
- return ((p = h == null ? void 0 : h.meta) == null ? void 0 : p.totalPages) ?? 1;
35
- }, [r]), f = L(() => {
36
- var h;
37
- if ((h = r == null ? void 0 : r.pages) != null && h.length)
38
- return r.pages.find((C) => {
39
- var p;
40
- return ((p = C.meta) == null ? void 0 : p.currentPage) === t;
41
- }) ?? r.pages[t - 1];
42
- }, [r, t]);
43
- return {
44
- items: (f == null ? void 0 : f.items) ?? [],
45
- page: t,
46
- totalPages: c,
47
- isLoading: g,
48
- isFetchingNextPage: i,
49
- handlePagePrevious: () => {
50
- l((h) => Math.max(1, h - 1));
51
- },
52
- handlePageNext: async () => {
53
- var p;
54
- if (t >= c || i) return;
55
- const h = t + 1;
56
- !((p = r == null ? void 0 : r.pages) == null ? void 0 : p.some(
57
- (w) => {
58
- var P;
59
- return ((P = w.meta) == null ? void 0 : P.currentPage) === h;
60
- }
61
- )) && s && await d(), l(h);
62
- },
63
- canGoPrevious: t > 1,
64
- canGoNext: t < c
65
- };
66
- }, te = () => {
67
- const [n, o] = D(
68
- null
69
- );
70
- return {
71
- isHovered: (s) => n === s.id,
72
- setHoveredCollectionId: o,
73
- getBgColor: (s) => n === s.id ? "bg-gray-300" : "",
74
- getColorByPercentage: (s, i) => {
75
- if (i === 0) return "danger";
76
- const g = s / i * 100;
77
- return g >= 0 && g < 33 ? "danger" : g >= 33 && g < 66 ? "warning" : g >= 66 && g <= 100 ? "success" : "warning";
78
- }
79
- };
80
- }, oe = ({
81
- collections: n
82
- }) => {
83
- const { fromNow: o, formatDate: a } = $(), r = q(), {
84
- isHovered: d,
85
- setHoveredCollectionId: s,
86
- getBgColor: i,
87
- getColorByPercentage: g
88
- } = te();
89
- return /* @__PURE__ */ e(T, { children: n.map((t, l) => {
90
- const c = i(t);
91
- return /* @__PURE__ */ u(
92
- m.Tr,
93
- {
94
- "data-testid": "collect-collection-list-row",
95
- onMouseEnter: () => s(t.id),
96
- onMouseLeave: () => s(null),
97
- children: [
98
- /* @__PURE__ */ e(m.Td, { className: c, style: { maxWidth: "350px" }, children: /* @__PURE__ */ e(I, { align: "center", gap: "8", children: /* @__PURE__ */ e(
99
- "span",
100
- {
101
- className: "fw-bold text-truncate c-pointer",
102
- "data-testid": "collect-collection-list-row-name",
103
- onClick: () => {
104
- r(`/list-collections/id/${t.id}`);
105
- },
106
- children: t.name
107
- }
108
- ) }) }),
109
- /* @__PURE__ */ e(m.Td, { className: c, children: /* @__PURE__ */ e("em", { className: "text-gray-700", children: o(t.createdAt) }) }),
110
- /* @__PURE__ */ e(m.Td, { className: c, children: a(t.deadline, "short") }),
111
- /* @__PURE__ */ e(
112
- m.Td,
113
- {
114
- className: c,
115
- "data-testid": "collect-collection-list-row-badge",
116
- children: /* @__PURE__ */ u(
117
- k,
118
- {
119
- variant: {
120
- type: "notification",
121
- level: g(
122
- t.contribCount,
123
- t.submissionCount
124
- )
125
- },
126
- className: "fw-normal",
127
- children: [
128
- t.contribCount,
129
- " / ",
130
- t.submissionCount
131
- ]
132
- }
133
- )
134
- }
135
- ),
136
- /* @__PURE__ */ e(
137
- m.Td,
138
- {
139
- className: c,
140
- "data-testid": "collect-collection-list-row-actions",
141
- children: /* @__PURE__ */ e(V, { collectionId: t.id, children: (f) => /* @__PURE__ */ e(
142
- S,
143
- {
144
- ...f,
145
- "data-testid": "collect-collection-list-row-action-button",
146
- className: "icon-button-hover-no-transition bg-white",
147
- type: "button",
148
- "aria-label": Z("collection.table.th.action"),
149
- color: "tertiary",
150
- variant: "filled",
151
- icon: /* @__PURE__ */ e(H, {}),
152
- style: {
153
- visibility: d(t) ? "visible" : "hidden"
154
- }
155
- }
156
- ) })
157
- }
158
- )
159
- ]
160
- },
161
- `${t == null ? void 0 : t.id}-${l}`
162
- );
163
- }) });
164
- }, re = ({
165
- page: n,
166
- totalPages: o,
167
- canGoPrevious: a,
168
- canGoNext: r,
169
- isLoading: d = !1,
170
- isFetchingNextPage: s = !1,
171
- onPagePrevious: i,
172
- onPageNext: g
173
- }) => /* @__PURE__ */ u(I, { justify: "center", align: "center", gap: "8", children: [
174
- /* @__PURE__ */ e(
175
- S,
176
- {
177
- variant: "ghost",
178
- color: "tertiary",
179
- icon: /* @__PURE__ */ e(z, {}),
180
- disabled: !a || d,
181
- onClick: i
182
- }
183
- ),
184
- /* @__PURE__ */ u("span", { "aria-label": `Page ${n} of ${o}`, children: [
185
- n,
186
- " / ",
187
- o
188
- ] }),
189
- /* @__PURE__ */ e(
190
- S,
191
- {
192
- variant: "ghost",
193
- color: "tertiary",
194
- icon: /* @__PURE__ */ e(J, {}),
195
- disabled: !r || d || s,
196
- onClick: g
197
- }
198
- )
199
- ] }), ne = () => {
200
- const { appCode: n } = v(), { t: o } = N(n), { sortBy: a, sortDirection: r, setSortCollectionList: d } = x((l) => ({
201
- sortBy: l.sortBy,
202
- sortDirection: l.sortDirection,
203
- setSortCollectionList: l.setSortCollectionList
204
- })), s = [
205
- {
206
- label: o("collection.table.th.collect"),
207
- sortField: y.NAME
208
- },
209
- {
210
- label: o("collection.table.th.date"),
211
- sortField: y.CREATION_DATE
212
- },
213
- {
214
- label: o("collection.table.th.deadline"),
215
- sortField: y.DEADLINE
216
- },
217
- {
218
- label: o("collection.table.th.render")
219
- // FIXME: No sort field for render, we should add one in the backend
220
- },
221
- {
222
- label: o("collection.table.th.action")
223
- }
224
- ], i = (l) => l.sortField && l.sortField === a, g = (l) => {
225
- let c = /* @__PURE__ */ e(K, { width: 16, height: 16 });
226
- return i(l) && (r === b.ASC ? c = /* @__PURE__ */ e(U, {}) : c = /* @__PURE__ */ e(Y, {})), c;
227
- }, t = B(
228
- (l) => {
229
- let c = b.ASC;
230
- a === l && r === b.ASC && (c = b.DESC), d(l, c);
231
- },
232
- [a, r, d]
233
- );
234
- return {
235
- listHeads: s,
236
- getSortIcon: g,
237
- handleSort: t,
238
- isSortActive: i
239
- };
240
- }, ie = () => {
241
- const { listHeads: n, getSortIcon: o, handleSort: a, isSortActive: r } = ne(), { appCode: d } = v(), { t: s } = N(d);
242
- return n.map((i) => /* @__PURE__ */ u(
243
- m.Th,
244
- {
245
- className: i.sortField ? void 0 : "align-content-center text-center",
246
- children: [
247
- s(i.label),
248
- i.sortField && /* @__PURE__ */ e(
249
- S,
250
- {
251
- variant: "ghost",
252
- color: "tertiary",
253
- size: "sm",
254
- className: `members-table-sort-btn ms-4 ${r(i) ? "text-gray-800" : "text-gray-600"}`,
255
- icon: o(i),
256
- onClick: () => a(i.sortField)
257
- }
258
- )
259
- ]
260
- },
261
- i.label
262
- ));
263
- }, se = () => {
264
- const { appCode: n } = v(), { t: o } = N(n), {
265
- items: a,
266
- page: r,
267
- totalPages: d,
268
- isLoading: s,
269
- isFetchingNextPage: i,
270
- handlePagePrevious: g,
271
- handlePageNext: t,
272
- canGoPrevious: l,
273
- canGoNext: c
274
- } = ee();
275
- return a.length === 0 && !s ? /* @__PURE__ */ e("div", { className: "py-24", children: /* @__PURE__ */ e(
276
- G,
277
- {
278
- imageSrc: Q,
279
- title: o("collection.collectionList.emptyScreen.title"),
280
- text: o("collection.collectionList.emptyScreen.description")
281
- }
282
- ) }) : /* @__PURE__ */ u(
283
- "div",
284
- {
285
- className: "table-collections",
286
- "data-testid": "collect-collection-list-table",
287
- children: [
288
- /* @__PURE__ */ u(m, { children: [
289
- /* @__PURE__ */ e(m.Thead, { children: /* @__PURE__ */ e(m.Tr, { children: /* @__PURE__ */ e(ie, {}) }) }),
290
- /* @__PURE__ */ u(m.Tbody, { children: [
291
- s && /* @__PURE__ */ e(m.Tr, { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ e(j, {}) }) }),
292
- /* @__PURE__ */ e(oe, { collections: a }),
293
- d !== void 0 && d >= 1 && /* @__PURE__ */ e(m.Tr, { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ e(
294
- re,
295
- {
296
- page: r,
297
- totalPages: d,
298
- canGoPrevious: l,
299
- canGoNext: c,
300
- isLoading: s,
301
- isFetchingNextPage: i,
302
- onPagePrevious: g,
303
- onPageNext: t
304
- }
305
- ) }) })
306
- ] })
307
- ] }),
308
- /* @__PURE__ */ e(W, {})
309
- ]
310
- }
311
- );
312
- }, Pe = async (n) => (await n.prefetchInfiniteQuery(R({})), null), Le = () => {
313
- const n = x((o) => o.setSearch);
314
- return E(() => {
315
- localStorage.removeItem(O);
316
- }, []), /* @__PURE__ */ u(T, { children: [
317
- /* @__PURE__ */ e("div", { className: "bg-gray-200 px-24 py-16", children: /* @__PURE__ */ e(A, { setSearch: n }) }),
318
- /* @__PURE__ */ e(se, {})
319
- ] });
320
- };
321
- export {
322
- Le as CollectionsList,
323
- Pe as loader
324
- };
@@ -1,71 +0,0 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- import { useEdificeClient as m, useToast as f, Modal as d, Button as C } from "@edifice.io/react";
3
- import { IconDelete as h } from "@edifice.io/react/icons";
4
- import { useTranslation as p } from "react-i18next";
5
- import { al as M } from "./index-DPvhGf6m.js";
6
- import { u as D } from "./DropdownActionTable-CJA3djIr.js";
7
- const y = () => {
8
- const { appCode: r } = m(), { t: n } = p(r), e = f(), a = M(), { isDeleteModalOpen: l, onCloseDeleteModal: c, deleteCollectionId: i } = D((o) => ({
9
- isDeleteModalOpen: o.isDeleteModalOpen,
10
- onCloseDeleteModal: o.onCloseDeleteModal,
11
- deleteCollectionId: o.deleteCollectionId
12
- }));
13
- return {
14
- isOpen: l,
15
- onClose: c,
16
- handleDeleteCollection: async (o) => {
17
- if (i != null)
18
- try {
19
- await a.mutateAsync(i), e.success(n("collection.toast.success.collection.delete")), o == null || o();
20
- } catch (u) {
21
- console.error("Error deleting collection:", u), e.error(n("collection.toast.error.collection.delete"));
22
- } finally {
23
- c();
24
- }
25
- }
26
- };
27
- }, k = ({
28
- onDeleteSuccess: r
29
- }) => {
30
- const { appCode: n } = m(), { t: e } = p(n), { isOpen: a, onClose: l, handleDeleteCollection: c } = y(), i = async () => {
31
- await c(r);
32
- };
33
- return /* @__PURE__ */ s(
34
- d,
35
- {
36
- id: "delete-confirmation-modal",
37
- isOpen: a,
38
- onModalClose: l,
39
- size: "sm",
40
- children: [
41
- /* @__PURE__ */ t(d.Header, { onModalClose: l, children: e("collection.modal.delete.title") }),
42
- /* @__PURE__ */ t(d.Body, { children: e("collection.modal.delete.description") }),
43
- /* @__PURE__ */ s(d.Footer, { children: [
44
- /* @__PURE__ */ t(
45
- C,
46
- {
47
- "data-testid": "collect-collection-delete-modal-button-cancel",
48
- color: "tertiary",
49
- variant: "ghost",
50
- onClick: l,
51
- children: e("collection.cancel")
52
- }
53
- ),
54
- /* @__PURE__ */ t(
55
- C,
56
- {
57
- "data-testid": "collect-collection-delete-modal-button-delete",
58
- color: "danger",
59
- onClick: i,
60
- leftIcon: /* @__PURE__ */ t(h, {}),
61
- children: e("collection.delete")
62
- }
63
- )
64
- ] })
65
- ]
66
- }
67
- );
68
- };
69
- export {
70
- k as D
71
- };
@@ -1,84 +0,0 @@
1
- import { jsx as n, Fragment as c, jsxs as r } from "react/jsx-runtime";
2
- import { useEdificeClient as p, useHasWorkflow as m, Dropdown as s } from "@edifice.io/react";
3
- import { Fragment as u } from "react";
4
- import { WORKFLOW_RIGHTS as f } from "@edifice.io/collect-client-rest";
5
- import { IconExternalLink as I, IconEdit as h, IconShare as O, IconDelete as w } from "@edifice.io/react/icons";
6
- import { useTranslation as D } from "react-i18next";
7
- import { useNavigate as C } from "react-router-dom";
8
- import { create as b } from "zustand";
9
- import { J as M } from "./index-DPvhGf6m.js";
10
- const T = b((e) => ({
11
- isDeleteModalOpen: !1,
12
- deleteCollectionId: null,
13
- isInstructionModalOpen: !1,
14
- isPastDeadline: !1,
15
- onOpenDeleteModal: (t) => e({ isDeleteModalOpen: !0, deleteCollectionId: t }),
16
- onCloseDeleteModal: () => e({ isDeleteModalOpen: !1, deleteCollectionId: null }),
17
- onOpenInstructionModal: () => e({ isInstructionModalOpen: !0 }),
18
- onCloseInstructionModal: () => e({ isInstructionModalOpen: !1 }),
19
- setIsPastDeadline: (t) => e({ isPastDeadline: t })
20
- })), g = M(
21
- T
22
- ), E = (e, t) => {
23
- const { appCode: d } = p(), { t: l } = D(d), a = C(), o = m(f.COLLECTION_CREATE), i = g.use.onOpenDeleteModal();
24
- return { dropdownOptions: [
25
- {
26
- label: l("collection.table.dropdown.open"),
27
- action: () => a(`/list-collections/id/${e}`),
28
- icon: /* @__PURE__ */ n(I, {}),
29
- hidden: t,
30
- dataTestId: "collect-dropdown-action-open"
31
- },
32
- {
33
- label: l("collection.table.dropdown.edit"),
34
- action: () => a(`/id/${e}/form`),
35
- icon: /* @__PURE__ */ n(h, {}),
36
- hidden: !o,
37
- dataTestId: "collect-dropdown-action-edit"
38
- },
39
- {
40
- label: l("collection.table.dropdown.share"),
41
- action: () => a(`/id/${e}/members`),
42
- icon: /* @__PURE__ */ n(O, {}),
43
- hidden: !o,
44
- dataTestId: "collect-dropdown-action-share"
45
- },
46
- {
47
- label: l("collection.table.dropdown.delete"),
48
- action: () => i(e),
49
- icon: /* @__PURE__ */ n(w, {}),
50
- className: "text-danger",
51
- hidden: !o,
52
- dataTestId: "collect-dropdown-action-share"
53
- }
54
- ] };
55
- }, W = ({
56
- collectionId: e,
57
- isCollection: t = !1,
58
- children: d
59
- }) => {
60
- const { dropdownOptions: l } = E(
61
- e,
62
- t
63
- );
64
- return /* @__PURE__ */ n(c, { children: /* @__PURE__ */ n(s, { children: (a) => /* @__PURE__ */ r(c, { children: [
65
- d(a),
66
- /* @__PURE__ */ n(s.Menu, { children: l.map((o, i) => /* @__PURE__ */ n(u, { children: !o.hidden && /* @__PURE__ */ r(
67
- s.Item,
68
- {
69
- "data-testid": o.dataTestId,
70
- className: o.className,
71
- onClick: o.action,
72
- children: [
73
- o.icon,
74
- o.label
75
- ]
76
- },
77
- o.label
78
- ) }, i)) })
79
- ] }) }) });
80
- };
81
- export {
82
- W as D,
83
- g as u
84
- };
@@ -1,102 +0,0 @@
1
- import { jsx as t, jsxs as g } from "react/jsx-runtime";
2
- import { WORKFLOW_RIGHTS as b, MediaType as v } from "@edifice.io/collect-client-rest";
3
- import { useEdificeClient as x, useBreakpoint as I, useToast as w, useHasWorkflow as E, LoadingScreen as L, Grid as h, Flex as y, Button as C } from "@edifice.io/react";
4
- import { useState as O } from "react";
5
- import { useTranslation as F } from "react-i18next";
6
- import { useParams as P, useNavigate as k } from "react-router-dom";
7
- import { ap as A, ai as Q, P as R, e as W, t as j } from "./index-DPvhGf6m.js";
8
- import { a as H } from "./submission.queries-rlTI0q9h.js";
9
- const K = (s) => async ({ params: i }) => {
10
- const a = Number(i.collectionId);
11
- return await s.ensureQueryData(j(a)), await s.prefetchInfiniteQuery(
12
- H(a)
13
- ), null;
14
- }, J = () => {
15
- const { appCode: s } = x(), { t: i } = F(s), { lg: a } = I(), d = P(), p = k(), u = w(), f = E(b.COLLECTION_CREATE), m = A(), [e, N] = O(void 0), { data: o, isLoading: l } = Q(
16
- Number(d.collectionId)
17
- );
18
- if (l)
19
- return /* @__PURE__ */ t(L, {});
20
- if (!f || !o) return /* @__PURE__ */ t(R, {});
21
- const T = async () => {
22
- const r = Number(d.collectionId);
23
- if (!r) return;
24
- const c = {
25
- title: (e == null ? void 0 : e.title) ?? o.name ?? "",
26
- description: (e == null ? void 0 : e.description) ?? o.content ?? "",
27
- deadline: (e == null ? void 0 : e.deadline) ?? (o.deadline ? new Date(o.deadline) : void 0),
28
- attachments: (e == null ? void 0 : e.attachments) ?? [],
29
- sharings: (e == null ? void 0 : e.sharings) ?? []
30
- };
31
- try {
32
- await m.mutateAsync({
33
- id: r,
34
- data: {
35
- name: c.title,
36
- content: c.description,
37
- deadline: c.deadline ?? /* @__PURE__ */ new Date(),
38
- attachments: c.attachments.map((n) => ({
39
- name: n.name,
40
- type: v.ATTACHMENT,
41
- uri: n.filename,
42
- mimeType: n.contentType
43
- }))
44
- }
45
- }), u.success(i("collection.toast.success.collection.update"), {
46
- duration: 1e4,
47
- isDismissible: !0
48
- }), p(`/list-collections/id/${r}`);
49
- } catch (n) {
50
- u.error(i("collection.toast.error.collection.update"), {
51
- duration: 1e4,
52
- isDismissible: !0
53
- }), console.log(n);
54
- }
55
- };
56
- return /* @__PURE__ */ g("div", { className: "w-100", children: [
57
- /* @__PURE__ */ t(h, { className: "flex-grow-1 gap-64 px-md-8 px-lg-48 position-relative", children: /* @__PURE__ */ t(h.Col, { sm: "4", md: "8", xl: "12", className: `${a && "ms-64"}`, children: /* @__PURE__ */ t(
58
- y,
59
- {
60
- direction: "column",
61
- gap: "16",
62
- className: "h-100 py-24 pb-lg-48 pt-lg-32",
63
- children: /* @__PURE__ */ t(
64
- W,
65
- {
66
- collection: o,
67
- updateWizardData: N
68
- }
69
- )
70
- }
71
- ) }) }),
72
- /* @__PURE__ */ g(y, { justify: "end", className: "mt-auto px-48 pb-64 gap-16", children: [
73
- /* @__PURE__ */ t(
74
- C,
75
- {
76
- variant: "outline",
77
- color: "primary",
78
- isLoading: l,
79
- onClick: () => p(-1),
80
- "data-testid": "collect-cancel-sharings-button",
81
- children: i("collection.cancel")
82
- }
83
- ),
84
- /* @__PURE__ */ t(
85
- C,
86
- {
87
- variant: "filled",
88
- color: "primary",
89
- isLoading: l || m.isPending,
90
- loadingPosition: "right",
91
- onClick: T,
92
- "data-testid": "collect-save-sharings-button",
93
- children: i("collection.form.edit.save")
94
- }
95
- )
96
- ] })
97
- ] });
98
- };
99
- export {
100
- J as FormEdit,
101
- K as loader
102
- };