@edifice.io/collect-frontend 1.0.12 → 1.0.13
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-Bvug8wqR.js +203 -0
- package/lib/CXEL7IU7-KQqTZW3I.js +42 -0
- package/lib/Collection-CMoQA79H.js +506 -0
- package/lib/CollectionsLayout-wmt1jR8l.js +100 -0
- package/lib/CollectionsList-Avkiw1Aj.js +324 -0
- package/lib/DeleteCollectionModal-CE4XaECV.js +71 -0
- package/lib/DropdownActionTable-CcA3rys3.js +84 -0
- package/lib/FormEdit-BK8fEwW4.js +111 -0
- package/lib/HASRA6WW-BbBPIcpK.js +9093 -0
- package/lib/I3HPI4QX-C5m1qr_y.js +33 -0
- package/lib/MembersEdit-79qps5R2.js +81 -0
- package/lib/MineSubmission-m_qn8e0j.js +27 -0
- package/lib/Root-DzV0pyeC.js +20 -0
- package/lib/SearchBarCollect-DBKaVVDV.js +23 -0
- package/lib/Submission-BnaHLVUo.js +337 -0
- package/lib/SubmissionList-DI5paav0.js +204 -0
- package/lib/emptyscreen-list-collection-CWGxO4Ss.js +4 -0
- package/lib/index-CIhvqYOt.js +3856 -0
- package/lib/index.js +19 -15071
- package/lib/routes/index.d.ts +13 -0
- package/lib/store/createSelectors.d.ts +1 -2
- package/lib/store/submissionActionStore.d.ts +26 -0
- package/lib/submission.queries-D13BY7hC.js +147 -0
- package/lib/useGetStatusSubmission-DxHmLPxr.js +57 -0
- package/package.json +5 -5
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { RouteObject, createBrowserRouter } from 'react-router-dom';
|
|
3
|
+
export interface RoutesOptions {
|
|
4
|
+
header?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const routes: (queryClient: QueryClient, options?: RoutesOptions) => RouteObject[];
|
|
7
|
+
export declare const basename: string;
|
|
8
|
+
/**
|
|
9
|
+
* Creates the browser router instance for the app.
|
|
10
|
+
* Pass the queryClient for data-aware routes.
|
|
11
|
+
* Pass options for additional configuration (e.g., header=false for headless mode)
|
|
12
|
+
*/
|
|
13
|
+
export declare const router: (queryClient: QueryClient, options?: RoutesOptions) => ReturnType<typeof createBrowserRouter>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StoreApi, UseBoundStore } from 'zustand';
|
|
2
|
-
type WithSelectors<S> = S extends {
|
|
2
|
+
export type WithSelectors<S> = S extends {
|
|
3
3
|
getState: () => infer T;
|
|
4
4
|
} ? S & {
|
|
5
5
|
use: {
|
|
@@ -7,4 +7,3 @@ type WithSelectors<S> = S extends {
|
|
|
7
7
|
};
|
|
8
8
|
} : never;
|
|
9
9
|
export declare const createSelectors: <S extends UseBoundStore<StoreApi<object>>>(_store: S) => WithSelectors<S>;
|
|
10
|
-
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SubmissionDto } from '@edifice.io/collect-client-rest';
|
|
2
|
+
import { SingleAttachmentType } from '@edifice.io/react';
|
|
3
|
+
import { StoreApi, UseBoundStore } from 'zustand';
|
|
4
|
+
import { WithSelectors } from './createSelectors';
|
|
5
|
+
export interface SubmissionActionState {
|
|
6
|
+
submissionId: number | null;
|
|
7
|
+
submissionUpdatedAt: SubmissionDto["updatedAt"] | null;
|
|
8
|
+
submissionContent: string;
|
|
9
|
+
submissionAttachments: SingleAttachmentType[];
|
|
10
|
+
submissionPersistedAttachmentIds: number[];
|
|
11
|
+
submissionAttachmentIdsToDelete: number[];
|
|
12
|
+
isUpdateSubmissionModalOpen: boolean;
|
|
13
|
+
submissionHasContent: boolean;
|
|
14
|
+
submissionIsLoading: boolean;
|
|
15
|
+
onOpenUpdateSubmissionModal: () => void;
|
|
16
|
+
onCloseUpdateSubmissionModal: () => void;
|
|
17
|
+
setSubmissionContent: (content: string, hasContent: boolean) => void;
|
|
18
|
+
setSubmissionAttachments: (attachments: SingleAttachmentType[]) => void;
|
|
19
|
+
resetSubmissionAttachments: () => void;
|
|
20
|
+
setSubmissionPersistedAttachmentIds: (attachmentIds: number[]) => void;
|
|
21
|
+
addSubmissionAttachmentIdToDelete: (attachmentId: number) => void;
|
|
22
|
+
resetSubmissionAttachmentIdsToDelete: () => void;
|
|
23
|
+
setSubmissionIsLoading: (isLoading: boolean) => void;
|
|
24
|
+
hydrateSubmissionContent: (submission: SubmissionDto) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare const useSubmissionActionStore: WithSelectors<UseBoundStore<StoreApi<SubmissionActionState>>>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { useQuery as b, useQueryClient as a, useMutation as m, useInfiniteQuery as d } from "@tanstack/react-query";
|
|
2
|
+
import { y } from "./index-CIhvqYOt.js";
|
|
3
|
+
import { odeServices as c } from "@edifice.io/client";
|
|
4
|
+
import { SubmissionClient as l } from "@edifice.io/collect-client-rest";
|
|
5
|
+
const S = "/collect/api", u = new l({
|
|
6
|
+
httpService: c.http(),
|
|
7
|
+
baseUrl: S
|
|
8
|
+
}), n = {
|
|
9
|
+
getSubmissions: (e, s) => u.getSubmissions(e, s),
|
|
10
|
+
getSubmission: (e, s) => u.getSubmission(e, s),
|
|
11
|
+
updateSubmission: (e, s, t) => u.updateSubmission(e, s, t),
|
|
12
|
+
addAttachments: async (e, s, t) => {
|
|
13
|
+
const i = new FormData();
|
|
14
|
+
return t.files.forEach((r) => {
|
|
15
|
+
i.append("files", r);
|
|
16
|
+
}), c.http().postFile(
|
|
17
|
+
`${S}/collections/${e}/submissions/${s}/attachments`,
|
|
18
|
+
i,
|
|
19
|
+
{ headers: { "Content-Type": "multipart/form-data" } }
|
|
20
|
+
);
|
|
21
|
+
},
|
|
22
|
+
updateSubmissionStatus: (e, s, t) => u.updateSubmissionStatus(e, s, t),
|
|
23
|
+
deleteAttachment: (e, s, t) => u.removeAttachments(
|
|
24
|
+
e,
|
|
25
|
+
s,
|
|
26
|
+
t
|
|
27
|
+
)
|
|
28
|
+
}, o = {
|
|
29
|
+
base: ["submissions"]
|
|
30
|
+
}, p = (e, s) => ({
|
|
31
|
+
queryKey: [...o.base, e, s],
|
|
32
|
+
queryFn: ({ pageParam: t = 1 }) => n.getSubmissions(e, {
|
|
33
|
+
...s,
|
|
34
|
+
size: y,
|
|
35
|
+
page: t
|
|
36
|
+
}),
|
|
37
|
+
staleTime: 5e3,
|
|
38
|
+
initialPageParam: 1,
|
|
39
|
+
refetchOnMount: !0,
|
|
40
|
+
getNextPageParam: (t) => {
|
|
41
|
+
const { currentPage: i, totalPages: r } = t.meta || {};
|
|
42
|
+
return i < r ? i + 1 : void 0;
|
|
43
|
+
}
|
|
44
|
+
}), A = (e, s) => d(p(e, s)), f = (e, s) => ({
|
|
45
|
+
queryKey: ["submission", s, e],
|
|
46
|
+
queryFn: () => n.getSubmission(e, s),
|
|
47
|
+
staleTime: 0
|
|
48
|
+
}), C = (e, s) => b({
|
|
49
|
+
...f(e, s),
|
|
50
|
+
enabled: !!s
|
|
51
|
+
}), K = () => {
|
|
52
|
+
const e = a();
|
|
53
|
+
return m({
|
|
54
|
+
mutationFn: ({
|
|
55
|
+
collectionId: s,
|
|
56
|
+
submissionId: t,
|
|
57
|
+
data: i
|
|
58
|
+
}) => n.updateSubmission(s, t, i),
|
|
59
|
+
onSuccess: () => {
|
|
60
|
+
e.invalidateQueries({
|
|
61
|
+
queryKey: [
|
|
62
|
+
...o.base,
|
|
63
|
+
"submission",
|
|
64
|
+
"collectionsToSubmit"
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}, F = () => {
|
|
70
|
+
const e = a();
|
|
71
|
+
return m({
|
|
72
|
+
mutationFn: ({
|
|
73
|
+
collectionId: s,
|
|
74
|
+
submissionId: t,
|
|
75
|
+
data: i
|
|
76
|
+
}) => n.updateSubmissionStatus(
|
|
77
|
+
s,
|
|
78
|
+
t,
|
|
79
|
+
i
|
|
80
|
+
),
|
|
81
|
+
onSuccess: (s, t) => {
|
|
82
|
+
e.invalidateQueries({
|
|
83
|
+
queryKey: o.base
|
|
84
|
+
}), t && e.invalidateQueries({
|
|
85
|
+
queryKey: [
|
|
86
|
+
"submission",
|
|
87
|
+
t.submissionId,
|
|
88
|
+
t.collectionId
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}, I = () => {
|
|
94
|
+
const e = a();
|
|
95
|
+
return m({
|
|
96
|
+
mutationFn: ({
|
|
97
|
+
collectionId: s,
|
|
98
|
+
submissionId: t,
|
|
99
|
+
files: i
|
|
100
|
+
}) => n.addAttachments(s, t, i),
|
|
101
|
+
onSuccess: (s, t) => {
|
|
102
|
+
e.invalidateQueries({
|
|
103
|
+
queryKey: o.base
|
|
104
|
+
}), t && e.invalidateQueries({
|
|
105
|
+
queryKey: [
|
|
106
|
+
"submission",
|
|
107
|
+
t.submissionId,
|
|
108
|
+
t.collectionId
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}, O = () => {
|
|
114
|
+
const e = a();
|
|
115
|
+
return m({
|
|
116
|
+
mutationFn: ({
|
|
117
|
+
collectionId: s,
|
|
118
|
+
submissionId: t,
|
|
119
|
+
attachmentId: i
|
|
120
|
+
}) => n.deleteAttachment(
|
|
121
|
+
s,
|
|
122
|
+
t,
|
|
123
|
+
i
|
|
124
|
+
),
|
|
125
|
+
onSuccess: (s, t) => {
|
|
126
|
+
e.invalidateQueries({
|
|
127
|
+
queryKey: o.base
|
|
128
|
+
}), t && e.invalidateQueries({
|
|
129
|
+
queryKey: [
|
|
130
|
+
"submission",
|
|
131
|
+
t.submissionId,
|
|
132
|
+
t.collectionId
|
|
133
|
+
]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
export {
|
|
139
|
+
F as a,
|
|
140
|
+
K as b,
|
|
141
|
+
I as c,
|
|
142
|
+
O as d,
|
|
143
|
+
C as e,
|
|
144
|
+
f,
|
|
145
|
+
p as s,
|
|
146
|
+
A as u
|
|
147
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SubmissionStatus as n } from "@edifice.io/collect-client-rest";
|
|
2
|
+
import { useEdificeClient as a } from "@edifice.io/react";
|
|
3
|
+
import { useTranslation as r } from "react-i18next";
|
|
4
|
+
function f() {
|
|
5
|
+
const { appCode: u } = a(), { t } = r(u), s = (o) => ({
|
|
6
|
+
background: !0,
|
|
7
|
+
level: o,
|
|
8
|
+
type: "content"
|
|
9
|
+
}), c = () => ({
|
|
10
|
+
level: "success",
|
|
11
|
+
type: "notification"
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
getSubmissionStatus: ({
|
|
15
|
+
status: o,
|
|
16
|
+
isPastDeadline: i,
|
|
17
|
+
isSubmissionCard: e = !1
|
|
18
|
+
}) => {
|
|
19
|
+
switch (o) {
|
|
20
|
+
case n.SUBMITTED:
|
|
21
|
+
return {
|
|
22
|
+
text: t("collection.submission.status.submitted"),
|
|
23
|
+
variant: s("success")
|
|
24
|
+
};
|
|
25
|
+
case n.EMPTY:
|
|
26
|
+
return {
|
|
27
|
+
text: t(
|
|
28
|
+
i ? "Non rendu" : "collection.submission.status.toSubmit"
|
|
29
|
+
),
|
|
30
|
+
variant: s(i ? "danger" : "warning")
|
|
31
|
+
};
|
|
32
|
+
case n.DRAFT:
|
|
33
|
+
return {
|
|
34
|
+
text: t(
|
|
35
|
+
i ? "collection.submission.status.submitted" : "collection.submission.status.toSubmit"
|
|
36
|
+
),
|
|
37
|
+
variant: s(i ? "success" : "warning")
|
|
38
|
+
};
|
|
39
|
+
case n.VERIFIED:
|
|
40
|
+
return {
|
|
41
|
+
text: t(
|
|
42
|
+
e ? "collection.submission.status.submitted" : "collection.submission.status.verified"
|
|
43
|
+
),
|
|
44
|
+
variant: e ? s("success") : c()
|
|
45
|
+
};
|
|
46
|
+
default:
|
|
47
|
+
return {
|
|
48
|
+
text: t("collection.submissionsList.status.toSubmit"),
|
|
49
|
+
variant: s("warning")
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
f as u
|
|
57
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/collect-frontend",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"author": "Edifice",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"react-pdf": "10.2.0",
|
|
18
18
|
"react-router-dom": "6.30.3",
|
|
19
19
|
"zustand": "4.5.7",
|
|
20
|
-
"@edifice.io/collect-client-rest": "1.0.
|
|
20
|
+
"@edifice.io/collect-client-rest": "1.0.13"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@edifice.io/bootstrap": "*",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@axe-core/react": "4.10.2",
|
|
33
|
-
"@edifice.io/bootstrap": "2.6.
|
|
34
|
-
"@edifice.io/client": "2.6.
|
|
35
|
-
"@edifice.io/react": "2.6.
|
|
33
|
+
"@edifice.io/bootstrap": "2.6.14",
|
|
34
|
+
"@edifice.io/client": "2.6.14",
|
|
35
|
+
"@edifice.io/react": "2.6.14",
|
|
36
36
|
"@tanstack/react-query": "5.81.5",
|
|
37
37
|
"@tanstack/react-query-devtools": "5.81.5",
|
|
38
38
|
"@testing-library/jest-dom": "6.5.0",
|