@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,172 +0,0 @@
1
- import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
- import { useEdificeClient as m, Flex as r, Button as u, IconButton as I, useBreakpoint as f, useDate as g, Badge as S } from "@edifice.io/react";
3
- import { IconPinOn as O, IconOptions as y, IconSave as L, IconSend as v, IconArrowLeft as M, IconCalendarLight as N } from "@edifice.io/react/icons";
4
- import { useTranslation as p } from "react-i18next";
5
- import { u as b, D as w } from "./DropdownActionTable-CJA3djIr.js";
6
- import { ContribSubmissionStatus as x } from "@edifice.io/collect-client-rest";
7
- import { create as A } from "zustand";
8
- import { J as H } from "./index-DPvhGf6m.js";
9
- const D = ({
10
- collection: o
11
- }) => {
12
- const { appCode: t } = m(), { t: i } = p(t), e = b.use.onOpenInstructionModal();
13
- return /* @__PURE__ */ c(r, { gap: "16", justify: "end", children: [
14
- /* @__PURE__ */ n(
15
- u,
16
- {
17
- "data-testid": "collect-collection-actions-button-instruction",
18
- variant: "outline",
19
- color: "primary",
20
- leftIcon: /* @__PURE__ */ n(O, {}),
21
- onClick: e,
22
- children: i("collection.appHeaderCollection.collection.button.instruction")
23
- }
24
- ),
25
- /* @__PURE__ */ n(w, { collectionId: o.id, isCollection: !0, children: (l) => /* @__PURE__ */ n(
26
- I,
27
- {
28
- ...l,
29
- className: "icon-button-hover-no-transition bg-white",
30
- type: "button",
31
- "aria-label": "label",
32
- "data-testid": "collect-collection-actions-button-options",
33
- color: "primary",
34
- variant: "outline",
35
- icon: /* @__PURE__ */ n(y, {})
36
- }
37
- ) })
38
- ] });
39
- }, k = A((o) => ({
40
- submissionId: null,
41
- submissionContent: "",
42
- isUpdateSubmissionModalOpen: !1,
43
- submissionHasContent: !1,
44
- submissionIsLoading: !1,
45
- onOpenUpdateSubmissionModal: () => o({ isUpdateSubmissionModalOpen: !0 }),
46
- onCloseUpdateSubmissionModal: () => o({ isUpdateSubmissionModalOpen: !1 }),
47
- setSubmissionData: (t, i) => o({ submissionContent: t, submissionHasContent: i }),
48
- setSubmissionIsLoading: (t) => o({ submissionIsLoading: t }),
49
- hydrateSubmissionContent: (t) => o((i) => i.submissionId === t.id ? i : {
50
- submissionId: t.id,
51
- submissionContent: t.content || ""
52
- })
53
- })), B = H(
54
- k
55
- ), T = ({
56
- handleUpdateSubmission: o
57
- }) => {
58
- const { appCode: t } = m(), { t: i } = p(t), e = b.use.isPastDeadline(), {
59
- submissionHasContent: l,
60
- submissionIsLoading: d,
61
- onOpenUpdateSubmissionModal: a
62
- } = B((s) => ({
63
- onOpenUpdateSubmissionModal: s.onOpenUpdateSubmissionModal,
64
- submissionHasContent: s.submissionHasContent,
65
- submissionIsLoading: s.submissionIsLoading
66
- }));
67
- return /* @__PURE__ */ c(r, { gap: "16", justify: "end", children: [
68
- /* @__PURE__ */ n(
69
- u,
70
- {
71
- "data-testid": "collect-submission-app-header-actions-draft-button",
72
- variant: "outline",
73
- color: "primary",
74
- leftIcon: /* @__PURE__ */ n(L, {}),
75
- disabled: e,
76
- isLoading: d,
77
- onClick: () => o == null ? void 0 : o({
78
- status: x.DRAFT
79
- }),
80
- children: i("collection.appHeaderSubmission.submission.button.draft")
81
- }
82
- ),
83
- /* @__PURE__ */ n(
84
- u,
85
- {
86
- "data-testid": "collect-submission-app-header-actions-send-button",
87
- variant: "filled",
88
- color: "primary",
89
- leftIcon: /* @__PURE__ */ n(v, {}),
90
- disabled: e || !l,
91
- onClick: () => a(),
92
- children: i("collection.appHeaderSubmission.submission.button.send")
93
- }
94
- )
95
- ] });
96
- };
97
- var h = /* @__PURE__ */ ((o) => (o.COLLECTION = "COLLECTION", o.SUBMISSION = "SUBMISSION", o))(h || {});
98
- const R = ({
99
- collection: o,
100
- onClickBack: t,
101
- context: i,
102
- handleUpdateSubmission: e
103
- }) => {
104
- const { appCode: l } = m(), { t: d } = p(l), { lg: a, md: s } = f(), { formatDate: C } = g();
105
- return /* @__PURE__ */ c("div", { className: `py-16 border-bottom bg-white ${s ? "px-48" : "px-16"}`, children: [
106
- /* @__PURE__ */ n(r, { align: "center", gap: "8", children: /* @__PURE__ */ n(
107
- u,
108
- {
109
- "data-testid": "collect-submission-app-header-button-back",
110
- className: "text-gray-700",
111
- color: "tertiary",
112
- leftIcon: /* @__PURE__ */ n(M, { width: 20, height: 20 }),
113
- type: "button",
114
- variant: "ghost",
115
- size: "sm",
116
- onClick: t,
117
- children: d("collection.back")
118
- }
119
- ) }),
120
- /* @__PURE__ */ c(
121
- r,
122
- {
123
- className: "w-100 mt-24",
124
- justify: "between",
125
- align: a ? "center" : "end",
126
- gap: "12",
127
- direction: a ? "row" : "column",
128
- children: [
129
- /* @__PURE__ */ c(
130
- "div",
131
- {
132
- className: `${s && "d-flex"} ${!a && "w-100"}`,
133
- style: { maxWidth: a ? "70%" : "100%" },
134
- children: [
135
- /* @__PURE__ */ n(
136
- "h2",
137
- {
138
- "data-testid": "collect-submission-app-header-title",
139
- className: `text-truncate ${s ? "me-12" : "mb-12 text-truncate-2"}`,
140
- children: o.name
141
- }
142
- ),
143
- /* @__PURE__ */ n(
144
- S,
145
- {
146
- "data-testid": "collect-submission-app-header-badge-deadline",
147
- className: "lh-base",
148
- style: { height: "3rem" },
149
- variant: {
150
- level: "info",
151
- type: "notification"
152
- },
153
- children: /* @__PURE__ */ c(r, { align: "center", gap: "8", children: [
154
- /* @__PURE__ */ n(N, { height: 20, width: 20 }),
155
- `${d("collection.appHeaderCollection.deadline")} ${C(o.deadline)}`
156
- ] })
157
- }
158
- )
159
- ]
160
- }
161
- ),
162
- i === h.COLLECTION ? /* @__PURE__ */ n(D, { collection: o }) : /* @__PURE__ */ n(T, { handleUpdateSubmission: e })
163
- ]
164
- }
165
- )
166
- ] });
167
- };
168
- export {
169
- R as A,
170
- h as C,
171
- B as u
172
- };
@@ -1,42 +0,0 @@
1
- import { c as s, T as c, a as u, b as i, P as m, C as P, Q as d } from "./HASRA6WW-Lcj-6-Jg.js";
2
- import { T as v, E as C, x as e } from "./index-DPvhGf6m.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
- };
@@ -1,472 +0,0 @@
1
- import { jsxs as l, jsx as e, Fragment as Q } from "react/jsx-runtime";
2
- import { SubmissionStatus as f, ManagerSubmissionStatus as M, WORKFLOW_RIGHTS as z } from "@edifice.io/collect-client-rest";
3
- import { useDirectory as R, Flex as u, Avatar as P, Badge as v, useEdificeClient as w, Heading as O, Table as C, Button as x, LoadingScreen as T, Modal as I, Dropdown as N, useToast as G, useBreakpoint as j, useDate as _, EmptyScreen as J, Checkbox as K, Grid as L, useHasWorkflow as Y } from "@edifice.io/react";
4
- import { useNavigate as $, useParams as X } from "react-router-dom";
5
- import { useState as A, useEffect as k } from "react";
6
- import { A as Z, C as q } from "./AppHeaderCollection-CnQ2pqtl.js";
7
- import { IconUsers as ee, IconRafterDown as U, IconEdit as te, IconTextPage as se, IconCalendarLight as ne } from "@edifice.io/react/icons";
8
- import { useTranslation as D } from "react-i18next";
9
- import { b as ie, d as oe, a as ae } from "./submission.queries-rlTI0q9h.js";
10
- import { create as ce } from "zustand";
11
- import { J as le, ai as re, P as de, t as ue } from "./index-DPvhGf6m.js";
12
- import { u as F } from "./useGetStatusSubmission-DxHmLPxr.js";
13
- import { u as E } from "./DropdownActionTable-CJA3djIr.js";
14
- import { D as me } from "./DeleteCollectionModal-C8NPFHjI.js";
15
- import { Editor as H } from "@edifice.io/react/editor";
16
- import { E as he } from "./emptyscreen-list-collection-CWGxO4Ss.js";
17
- const W = (t) => {
18
- var h;
19
- const { data: o, isLoading: s, fetchNextPage: r, hasNextPage: c } = ie(t == null ? void 0 : t.id), [a, g] = A(
20
- null
21
- ), i = (n) => a === n.id, b = (n) => a === n.id ? "bg-gray-300" : "";
22
- return {
23
- submissions: ((h = o == null ? void 0 : o.pages) == null ? void 0 : h.flatMap((n) => n.items)) ?? [],
24
- isLoading: s,
25
- hasNextPage: c,
26
- isHovered: i,
27
- setHoveredSubmissionId: g,
28
- getBgColor: b,
29
- fetchNextPage: r
30
- };
31
- }, ge = ce((t) => ({
32
- selectedSubmissionListMenu: null,
33
- setSelectedSubmissionListMenu: (o) => t({ selectedSubmissionListMenu: o })
34
- })), B = le(
35
- ge
36
- ), V = ({
37
- submission: t
38
- }) => {
39
- const { getAvatarURL: o } = R(), { getSubmissionStatus: s } = F(), r = E.use.isPastDeadline(), c = s({
40
- status: t.status,
41
- isPastDeadline: r
42
- }), a = o(t.createdBy.entId, "user");
43
- return /* @__PURE__ */ l(u, { justify: "between", align: "center", className: "w-100", gap: "8", children: [
44
- /* @__PURE__ */ l(u, { align: "center", gap: "12", style: { minWidth: 0 }, children: [
45
- /* @__PURE__ */ e(
46
- P,
47
- {
48
- alt: t.createdBy.displayName,
49
- size: "xs",
50
- src: a,
51
- variant: "circle"
52
- }
53
- ),
54
- /* @__PURE__ */ e("p", { className: "text-truncate", children: t.createdBy.displayName })
55
- ] }),
56
- /* @__PURE__ */ e(v, { variant: c.variant, children: c.text })
57
- ] });
58
- }, pe = ({
59
- collection: t
60
- }) => {
61
- const { appCode: o } = w(), { t: s } = D(o), {
62
- setHoveredSubmissionId: r,
63
- getBgColor: c,
64
- submissions: a,
65
- fetchNextPage: g,
66
- hasNextPage: i,
67
- isLoading: b
68
- } = W(t), { setSelectedSubmissionListMenu: h, selectedSubmissionListMenu: n } = B();
69
- k(() => {
70
- if (a.length === 0)
71
- return;
72
- a.some(
73
- (p) => p.id === (n == null ? void 0 : n.id)
74
- ) || h(a[0]);
75
- }, [
76
- n == null ? void 0 : n.id,
77
- h,
78
- a
79
- ]);
80
- const y = (m) => {
81
- h(m);
82
- };
83
- return /* @__PURE__ */ l("div", { className: "py-24 border-end h-100 bg-white rounded-start-4", children: [
84
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ l(u, { gap: "8", align: "center", className: "px-24 mb-16", children: [
85
- /* @__PURE__ */ e(
86
- u,
87
- {
88
- className: "bg-secondary-200 rounded",
89
- align: "center",
90
- justify: "center",
91
- style: { minWidth: "36px", height: "36px" },
92
- children: /* @__PURE__ */ e(ee, {})
93
- }
94
- ),
95
- /* @__PURE__ */ e(O, { level: "h4", headingStyle: "h4", className: "text-truncate", children: s("collection.submissionList.title") }),
96
- /* @__PURE__ */ e(
97
- v,
98
- {
99
- variant: {
100
- type: "chip"
101
- },
102
- children: a.length
103
- }
104
- )
105
- ] }) }),
106
- b ? /* @__PURE__ */ e(T, {}) : a.length > 0 && /* @__PURE__ */ l("div", { className: "table-submissions", children: [
107
- /* @__PURE__ */ e(C, { "data-testid": "collect-collection-submissions-list-table", children: /* @__PURE__ */ e(C.Tbody, { children: a.map((m) => {
108
- const p = c(m);
109
- return /* @__PURE__ */ e(
110
- C.Tr,
111
- {
112
- "data-testid": "collect-collection-submissions-list-row",
113
- onMouseEnter: () => r(m.id),
114
- onMouseLeave: () => r(null),
115
- onClick: () => y(m),
116
- children: /* @__PURE__ */ e(
117
- C.Td,
118
- {
119
- className: `p-16 c-pointer ${p} ${(n == null ? void 0 : n.id) === m.id ? "bg-secondary-200" : ""}`,
120
- style: { maxWidth: 0 },
121
- children: /* @__PURE__ */ e(V, { submission: m })
122
- }
123
- )
124
- },
125
- m.id
126
- );
127
- }) }) }),
128
- i && /* @__PURE__ */ e(u, { justify: "center", className: "mt-16", children: /* @__PURE__ */ e(
129
- x,
130
- {
131
- "data-testid": "collect-collection-submissions-list-button-more",
132
- className: "px-48",
133
- type: "button",
134
- color: "secondary",
135
- variant: "filled",
136
- rightIcon: /* @__PURE__ */ e(U, {}),
137
- onClick: () => g(),
138
- children: s("collection.see.more")
139
- }
140
- ) })
141
- ] })
142
- ] });
143
- }, be = ({
144
- collection: t
145
- }) => {
146
- const { appCode: o } = w(), { t: s } = D(o), r = $(), { isInstructionModalOpen: c, onCloseInstructionModal: a } = E((i) => ({
147
- isInstructionModalOpen: i.isInstructionModalOpen,
148
- onCloseInstructionModal: i.onCloseInstructionModal
149
- })), g = () => {
150
- a(), r(`/id/${t.id}/form`);
151
- };
152
- return /* @__PURE__ */ l(
153
- I,
154
- {
155
- id: "instruction-modal",
156
- isOpen: c,
157
- onModalClose: a,
158
- size: "lg",
159
- children: [
160
- /* @__PURE__ */ e(I.Header, { onModalClose: a, children: s("collection.submission.instruction.title") }),
161
- /* @__PURE__ */ e(I.Body, { children: /* @__PURE__ */ e(
162
- H,
163
- {
164
- content: t.content,
165
- mode: "read",
166
- toolbar: "none",
167
- variant: "ghost"
168
- }
169
- ) }),
170
- /* @__PURE__ */ l(I.Footer, { children: [
171
- /* @__PURE__ */ e(
172
- x,
173
- {
174
- "data-testid": "collect-collection-modal-instruction-button-close",
175
- color: "tertiary",
176
- variant: "ghost",
177
- onClick: a,
178
- children: s("collection.cancel")
179
- }
180
- ),
181
- /* @__PURE__ */ e(
182
- x,
183
- {
184
- "data-testid": "collect-collection-modal-instruction-button-edit",
185
- onClick: g,
186
- leftIcon: /* @__PURE__ */ e(te, {}),
187
- children: s("collection.modify")
188
- }
189
- )
190
- ] })
191
- ]
192
- }
193
- );
194
- }, fe = ({
195
- collection: t
196
- }) => {
197
- const { appCode: o } = w(), { t: s } = D(o), { getAvatarURL: r } = R(), { submissions: c, fetchNextPage: a, hasNextPage: g, isLoading: i } = W(t), { getSubmissionStatus: b } = F(), { setSelectedSubmissionListMenu: h, selectedSubmissionListMenu: n } = B((d) => ({
198
- selectedSubmissionListMenu: d.selectedSubmissionListMenu,
199
- setSelectedSubmissionListMenu: d.setSelectedSubmissionListMenu
200
- })), y = E.use.isPastDeadline();
201
- k(() => {
202
- if (c.length === 0)
203
- return;
204
- c.some(
205
- (S) => S.id === (n == null ? void 0 : n.id)
206
- ) || h(c[0] ?? null);
207
- }, [
208
- n == null ? void 0 : n.id,
209
- h,
210
- c
211
- ]);
212
- const m = c.find((d) => d.id === (n == null ? void 0 : n.id)) ?? c[0];
213
- if (!m)
214
- return null;
215
- const p = (d) => {
216
- h(d);
217
- };
218
- return /* @__PURE__ */ e("div", { className: "position-relative w-100 p-8 ", children: /* @__PURE__ */ e("div", { className: "bg-white", children: i ? /* @__PURE__ */ e(T, {}) : /* @__PURE__ */ l(
219
- N,
220
- {
221
- block: !0,
222
- "data-testid": "collect-collection-submissions-list-dropdown-mobile",
223
- children: [
224
- /* @__PURE__ */ e(
225
- N.Trigger,
226
- {
227
- label: /* @__PURE__ */ e(
228
- V,
229
- {
230
- submission: m
231
- },
232
- m.id
233
- )
234
- }
235
- ),
236
- /* @__PURE__ */ l(N.Menu, { children: [
237
- c.map((d) => {
238
- const S = b({
239
- status: d.status,
240
- isPastDeadline: y
241
- });
242
- return /* @__PURE__ */ e(
243
- N.Item,
244
- {
245
- onClick: () => p(d),
246
- "data-testid": "collect-collection-submissions-list-dropdown-item-mobile",
247
- children: /* @__PURE__ */ l(
248
- u,
249
- {
250
- justify: "between",
251
- align: "center",
252
- className: "w-100",
253
- gap: "8",
254
- children: [
255
- /* @__PURE__ */ l(u, { align: "center", gap: "12", style: { minWidth: 0 }, children: [
256
- /* @__PURE__ */ e(
257
- P,
258
- {
259
- alt: d.createdBy.displayName,
260
- size: "xs",
261
- src: r(d.createdBy.entId, "user"),
262
- variant: "circle"
263
- }
264
- ),
265
- /* @__PURE__ */ e("p", { className: "text-truncate", children: d.createdBy.displayName })
266
- ] }),
267
- /* @__PURE__ */ e(v, { variant: S.variant, children: S.text })
268
- ]
269
- }
270
- )
271
- },
272
- d.id
273
- );
274
- }),
275
- g && /* @__PURE__ */ e(u, { justify: "center", className: "mt-8", children: /* @__PURE__ */ e(
276
- x,
277
- {
278
- "data-testid": "collect-collection-submissions-list-dropdown-button-more-mobile",
279
- className: "px-48",
280
- type: "button",
281
- color: "secondary",
282
- variant: "filled",
283
- rightIcon: /* @__PURE__ */ e(U, {}),
284
- onClick: () => a(),
285
- children: s("collection.see.more")
286
- }
287
- ) })
288
- ] })
289
- ]
290
- }
291
- ) }) });
292
- }, ye = ({
293
- collectionId: t
294
- }) => {
295
- const { appCode: o } = w(), { t: s } = D(o), r = G(), { lg: c } = j(), [a, g] = A(!1), { selectedSubmissionListMenu: i, setSelectedSubmissionListMenu: b } = B(), h = (i == null ? void 0 : i.status) === f.VERIFIED, { formatDate: n } = _(), y = oe(), m = async (p) => {
296
- if (i)
297
- try {
298
- g(!0), await y.mutateAsync({
299
- collectionId: t,
300
- submissionId: i.id,
301
- data: {
302
- status: p ? M.VERIFIED : M.SUBMITTED
303
- }
304
- }), b({
305
- ...i,
306
- status: p ? f.VERIFIED : f.SUBMITTED
307
- }), r.success(s("collection.toast.success.submission.statusUpdate"));
308
- } catch (d) {
309
- console.error("Error updating submission status:", d), r.error(s("collection.toast.error.submission.statusUpdate"));
310
- } finally {
311
- g(!1);
312
- }
313
- };
314
- return /* @__PURE__ */ l(
315
- u,
316
- {
317
- className: "p-24 bg-white rounded-end-4 h-100",
318
- direction: "column",
319
- gap: "16",
320
- children: [
321
- /* @__PURE__ */ l(
322
- u,
323
- {
324
- className: "mb-16",
325
- justify: "between",
326
- direction: c ? "row" : "column",
327
- align: c ? "center" : "start",
328
- gap: "16",
329
- children: [
330
- /* @__PURE__ */ l(u, { gap: "8", align: "center", children: [
331
- /* @__PURE__ */ e(
332
- u,
333
- {
334
- className: "bg-secondary-200 rounded",
335
- align: "center",
336
- justify: "center",
337
- style: { minWidth: "36px", height: "36px" },
338
- children: /* @__PURE__ */ e(se, {})
339
- }
340
- ),
341
- /* @__PURE__ */ e(O, { level: "h4", headingStyle: "h4", className: "text-truncate", children: `${s("collection.submissionRender.title")} ${i == null ? void 0 : i.createdBy.displayName}` })
342
- ] }),
343
- /* @__PURE__ */ e(u, { justify: "end", children: i && [f.SUBMITTED, f.VERIFIED].includes(
344
- i.status
345
- ) && /* @__PURE__ */ e(
346
- v,
347
- {
348
- className: "lh-base",
349
- style: { height: "3rem" },
350
- variant: {
351
- level: "info",
352
- type: "notification"
353
- },
354
- children: /* @__PURE__ */ l(u, { align: "center", gap: "8", children: [
355
- /* @__PURE__ */ e(ne, { height: 20, width: 20 }),
356
- `${s("collection.submissionRender.date")} ${n(i.updatedAt)}`
357
- ] })
358
- }
359
- ) })
360
- ]
361
- }
362
- ),
363
- i && /* @__PURE__ */ l(Q, { children: [
364
- /* @__PURE__ */ e(
365
- H,
366
- {
367
- id: "submissionRead",
368
- content: i.content ?? "",
369
- mode: "read",
370
- variant: "ghost"
371
- }
372
- ),
373
- i.status === f.EMPTY ? /* @__PURE__ */ e(
374
- J,
375
- {
376
- imageSrc: he,
377
- title: s("collection.collectionList.emptyScreen.title"),
378
- text: s("collection.submissionRender.emptyScreen.description")
379
- }
380
- ) : i.status !== f.DRAFT ? /* @__PURE__ */ e(u, { justify: "end", children: /* @__PURE__ */ e(
381
- "div",
382
- {
383
- className: `border rounded p-8 ${h ? "bg-secondary-200 border-secondary" : ""}`,
384
- children: /* @__PURE__ */ e(
385
- K,
386
- {
387
- "data-testid": "collect-collection-submissions-list-checkbox-validate",
388
- checked: h,
389
- label: s("collection.submissionRender.checkbox.label"),
390
- onChange: () => m(!h),
391
- disabled: a
392
- }
393
- )
394
- }
395
- ) }) : null
396
- ] })
397
- ]
398
- }
399
- );
400
- }, Se = ({
401
- collection: t
402
- }) => {
403
- const o = $(), { lg: s } = j(), r = E.use.setIsPastDeadline();
404
- return r(new Date(t.deadline) < /* @__PURE__ */ new Date()), k(() => {
405
- r(new Date(t.deadline) < /* @__PURE__ */ new Date());
406
- }, [t.deadline]), /* @__PURE__ */ l(
407
- u,
408
- {
409
- className: "bg-gray-200 mx-n16 flex-fill border-bottom-0 border",
410
- direction: "column",
411
- children: [
412
- /* @__PURE__ */ e(
413
- Z,
414
- {
415
- collection: t,
416
- context: q.COLLECTION,
417
- onClickBack: () => o("/list-collections")
418
- }
419
- ),
420
- /* @__PURE__ */ l(L, { className: "flex-grow-1 m-16 gap-24", children: [
421
- /* @__PURE__ */ e(
422
- L.Col,
423
- {
424
- sm: "3",
425
- md: "3",
426
- lg: "3",
427
- xl: "4",
428
- className: "d-none d-lg-block",
429
- as: "aside",
430
- children: /* @__PURE__ */ e(pe, { collection: t })
431
- }
432
- ),
433
- /* @__PURE__ */ l(
434
- L.Col,
435
- {
436
- sm: "4",
437
- md: "8",
438
- lg: "5",
439
- xl: "8",
440
- className: `${s ? "cancel-gap me-0" : ""}`,
441
- children: [
442
- !s && /* @__PURE__ */ e(fe, { collection: t }),
443
- /* @__PURE__ */ e(ye, { collectionId: t.id })
444
- ]
445
- }
446
- )
447
- ] }),
448
- /* @__PURE__ */ e(
449
- me,
450
- {
451
- onDeleteSuccess: () => o("/list-collections")
452
- }
453
- ),
454
- /* @__PURE__ */ e(be, { collection: t })
455
- ]
456
- }
457
- );
458
- }, je = (t) => async ({ params: o }) => {
459
- const s = Number(o.collectionId);
460
- return await t.ensureQueryData(ue(s)), await t.prefetchInfiniteQuery(
461
- ae(s)
462
- ), null;
463
- }, $e = () => {
464
- const t = X(), o = Y(z.COLLECTION_CREATE), { data: s, isLoading: r } = re(
465
- Number(t.collectionId)
466
- );
467
- return r ? /* @__PURE__ */ e(T, {}) : !o || !s ? /* @__PURE__ */ e(de, {}) : /* @__PURE__ */ e(Se, { collection: s });
468
- };
469
- export {
470
- $e as Collection,
471
- je as loader
472
- };