@edifice.io/collect-frontend 0.2.0 → 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.
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/lib/index.js ADDED
@@ -0,0 +1,9 @@
1
+ import { ac as r, ad as o, ae as s, af as t, ag as p } from "./index-HU8ua_Ev.js";
2
+ export * from "@edifice.io/collect-client-rest";
3
+ export {
4
+ r as CollectApp,
5
+ o as Providers,
6
+ s as basename,
7
+ t as queryClient,
8
+ p as router
9
+ };
package/lib/style.css ADDED
@@ -0,0 +1 @@
1
+ .table-collections table,.table-submissions table{border-radius:0}.btn.icon-button-hover-no-transition,.btn.icon-button-hover-no-transition span{transition:none}.separator-dashed{height:1px;--color: var(--edifice-gray-400);--dash: 8px;--gap: 6px;background:repeating-linear-gradient(90deg,var(--color) 0 var(--dash),transparent var(--dash) calc(var(--dash) + var(--gap)))}.cancel-gap{margin-left:calc(var(--edifice-gap) * -1);margin-right:-2.4rem}.collectionDescription .tiptap{min-height:150px}#submissionEdit .tiptap{min-height:350px}.wrapper{display:grid;grid-template-rows:0fr;transition:grid-template-rows .25s ease,margin-top .25s ease}.wrapper.open{grid-template-rows:1fr;margin-top:12px}.inner{overflow:hidden}.user-rights-list .table-responsive{max-height:70vh}.user-rights-list .table-responsive table{overflow:visible}.user-rights-list .table-responsive table thead{z-index:1}
@@ -0,0 +1,86 @@
1
+ import { useQuery as S, useQueryClient as a, useMutation as m, useInfiniteQuery as b } from "@tanstack/react-query";
2
+ import { S as c } from "./index-HU8ua_Ev.js";
3
+ import { odeServices as p } from "@edifice.io/client";
4
+ import { SubmissionClient as y } from "@edifice.io/collect-client-rest";
5
+ const d = "/collect/api", n = new y({
6
+ httpService: p.http(),
7
+ baseUrl: d
8
+ }), u = {
9
+ getSubmissions: (e, s) => n.getSubmissions(e, s),
10
+ getSubmission: (e, s) => n.getSubmission(e, s),
11
+ updateSubmission: (e, s, i) => n.updateSubmission(e, s, i),
12
+ updateSubmissionStatus: (e, s, i) => n.updateSubmissionStatus(e, s, i)
13
+ }, o = {
14
+ base: ["submissions"]
15
+ }, l = (e, s) => ({
16
+ queryKey: [...o.base, e, s],
17
+ queryFn: ({ pageParam: i = 1 }) => u.getSubmissions(e, {
18
+ ...s,
19
+ size: c,
20
+ page: i
21
+ }),
22
+ staleTime: 5e3,
23
+ initialPageParam: 1,
24
+ refetchOnMount: !0,
25
+ getNextPageParam: (i) => {
26
+ const { currentPage: t, totalPages: r } = i.meta || {};
27
+ return t < r ? t + 1 : void 0;
28
+ }
29
+ }), O = (e, s) => b(l(e, s)), g = (e, s) => ({
30
+ queryKey: ["submission", s, e],
31
+ queryFn: () => u.getSubmission(e, s),
32
+ staleTime: 0
33
+ }), U = (e, s) => S({
34
+ ...g(e, s),
35
+ enabled: !!s
36
+ }), _ = () => {
37
+ const e = a();
38
+ return m({
39
+ mutationFn: ({
40
+ collectionId: s,
41
+ submissionId: i,
42
+ data: t
43
+ }) => u.updateSubmission(s, i, t),
44
+ onSuccess: () => {
45
+ e.invalidateQueries({
46
+ queryKey: [
47
+ ...o.base,
48
+ "submission",
49
+ "collectionsToSubmit"
50
+ ]
51
+ });
52
+ }
53
+ });
54
+ }, v = () => {
55
+ const e = a();
56
+ return m({
57
+ mutationFn: ({
58
+ collectionId: s,
59
+ submissionId: i,
60
+ data: t
61
+ }) => u.updateSubmissionStatus(
62
+ s,
63
+ i,
64
+ t
65
+ ),
66
+ onSuccess: (s, i) => {
67
+ e.invalidateQueries({
68
+ queryKey: o.base
69
+ }), i && e.invalidateQueries({
70
+ queryKey: [
71
+ "submission",
72
+ i.submissionId,
73
+ i.collectionId
74
+ ]
75
+ });
76
+ }
77
+ });
78
+ };
79
+ export {
80
+ v as a,
81
+ _ as b,
82
+ U as c,
83
+ g as d,
84
+ l as s,
85
+ O as u
86
+ };
@@ -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": "0.2.0",
3
+ "version": "0.2.2-develop-pedago.3",
4
4
  "private": false,
5
5
  "license": "GPL-3.0",
6
6
  "author": "Edifice",
@@ -17,7 +17,7 @@
17
17
  "prebuild": "pnpm install",
18
18
  "pre-commit": "lint-staged",
19
19
  "preview": "vite preview",
20
- "prune:prod": "CI=true NPM_CONFIG_IGNORE_SCRIPTS=true pnpm prune --prod --production --loglevel verbose",
20
+ "prune:prod": "CI=true NPM_CONFIG_IGNORE_SCRIPTS=true pnpm prune --prod --production --loglevel verbose || true",
21
21
  "test": "vitest",
22
22
  "test:coverage": "vitest run --coverage",
23
23
  "test:ui": "vitest --ui",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@edifice.io/bootstrap": "develop-pedago",
30
- "@edifice.io/collect-client-rest": "workspace:*",
30
+ "@edifice.io/collect-client-rest": "develop-pedago",
31
31
  "@edifice.io/client": "develop-pedago",
32
32
  "@edifice.io/react": "develop-pedago",
33
33
  "@react-spring/web": "9.7.5",
@@ -72,6 +72,7 @@
72
72
  "msw": "2.11.2",
73
73
  "nx": "19.6.0",
74
74
  "vite": "5.4.20",
75
+ "vite-plugin-dts": "4.5.4",
75
76
  "vite-tsconfig-paths": "5.1.4"
76
77
  },
77
78
  "packageManager": "pnpm@9.12.2",