imio.smartweb.core 1.2.47__py3-none-any.whl → 1.2.49__py3-none-any.whl

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 (77) hide show
  1. imio/smartweb/core/contents/rest/base.py +8 -6
  2. imio/smartweb/core/contents/rest/directory/endpoint.py +2 -2
  3. imio/smartweb/core/contents/rest/events/endpoint.py +2 -2
  4. imio/smartweb/core/contents/rest/news/endpoint.py +2 -2
  5. imio/smartweb/core/contents/sections/events/view.py +2 -1
  6. imio/smartweb/core/contents/sections/news/view.py +2 -1
  7. imio/smartweb/core/contents/sections/text/views.py +2 -0
  8. imio/smartweb/core/contents/sections/views.py +2 -0
  9. imio/smartweb/core/tests/resources/json_rest_events.json +4 -1
  10. imio/smartweb/core/tests/test_rest.py +20 -17
  11. imio/smartweb/core/tests/test_section_events.py +9 -8
  12. imio/smartweb/core/tests/test_section_news.py +6 -6
  13. imio/smartweb/core/tests/test_vocabularies.py +2 -2
  14. imio/smartweb/core/utils.py +1 -1
  15. imio/smartweb/core/viewlets/footer.pt +5 -0
  16. imio/smartweb/core/viewlets/footer.py +5 -0
  17. imio/smartweb/core/vocabularies.py +2 -2
  18. imio/smartweb/core/webcomponents/build/css/373.smartweb-webcomponents-compiled.css +1 -1
  19. imio/smartweb/core/webcomponents/build/css/486.smartweb-webcomponents-compiled.css +1 -1
  20. imio/smartweb/core/webcomponents/build/css/884.smartweb-webcomponents-compiled.css +1 -0
  21. imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
  22. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +1 -1
  23. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js.LICENSE.txt +5 -0
  24. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +1 -1
  25. imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -1
  26. imio/smartweb/core/webcomponents/build/js/736.smartweb-webcomponents-compiled.js +1 -1
  27. imio/smartweb/core/webcomponents/build/js/736.smartweb-webcomponents-compiled.js.LICENSE.txt +3 -3
  28. imio/smartweb/core/webcomponents/build/js/884.smartweb-webcomponents-compiled.js +1 -0
  29. imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -1
  30. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
  31. imio/smartweb/core/webcomponents/package.json +1 -0
  32. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.jsx +112 -74
  33. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.scss +14 -22
  34. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactCard/ContactCard.jsx +24 -20
  35. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +6 -4
  36. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactList/ContactList.jsx +7 -2
  37. imio/smartweb/core/webcomponents/src/components/Annuaire/Filters/Filter.jsx +211 -98
  38. imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +1 -1
  39. imio/smartweb/core/webcomponents/src/components/Events/EventContent/EventContent.jsx +570 -379
  40. imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +13 -4
  41. imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +128 -82
  42. imio/smartweb/core/webcomponents/src/components/Events/Events.scss +79 -29
  43. imio/smartweb/core/webcomponents/src/components/Events/Filters/Filter.jsx +257 -90
  44. imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.jsx +63 -56
  45. imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.scss +60 -12
  46. imio/smartweb/core/webcomponents/src/components/Filters/IamData.jsx +42 -0
  47. imio/smartweb/core/webcomponents/src/components/Filters/MainFilter.scss +227 -0
  48. imio/smartweb/core/webcomponents/src/components/Filters/PublicTargetData.jsx +94 -0
  49. imio/smartweb/core/webcomponents/src/components/Filters/SelectStyles.js +58 -0
  50. imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.jsx +149 -0
  51. imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.scss +70 -0
  52. imio/smartweb/core/webcomponents/src/components/News/Filters/Filter.jsx +139 -82
  53. imio/smartweb/core/webcomponents/src/components/News/News.jsx +98 -55
  54. imio/smartweb/core/webcomponents/src/components/News/News.scss +29 -9
  55. imio/smartweb/core/webcomponents/src/components/News/NewsCard/NewsCard.jsx +34 -31
  56. imio/smartweb/core/webcomponents/src/components/News/NewsContent/NewsContent.jsx +264 -244
  57. imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +13 -8
  58. imio/smartweb/core/webcomponents/src/components/Search/ContactResult/ContactResult.jsx +23 -12
  59. imio/smartweb/core/webcomponents/src/components/Search/EventsResult/EventsResult.jsx +23 -12
  60. imio/smartweb/core/webcomponents/src/components/Search/Filters/Filter.jsx +5 -5
  61. imio/smartweb/core/webcomponents/src/components/Search/NewsResult/NewsResult.jsx +23 -12
  62. imio/smartweb/core/webcomponents/src/components/Search/Search.jsx +4 -4
  63. imio/smartweb/core/webcomponents/src/components/Search/WebResult/WebResult.jsx +13 -4
  64. imio/smartweb/core/webcomponents/src/index.jsx +3 -3
  65. imio/smartweb/core/webcomponents/src/index.scss +25 -68
  66. imio/smartweb/core/webcomponents/src/utils/Map.jsx +20 -11
  67. imio/smartweb/core/webcomponents/src/utils/translation.js +30 -0
  68. {imio.smartweb.core-1.2.47.dist-info → imio.smartweb.core-1.2.49.dist-info}/METADATA +30 -1
  69. {imio.smartweb.core-1.2.47.dist-info → imio.smartweb.core-1.2.49.dist-info}/RECORD +75 -69
  70. imio/smartweb/core/webcomponents/build/css/686.smartweb-webcomponents-compiled.css +0 -1
  71. imio/smartweb/core/webcomponents/build/js/686.smartweb-webcomponents-compiled.js +0 -1
  72. /imio.smartweb.core-1.2.47-py3.8-nspkg.pth → /imio.smartweb.core-1.2.49-py3.8-nspkg.pth +0 -0
  73. {imio.smartweb.core-1.2.47.dist-info → imio.smartweb.core-1.2.49.dist-info}/LICENSE.GPL +0 -0
  74. {imio.smartweb.core-1.2.47.dist-info → imio.smartweb.core-1.2.49.dist-info}/LICENSE.rst +0 -0
  75. {imio.smartweb.core-1.2.47.dist-info → imio.smartweb.core-1.2.49.dist-info}/WHEEL +0 -0
  76. {imio.smartweb.core-1.2.47.dist-info → imio.smartweb.core-1.2.49.dist-info}/namespace_packages.txt +0 -0
  77. {imio.smartweb.core-1.2.47.dist-info → imio.smartweb.core-1.2.49.dist-info}/top_level.txt +0 -0
@@ -1,34 +1,68 @@
1
+ .schedul-Filter {
2
+ width: 100%;
3
+
4
+ @media screen and (min-width:630px) {
5
+ width: auto;
6
+ }
7
+ }
8
+
1
9
  .period-filter {
10
+ width: 100%;
11
+
12
+ @media screen and (min-width:630px) {
13
+ width: auto;
14
+ }
15
+
2
16
  .period-filter-toggler {
17
+ width: 100%;
18
+
19
+ @media screen and (min-width:630px) {
20
+ width: auto;
21
+ }
22
+
3
23
  &>button {
24
+ display: flex;
25
+ justify-content: center;
26
+ align-items: center;
27
+ min-width: 150px;
4
28
  background: transparent;
5
29
  color: hsl(0, 0%, 20%);
6
30
  box-sizing: border-box;
7
31
  font-weight: bold;
8
- font-size: 12px;
9
- text-transform: uppercase;
10
- letter-spacing: 1.2px;
11
-
12
- -webkit-box-pack: justify;
13
- -webkit-justify-content: space-between;
14
- justify-content: space-between;
15
- min-height: 38px;
32
+ font-size: 14px;
33
+ letter-spacing: 1.4px;
34
+ text-align: left;
35
+ min-height: 30px;
16
36
  outline: 0 !important;
17
37
  position: relative;
18
38
  -webkit-transition: all 100ms;
19
39
  transition: all 100ms;
20
40
  background-color: white;
21
- border-color: hsl(0, 0%, 80%);
41
+ border-color: none;
22
42
  border-radius: 0;
23
- border-style: solid;
24
43
  border-width: 1px;
44
+ border: solid 1px #fff;
25
45
  box-sizing: border-box;
26
- height: 50px;
46
+ height: 40px;
47
+ border-radius: 10px;
48
+ width: 100%;
49
+
50
+ @media screen and (min-width:630px) {
51
+ width: auto;
52
+ }
53
+
54
+ @media screen and (max-width:629px) {
55
+ background-color: transparent;
56
+ border-color: hsl(0, 0%, 70%);
57
+ color: hsl(0, 0%, 20%);
58
+ border: solid 1px #CFCFCF;
59
+ }
27
60
 
28
61
  &:hover {
29
62
  background-color: transparent;
30
63
  border-color: hsl(0, 0%, 70%);
31
64
  color: hsl(0, 0%, 20%);
65
+ border: solid 1px #CFCFCF;
32
66
  }
33
67
 
34
68
  &:focus,
@@ -36,7 +70,21 @@
36
70
  border-color: #2684FF !important;
37
71
  background: transparent !important;
38
72
  color: hsl(0, 0%, 20%) !important;
39
- box-shadow: 0 0 0 1px #2684FF !important;
73
+ box-shadow: 0 0 0 2px #2684FF !important;
74
+ }
75
+
76
+ &:after {
77
+ content: "";
78
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='20' width='20' viewBox='0 0 20 20' aria-hidden='true' focusable='false' fill='%23CFCFCF' class='css-tj5bde-Svg'%3E%3Cpath d='M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z'%3E%3C/path%3E%3C/svg%3E");
79
+ display: inline-block;
80
+ width: 20px;
81
+ height: 20px;
82
+ background-repeat: no-repeat;
83
+ border: inherit;
84
+ border-color: transparent;
85
+ background-position: center;
86
+ vertical-align: bottom;
87
+ margin-left: auto;
40
88
  }
41
89
  }
42
90
  }
@@ -0,0 +1,42 @@
1
+ export const iam = [
2
+ {
3
+ label: "Commerçant",
4
+ value: "merchant",
5
+ },
6
+ {
7
+ label: "Demandeur d'emploi",
8
+ value: "job_seeker",
9
+ },
10
+ {
11
+ label: "En situation de handicap",
12
+ value: "disabled_person",
13
+ },
14
+ {
15
+ label: "Jeune",
16
+ value: "young",
17
+ },
18
+ {
19
+ label: "Journaliste",
20
+ value: "journalist",
21
+ },
22
+ {
23
+ label: "Nouvel arrivant",
24
+ value: "newcomer",
25
+ },
26
+ {
27
+ label: "Organisateur d'événement",
28
+ value: "event_planner",
29
+ },
30
+ {
31
+ label: "Parent",
32
+ value: "parent",
33
+ },
34
+ {
35
+ label: "Senior",
36
+ value: "elder",
37
+ },
38
+ {
39
+ label: "Touriste",
40
+ value: "tourist",
41
+ },
42
+ ];
@@ -0,0 +1,227 @@
1
+ .r-result-filter-container {
2
+ @media screen and (min-width:1200px) {
3
+ position: sticky;
4
+ }
5
+ z-index: 1;
6
+ background: #fff;
7
+ &:after {
8
+ content: "";
9
+ background: #fff;
10
+ position: absolute;
11
+ left: 0;
12
+ right: 0;
13
+ height: 312px;
14
+ top: 0;
15
+ transform: translateY(-100%);
16
+ }
17
+ .r-result-filter {
18
+ padding-top: 1rem;
19
+ padding-bottom: 1rem;
20
+ border-bottom: solid 1px #cccc;
21
+ position: relative;
22
+ }
23
+ }
24
+
25
+ .r-results-numbers {
26
+ width: 100%;
27
+ margin-bottom: 0rem;
28
+ padding-top: 1rem;
29
+
30
+ span {
31
+ font-weight: bold;
32
+ }
33
+ }
34
+
35
+ .r-result-filter {
36
+ position: relative;
37
+ }
38
+ // react filter menu
39
+
40
+ .react-filters-menu {
41
+ display: flex;
42
+ width: 100%;
43
+ margin-bottom: 1rem;
44
+
45
+ .react-filters-container {
46
+ display: flex;
47
+ align-items: flex-start;
48
+ position: relative;
49
+ flex-direction: column;
50
+ width: auto;
51
+ border-radius: 30px;
52
+ gap: 10px;
53
+ background: #fff;
54
+ width: 100%;
55
+
56
+ @media screen and (min-width:630px) {
57
+ align-items: center;
58
+ flex-direction: row;
59
+ width: auto;
60
+ padding: 4px 15px;
61
+ border: solid 1px #CFCFCF;
62
+ box-shadow: 0 3px 12px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, .05);
63
+
64
+ }
65
+ }
66
+
67
+ .react-sep-menu {
68
+ display: none;
69
+ background: #CFCFCF;
70
+ width: 1px;
71
+ height: 20px;
72
+
73
+ @media screen and (min-width:630px) {
74
+ display: block;
75
+ }
76
+ }
77
+
78
+ span[class$="-indicatorSeparator"] {
79
+ display: none;
80
+ }
81
+
82
+ div[class$="-indicatorContainer"] {
83
+ padding: 0;
84
+ }
85
+
86
+ .accordion-collapse {
87
+ padding-top: 1rem;
88
+ }
89
+
90
+ .top-filter {
91
+ width: 100%;
92
+
93
+ @media screen and (min-width:630px) {
94
+ width: auto;
95
+ }
96
+
97
+ .select-custom-no-border {
98
+ width: 100%;
99
+
100
+ @media screen and (min-width:630px) {
101
+ width: auto;
102
+ }
103
+
104
+ div[class$="-control"] {
105
+ width: 100%;
106
+
107
+ @media screen and (max-width:629px) {
108
+ border-color: hsl(0, 0%, 70%);
109
+ color: hsl(0, 0%, 20%);
110
+ border: solid 1px #CFCFCF;
111
+ }
112
+
113
+ @media screen and (min-width:630px) {
114
+ width: auto;
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ // react search bar
122
+
123
+ .r-filter-search {
124
+ position: relative;
125
+ padding: 12px 6px;
126
+ border-radius: 50px;
127
+ display: block;
128
+ width: 100%;
129
+
130
+ @media screen and (max-width:629px) {
131
+ width: calc(100% - 40px);
132
+ border: solid 1px #CFCFCF;
133
+ box-shadow: 0 3px 12px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, .05);
134
+ }
135
+
136
+ @media screen and (min-width:630px) {
137
+ width: 175px;
138
+ }
139
+
140
+ input {
141
+ border: none;
142
+ width: 100%;
143
+
144
+ &:focus {
145
+ outline: none;
146
+ }
147
+ }
148
+
149
+ svg {
150
+ position: absolute;
151
+ transform: translateX(-100%);
152
+ right: 0;
153
+ }
154
+
155
+ .relative {
156
+ display: flex;
157
+ justify-content: center;
158
+ align-items: center;
159
+ }
160
+ }
161
+
162
+
163
+ // // More filters
164
+
165
+ .more-filter-btn {
166
+ background-color: transparent;
167
+ border: none;
168
+ position: absolute;
169
+ right: 0;
170
+ top: 18px;
171
+
172
+ @media screen and (min-width:630px) {
173
+ width: auto;
174
+ translate: 40px;
175
+ top: inherit;
176
+ }
177
+
178
+ &.collapsed {
179
+ transform: rotate(180deg);
180
+
181
+ svg {
182
+ stroke: #9f9f9f;
183
+ }
184
+ }
185
+ }
186
+
187
+ .more-filter-container {
188
+ &.collapse:not(.show) {
189
+ display: none;
190
+ }
191
+
192
+ .accordion-body {
193
+ display: flex;
194
+ gap: 20px;
195
+ align-items: center;
196
+ padding: 1rem;
197
+ background-color: #f8F8F8;
198
+ justify-content: center;
199
+ border: solid 1px #e4e4e4;
200
+ border-left: none;
201
+ border-right: none;
202
+
203
+ @media screen and (max-width:630px) {
204
+ display: flex;
205
+ flex-direction: column;
206
+ }
207
+ }
208
+
209
+ .free-Filter {
210
+ label {
211
+ font-size: 12px;
212
+ font-weight: bold;
213
+ letter-spacing: 1.4px;
214
+ }
215
+
216
+ .form-check {
217
+ display: flex;
218
+ align-items: center;
219
+ gap: 5px;
220
+ padding: 0;
221
+
222
+ input {
223
+ margin: 0;
224
+ }
225
+ }
226
+ }
227
+ }
@@ -0,0 +1,94 @@
1
+ export const taxonomy_event_public = [
2
+ {
3
+ label: "Petit enfant",
4
+ value: "i8gf49541q",
5
+ },
6
+ {
7
+ label: "Petit enfant » 1 an",
8
+ value: "tdtpdh546x",
9
+ },
10
+ {
11
+ label: "Petit enfant » 2 ans",
12
+ value: "19hb3u884v",
13
+ },
14
+ {
15
+ label: "Petit enfant » 3 ans",
16
+ value: "cl7oi9xaig",
17
+ },
18
+ {
19
+ label: "Enfant",
20
+ value: "omg40jn2yl",
21
+ },
22
+ {
23
+ label: "Enfant » 4 ans",
24
+ value: "a04ryxt74a",
25
+ },
26
+ {
27
+ label: "Enfant » 5 ans",
28
+ value: "2u0ugvi72u",
29
+ },
30
+ {
31
+ label: "Enfant » 6 ans",
32
+ value: "8btkbsp9ei",
33
+ },
34
+ {
35
+ label: "Enfant » 7 ans",
36
+ value: "gp881gyhmy",
37
+ },
38
+ {
39
+ label: "Enfant » 8 ans",
40
+ value: "me9vnw7vnk",
41
+ },
42
+ {
43
+ label: "Enfant » 9 ans",
44
+ value: "11ps76le1h",
45
+ },
46
+ {
47
+ label: "Enfant » 10 ans",
48
+ value: "rf2m1fbrot",
49
+ },
50
+ {
51
+ label: "Enfant » 11 ans",
52
+ value: "79qhii8mnf",
53
+ },
54
+ {
55
+ label: "Adolescent",
56
+ value: "ah0rbc2qr4",
57
+ },
58
+ {
59
+ label: "Adolescent » 12 ans",
60
+ value: "x6rmmxao6i",
61
+ },
62
+ {
63
+ label: "Adolescent » 13 ans",
64
+ value: "1pn83a9xkw",
65
+ },
66
+ {
67
+ label: "Adolescent » 14 ans",
68
+ value: "b8skpvhfka",
69
+ },
70
+ {
71
+ label: "Adolescent » 15 ans",
72
+ value: "snvxin8j4j",
73
+ },
74
+ {
75
+ label: "Adolescent » 16 ans",
76
+ value: "v4ty7v0hab",
77
+ },
78
+ {
79
+ label: "Adolescent » 17 ans",
80
+ value: "1x1ii6jxhu",
81
+ },
82
+ {
83
+ label: "Adulte",
84
+ value: "5lfbjyeea0",
85
+ },
86
+ {
87
+ label: "Plus de 60 ans",
88
+ value: "58cuuquwed",
89
+ },
90
+ {
91
+ label: "Tout public",
92
+ value: "ry275hefdy",
93
+ },
94
+ ];
@@ -0,0 +1,58 @@
1
+ export const menuStyles = {
2
+ control: (styles) => ({
3
+ ...styles,
4
+ backgroundColor: "white",
5
+ borderColor: "transparent",
6
+ borderRadius: "10px",
7
+ minWidth:"150px",
8
+ height: "40px",
9
+ }),
10
+ menu: (styles) => ({
11
+ ...styles,
12
+ width: "max-content",
13
+ maxWidth: "250px",
14
+ }),
15
+ placeholder: (styles) => ({
16
+ ...styles,
17
+ color: "000",
18
+ fontWeight: "bold",
19
+ fontSize: "14px",
20
+ letterSpacing: "1.4px",
21
+ }),
22
+ indicators: (styles) => ({
23
+ ...styles,
24
+ color: "blue",
25
+ }),
26
+ option: (styles) => {
27
+ return {
28
+ ...styles,
29
+ };
30
+ },
31
+ };
32
+
33
+ export const moreFilterStyles = {
34
+ control: (styles) => ({
35
+ ...styles,
36
+ backgroundColor: "white",
37
+ borderRadius: "10px",
38
+ height: "30px",
39
+ minWidth:"150px",
40
+ }),
41
+ placeholder: (styles) => ({
42
+ ...styles,
43
+ color: "000",
44
+ fontWeight: "bold",
45
+ fontSize: "12px",
46
+ letterSpacing: "1.4px",
47
+ }),
48
+ menu: (styles) => ({
49
+ ...styles,
50
+ width: "max-content",
51
+ maxWidth: "250px",
52
+ }),
53
+ option: (styles, { data, isDisabled, isFocused, isSelected }) => {
54
+ return {
55
+ ...styles,
56
+ };
57
+ },
58
+ };
@@ -0,0 +1,149 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import Select from "react-select";
3
+ import "./TaxonomyFilter.scss";
4
+
5
+ function TaxonomyFilter({ onChange, sub, title, token, isActive, setCat, onClick }) {
6
+ const [select1Value, setSelect1Value] = useState(null);
7
+ const [select2Value, setSelect2Value] = useState(null);
8
+ const [select3Value, setSelect3Value] = useState(null);
9
+ const [firstLevelOptions, setFirstLevelOptions] = useState(null);
10
+ const [secondLevelOptions, setSecondLevelOptions] = useState(null);
11
+ // État pour suivre l'affichage de la div associée
12
+ const [secondLevelVisible, setsecondLevelVisible] = useState(false);
13
+ const [thirdLevelVisible, setThirdLevelVisible] = useState(false);
14
+ // const avev la valeur des filtres
15
+ const [filterValue, setFilterValue] = useState({
16
+ taxonomy_contact_category_for_filtering: null,
17
+ });
18
+
19
+ // Object { b_start: "0", fullobjects: "1", taxonomy_contact_category_for_filtering: "ol8av3v8bn" }
20
+
21
+ // Dans le composant TaxonomyFilter
22
+ useEffect(() => {
23
+ if (!isActive) {
24
+ setsecondLevelVisible(false);
25
+ setThirdLevelVisible(false);
26
+ setSelect2Value(null);
27
+ }
28
+ }, [isActive]);
29
+
30
+ useEffect(() => {
31
+ if (sub) {
32
+ const optionsSub1 = sub.map((d) => ({
33
+ value: d.token,
34
+ label: d.title,
35
+ ...(d.sub && { sub: d.sub }),
36
+ }));
37
+ setFirstLevelOptions(optionsSub1);
38
+ }
39
+ }, [sub]);
40
+ // Gestionnaire d'événements pour le clic sur le lien
41
+ const handleLinkClick = () => {
42
+ // Inverser la valeur de l'état pour afficher ou masquer la div
43
+ setsecondLevelVisible(!secondLevelVisible);
44
+ setSelect2Value(null);
45
+ setThirdLevelVisible(false);
46
+ };
47
+
48
+ // Gestionnaire d'événements pour le changement de valeur dans le premier select
49
+ const onChangeSub1 = (value, action) => {
50
+ if (value && value.sub) {
51
+ const optionsSub2 = value.sub.map((d) => ({
52
+ value: d.token,
53
+ label: d.title,
54
+ }));
55
+ setSelect2Value(value.label);
56
+ setSelect3Value(null);
57
+ setSecondLevelOptions(optionsSub2);
58
+ setThirdLevelVisible(true);
59
+ onChange(value, action);
60
+ } else {
61
+ setSecondLevelOptions(null);
62
+ }
63
+ };
64
+
65
+ // Gestionnaire d'événements pour le changement de valeur dans le deuxième select
66
+ const onChangeSub2 = (value, action) => {
67
+ setSelect3Value(value.label);
68
+ onChange(value, action);
69
+ };
70
+
71
+ // send the value to the first level (a link)
72
+ const handleApply = (value, title) => {
73
+ setCat((prevCat) => !prevCat);
74
+ if (!secondLevelVisible) {
75
+ onChange(
76
+ { value: value, label: title },
77
+ { name: "taxonomy_contact_category_for_filtering" }
78
+ );
79
+ } else {
80
+ onChange(null, { name: "taxonomy_contact_category_for_filtering" });
81
+ }
82
+ };
83
+
84
+ return (
85
+ <div onClick={onClick}>
86
+ <div
87
+ className={
88
+ secondLevelVisible ? "dropDownFilter dropDownFilter-active" : "dropDownFilter"
89
+ }
90
+ >
91
+ {/* Lien avec gestionnaire d'événements */}
92
+ <a
93
+ className="sub0"
94
+ href="#"
95
+ value={title}
96
+ onClick={(e) => {
97
+ e.preventDefault();
98
+ handleLinkClick();
99
+ handleApply(token, title); // Pass the correct value to handleApply
100
+ }}
101
+ >
102
+ {title}
103
+ </a>
104
+
105
+ {/* Div conditionnellement rendue en fonction de l'état */}
106
+ {firstLevelOptions && (
107
+ <div
108
+ className={
109
+ secondLevelVisible
110
+ ? "sub1 dropDownFilter-visible"
111
+ : "sub1 dropDownFilter-invisble"
112
+ }
113
+ >
114
+ <Select
115
+ name={"taxonomy_contact_category_for_filtering"}
116
+ className="select-custom-class library-facilities"
117
+ onChange={onChangeSub1}
118
+ options={firstLevelOptions}
119
+ value={select2Value}
120
+ placeholder={select2Value ? select2Value : "Catégories"}
121
+ />
122
+ </div>
123
+ )}
124
+
125
+ {/* Div 3 conditionnellement rendue en fonction de l'état */}
126
+ {secondLevelOptions && (
127
+ <div
128
+ className={
129
+ thirdLevelVisible
130
+ ? "sub2 dropDownFilter-visible"
131
+ : "sub2 dropDownFilter-invisble"
132
+ }
133
+ >
134
+ <Select
135
+ name={"taxonomy_contact_category_for_filtering"}
136
+ className="select-custom-class library-facilities"
137
+ onChange={onChangeSub2}
138
+ options={secondLevelOptions}
139
+ value={select3Value}
140
+ placeholder={select3Value ? select3Value : "Catégories"}
141
+ />
142
+ </div>
143
+ )}
144
+ </div>
145
+ </div>
146
+ );
147
+ }
148
+
149
+ export default TaxonomyFilter;