imio.smartweb.core 1.2.37__py3-none-any.whl → 1.2.79__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 (222) hide show
  1. imio/smartweb/core/behaviors/categorization.py +24 -0
  2. imio/smartweb/core/behaviors/configure.zcml +7 -0
  3. imio/smartweb/core/browser/controlpanel.py +43 -0
  4. imio/smartweb/core/browser/faceted/block_view.pt +4 -4
  5. imio/smartweb/core/browser/faceted/summary_view.pt +4 -4
  6. imio/smartweb/core/browser/sitemap.py +10 -3
  7. imio/smartweb/core/browser/static/icons/action-delete.svg +3 -0
  8. imio/smartweb/core/browser/static/icons/action-engagement-2.svg +4 -0
  9. imio/smartweb/core/browser/static/icons/action-panneaux.svg +3 -0
  10. imio/smartweb/core/browser/static/icons/action-vote.svg +3 -0
  11. imio/smartweb/core/browser/static/icons/categorie-attention.svg +3 -0
  12. imio/smartweb/core/browser/static/icons/categorie-infos-travaux-2.svg +4 -0
  13. imio/smartweb/core/browser/static/icons/categorie-nature.svg +3 -0
  14. imio/smartweb/core/browser/static/icons/categorie-parcs-a-conteneurs.svg +4 -0
  15. imio/smartweb/core/browser/static/icons/categorie-plus.svg +3 -0
  16. imio/smartweb/core/browser/static/icons/categorie-primes-2.svg +5 -0
  17. imio/smartweb/core/browser/static/icons/categorie-sport-natation.svg +4 -0
  18. imio/smartweb/core/browser/static/icons/organisation-ecole-sac.svg +4 -0
  19. imio/smartweb/core/browser/static/icons/organisation-scout.svg +3 -0
  20. imio/smartweb/core/browser/static/icons/reseausocial-behance.svg +3 -0
  21. imio/smartweb/core/browser/static/icons/reseausocial-linkedin.svg +3 -0
  22. imio/smartweb/core/browser/static/smartweb-edit-compiled.css +1 -1
  23. imio/smartweb/core/browser/static/smartweb-view-compiled.css +1 -1
  24. imio/smartweb/core/browser/static/src/edit.less +42 -0
  25. imio/smartweb/core/browser/static/src/view.less +109 -56
  26. imio/smartweb/core/browser/vocabulary.py +8 -3
  27. imio/smartweb/core/contents/__init__.py +2 -0
  28. imio/smartweb/core/contents/configure.zcml +1 -0
  29. imio/smartweb/core/contents/folder/block_view.pt +8 -8
  30. imio/smartweb/core/contents/folder/summary_view.pt +4 -4
  31. imio/smartweb/core/contents/pages/cirkwi/content.py +5 -0
  32. imio/smartweb/core/contents/pages/cirkwi/view.py +2 -1
  33. imio/smartweb/core/contents/pages/configure.zcml +1 -0
  34. imio/smartweb/core/contents/pages/portal_page/view.py +3 -0
  35. imio/smartweb/core/contents/pages/views.py +47 -1
  36. imio/smartweb/core/contents/publication/__init__.py +0 -0
  37. imio/smartweb/core/contents/publication/configure.zcml +5 -0
  38. imio/smartweb/core/contents/publication/content.py +23 -0
  39. imio/smartweb/core/contents/rest/base.py +9 -7
  40. imio/smartweb/core/contents/rest/directory/endpoint.py +2 -2
  41. imio/smartweb/core/contents/rest/directory/view.pt +2 -1
  42. imio/smartweb/core/contents/rest/events/content.py +13 -0
  43. imio/smartweb/core/contents/rest/events/endpoint.py +5 -3
  44. imio/smartweb/core/contents/rest/events/view.pt +5 -1
  45. imio/smartweb/core/contents/rest/events/view.py +12 -0
  46. imio/smartweb/core/contents/rest/news/content.py +6 -0
  47. imio/smartweb/core/contents/rest/news/endpoint.py +4 -2
  48. imio/smartweb/core/contents/rest/news/view.pt +4 -1
  49. imio/smartweb/core/contents/rest/news/view.py +8 -0
  50. imio/smartweb/core/contents/rest/utils.py +0 -1
  51. imio/smartweb/core/contents/rest/view.py +4 -0
  52. imio/smartweb/core/contents/sections/common_templates/carousel.pt +5 -1
  53. imio/smartweb/core/contents/sections/common_templates/table.pt +18 -4
  54. imio/smartweb/core/contents/sections/configure.zcml +18 -0
  55. imio/smartweb/core/contents/sections/contact/content.py +2 -2
  56. imio/smartweb/core/contents/sections/contact/macros.pt +28 -3
  57. imio/smartweb/core/contents/sections/contact/utils.py +2 -0
  58. imio/smartweb/core/contents/sections/contact/view.py +28 -12
  59. imio/smartweb/core/contents/sections/events/content.py +12 -4
  60. imio/smartweb/core/contents/sections/events/view.py +20 -2
  61. imio/smartweb/core/contents/sections/external_content/view.pt +4 -4
  62. imio/smartweb/core/contents/sections/external_content/views.py +6 -4
  63. imio/smartweb/core/contents/sections/files/content.py +7 -1
  64. imio/smartweb/core/contents/sections/files/view.py +43 -12
  65. imio/smartweb/core/contents/sections/links/view.py +5 -0
  66. imio/smartweb/core/contents/sections/macros.pt +26 -0
  67. imio/smartweb/core/contents/sections/news/content.py +11 -3
  68. imio/smartweb/core/contents/sections/news/view.py +20 -2
  69. imio/smartweb/core/contents/sections/text/views.py +2 -0
  70. imio/smartweb/core/contents/sections/views.py +73 -10
  71. imio/smartweb/core/interfaces.py +4 -0
  72. imio/smartweb/core/profiles/default/metadata.xml +1 -1
  73. imio/smartweb/core/profiles/default/taxonomies/page_category.xml +16 -0
  74. imio/smartweb/core/profiles/default/taxonomies/procedure_category.xml +26 -0
  75. imio/smartweb/core/profiles/default/types/imio.smartweb.EventsView.xml +1 -0
  76. imio/smartweb/core/profiles/default/types/imio.smartweb.NewsView.xml +1 -0
  77. imio/smartweb/core/profiles/default/types/imio.smartweb.Publication.xml +38 -0
  78. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionEvents.xml +1 -0
  79. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionFiles.xml +2 -0
  80. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionNews.xml +1 -0
  81. imio/smartweb/core/profiles/default/types.xml +1 -0
  82. imio/smartweb/core/profiles/icons/basic/registry.xml +120 -0
  83. imio/smartweb/core/rest/authentic_sources.py +17 -2
  84. imio/smartweb/core/subscribers.py +48 -0
  85. imio/smartweb/core/subscribers.zcml +12 -0
  86. imio/smartweb/core/tests/resources/json_iadeliberations_institutions.json +60 -0
  87. imio/smartweb/core/tests/resources/json_iadeliberations_publication.json +105 -0
  88. imio/smartweb/core/tests/resources/json_iadeliberations_publications.json +270 -0
  89. imio/smartweb/core/tests/resources/json_rest_events.json +6 -2
  90. imio/smartweb/core/tests/resources/json_rest_news.json +2 -2
  91. imio/smartweb/core/tests/resources/json_rest_specific_events.json +1 -1
  92. imio/smartweb/core/tests/test_htmx_in_sections.py +131 -0
  93. imio/smartweb/core/tests/test_iadeliberations.py +136 -0
  94. imio/smartweb/core/tests/test_icons.py +1 -1
  95. imio/smartweb/core/tests/test_rest.py +58 -17
  96. imio/smartweb/core/tests/test_section_contact.py +42 -10
  97. imio/smartweb/core/tests/test_section_events.py +28 -5
  98. imio/smartweb/core/tests/test_section_external_content.py +28 -2
  99. imio/smartweb/core/tests/test_section_news.py +30 -8
  100. imio/smartweb/core/tests/test_sections.py +17 -0
  101. imio/smartweb/core/tests/test_vocabularies.py +60 -3
  102. imio/smartweb/core/tests/test_vocabulary.py +43 -0
  103. imio/smartweb/core/upgrades/configure.zcml +108 -0
  104. imio/smartweb/core/upgrades/profiles/1055_to_1056/types/imio.smartweb.SectionFiles.xml +12 -0
  105. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.EventsView.xml +11 -0
  106. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.NewsView.xml +11 -0
  107. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionEvents.xml +11 -0
  108. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionNews.xml +11 -0
  109. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/page_category.cfg +9 -0
  110. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/page_category.xml +73 -0
  111. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/procedure_category.cfg +9 -0
  112. imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/procedure_category.xml +118 -0
  113. imio/smartweb/core/upgrades/profiles/1058_to_1059/registry/linkedin-icon.xml +126 -0
  114. imio/smartweb/core/upgrades/profiles/1059_to_1060/registry/iadeliberation.xml +9 -0
  115. imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.Publication.xml +38 -0
  116. imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.SectionFiles.xml +11 -0
  117. imio/smartweb/core/upgrades/profiles/1060_to_1061/types.xml +4 -0
  118. imio/smartweb/core/upgrades/profiles/1060_to_1061/workflows.xml +6 -0
  119. imio/smartweb/core/utils.py +33 -2
  120. imio/smartweb/core/viewlets/configure.zcml +23 -1
  121. imio/smartweb/core/viewlets/footer.pt +5 -0
  122. imio/smartweb/core/viewlets/footer.py +5 -0
  123. imio/smartweb/core/viewlets/htmx.py +15 -0
  124. imio/smartweb/core/viewlets/htmx_js_header.pt +64 -0
  125. imio/smartweb/core/viewlets/ogptags.py +4 -3
  126. imio/smartweb/core/viewlets/social.py +23 -0
  127. imio/smartweb/core/vocabularies.py +65 -3
  128. imio/smartweb/core/vocabularies.zcml +18 -0
  129. imio/smartweb/core/webcomponents/build/1c1605a5fe9a2b10a88f.png +1 -0
  130. imio/smartweb/core/webcomponents/build/524db40e119aa11f4478.png +1 -0
  131. imio/smartweb/core/webcomponents/build/57d3b7cb1ab874660b39.svg +1 -0
  132. imio/smartweb/core/webcomponents/build/6cf03871df23ed2ee8b3.png +1 -0
  133. imio/smartweb/core/webcomponents/build/css/373.smartweb-webcomponents-compiled.css +1 -1
  134. imio/smartweb/core/webcomponents/build/css/486.smartweb-webcomponents-compiled.css +1 -1
  135. imio/smartweb/core/webcomponents/build/css/884.smartweb-webcomponents-compiled.css +1 -0
  136. imio/smartweb/core/webcomponents/build/css/919.smartweb-webcomponents-compiled.css +1 -1
  137. imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
  138. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +1 -1
  139. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js.LICENSE.txt +10 -8
  140. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +2 -1
  141. imio/smartweb/core/webcomponents/build/js/{568.smartweb-webcomponents-compiled.js.LICENSE.txt → 373.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -4
  142. imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -1
  143. imio/smartweb/core/webcomponents/build/js/499.smartweb-webcomponents-compiled.js +2 -0
  144. imio/smartweb/core/webcomponents/build/js/{674.smartweb-webcomponents-compiled.js.LICENSE.txt → 499.smartweb-webcomponents-compiled.js.LICENSE.txt} +1 -8
  145. imio/smartweb/core/webcomponents/build/js/799.smartweb-webcomponents-compiled.js +1 -1
  146. imio/smartweb/core/webcomponents/build/js/824.smartweb-webcomponents-compiled.js +2 -0
  147. imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js +2 -0
  148. imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js.LICENSE.txt +32 -0
  149. imio/smartweb/core/webcomponents/build/js/884.smartweb-webcomponents-compiled.js +1 -0
  150. imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -1
  151. imio/smartweb/core/webcomponents/build/js/{568.smartweb-webcomponents-compiled.js → 963.smartweb-webcomponents-compiled.js} +2 -2
  152. imio/smartweb/core/webcomponents/build/js/963.smartweb-webcomponents-compiled.js.LICENSE.txt +3 -0
  153. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
  154. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js.LICENSE.txt +11 -14
  155. imio/smartweb/core/webcomponents/package.json +42 -40
  156. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.jsx +146 -79
  157. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.scss +415 -351
  158. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactCard/ContactCard.jsx +95 -62
  159. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +328 -168
  160. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactList/ContactList.jsx +21 -4
  161. imio/smartweb/core/webcomponents/src/components/Annuaire/Filters/Filter.jsx +213 -100
  162. imio/smartweb/core/webcomponents/src/components/Annuaire/index.js +1 -1
  163. imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +76 -33
  164. imio/smartweb/core/webcomponents/src/components/Events/EventContent/EventContent.jsx +604 -377
  165. imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +29 -4
  166. imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +162 -88
  167. imio/smartweb/core/webcomponents/src/components/Events/Events.scss +496 -378
  168. imio/smartweb/core/webcomponents/src/components/Events/Filters/Filter.jsx +259 -91
  169. imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.jsx +62 -55
  170. imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.scss +68 -17
  171. imio/smartweb/core/webcomponents/src/components/Filters/IamData.jsx +42 -0
  172. imio/smartweb/core/webcomponents/src/components/Filters/MainFilter.scss +229 -0
  173. imio/smartweb/core/webcomponents/src/components/Filters/PublicTargetData.jsx +94 -0
  174. imio/smartweb/core/webcomponents/src/components/Filters/SelectStyles.js +58 -0
  175. imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.jsx +149 -0
  176. imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.scss +70 -0
  177. imio/smartweb/core/webcomponents/src/components/News/Filters/Filter.jsx +139 -83
  178. imio/smartweb/core/webcomponents/src/components/News/News.jsx +133 -67
  179. imio/smartweb/core/webcomponents/src/components/News/News.scss +170 -127
  180. imio/smartweb/core/webcomponents/src/components/News/NewsCard/NewsCard.jsx +76 -44
  181. imio/smartweb/core/webcomponents/src/components/News/NewsContent/NewsContent.jsx +261 -188
  182. imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +48 -9
  183. imio/smartweb/core/webcomponents/src/components/Search/ContactResult/ContactResult.jsx +21 -10
  184. imio/smartweb/core/webcomponents/src/components/Search/EventsResult/EventsResult.jsx +21 -10
  185. imio/smartweb/core/webcomponents/src/components/Search/Filters/Filter.jsx +8 -9
  186. imio/smartweb/core/webcomponents/src/components/Search/NewsResult/NewsResult.jsx +23 -12
  187. imio/smartweb/core/webcomponents/src/components/Search/Search.jsx +7 -6
  188. imio/smartweb/core/webcomponents/src/components/Search/Search.scss +115 -96
  189. imio/smartweb/core/webcomponents/src/components/Search/WebResult/WebResult.jsx +12 -3
  190. imio/smartweb/core/webcomponents/src/components/Search/index.js +1 -1
  191. imio/smartweb/core/webcomponents/src/hooks/ScrollContext.jsx +3 -0
  192. imio/smartweb/core/webcomponents/src/hooks/useAxios.js +3 -3
  193. imio/smartweb/core/webcomponents/src/hooks/useFilterQuery.js +1 -2
  194. imio/smartweb/core/webcomponents/src/index.scss +255 -211
  195. imio/smartweb/core/webcomponents/src/utils/Map.jsx +26 -19
  196. imio/smartweb/core/webcomponents/src/utils/Map.scss +2 -2
  197. imio/smartweb/core/webcomponents/src/utils/translation.js +129 -9
  198. imio.smartweb.core-1.2.79-py3.8-nspkg.pth +2 -0
  199. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/METADATA +413 -10
  200. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/RECORD +206 -160
  201. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/WHEEL +1 -1
  202. imio/smartweb/core/webcomponents/build/assets/location-bla.1423bcce16ddcb21141430cac1428dc1.svg +0 -1
  203. imio/smartweb/core/webcomponents/build/assets/next-react-white.819cb069ac8eec300a9db6a7707712d6.svg +0 -1
  204. imio/smartweb/core/webcomponents/build/assets/next-react.17bc43ff4a6a86f4520f5782f6a89a72.svg +0 -1
  205. imio/smartweb/core/webcomponents/build/assets/search.57bdbf5b191499cd77514097d1c4972c.svg +0 -1
  206. imio/smartweb/core/webcomponents/build/css/686.smartweb-webcomponents-compiled.css +0 -1
  207. imio/smartweb/core/webcomponents/build/js/209.smartweb-webcomponents-compiled.js +0 -2
  208. imio/smartweb/core/webcomponents/build/js/674.smartweb-webcomponents-compiled.js +0 -2
  209. imio/smartweb/core/webcomponents/build/js/686.smartweb-webcomponents-compiled.js +0 -1
  210. imio/smartweb/core/webcomponents/build/js/804.smartweb-webcomponents-compiled.js +0 -1
  211. imio/smartweb/core/webcomponents/src/assets/facebook-news.svg +0 -1
  212. imio/smartweb/core/webcomponents/src/assets/location-bla.svg +0 -1
  213. imio/smartweb/core/webcomponents/src/assets/next-react.svg +0 -1
  214. imio/smartweb/core/webcomponents/src/assets/search.svg +0 -1
  215. imio/smartweb/core/webcomponents/src/assets/skeleton.svg +0 -1
  216. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/download.svg +0 -1
  217. imio.smartweb.core-1.2.37-py3.10-nspkg.pth +0 -3
  218. /imio/smartweb/core/webcomponents/build/js/{209.smartweb-webcomponents-compiled.js.LICENSE.txt → 824.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  219. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/LICENSE.GPL +0 -0
  220. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/LICENSE.rst +0 -0
  221. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/namespace_packages.txt +0 -0
  222. {imio.smartweb.core-1.2.37.dist-info → imio.smartweb.core-1.2.79.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,70 @@
1
+ .taxonomy-Filter {
2
+ width: 100%;
3
+ display: flex;
4
+ gap: 20px;
5
+ flex-wrap: wrap;
6
+ transition: all .3s ease-in-out;
7
+ }
8
+
9
+
10
+ .dropDownFilter {
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ gap: 0 5px;
15
+ transition: max-width .3s ease-in-out;
16
+ transition: opacity 3s ease-in-out;
17
+
18
+ border: solid 1px #CFCFCF;
19
+ border-radius: 20px;
20
+ outline: 1px solid transparent;
21
+
22
+ &-active {
23
+ border-color: #2684FF;
24
+ outline: 1px solid #2684FF;
25
+
26
+ // border-width: 2px;
27
+ .sub0 {}
28
+ }
29
+
30
+ .sub0 {
31
+ text-decoration: none;
32
+ padding: 10px 10px;
33
+ }
34
+
35
+ .sub1 {
36
+ // transition: max-width .3s ease-in-out;
37
+ padding-right: 5px;
38
+ transition: all .4s cubic-bezier(0, .74, .58, 1.04);
39
+
40
+ div[class*="control"] {
41
+ flex-wrap: nowrap;
42
+ border-radius: 15px;
43
+ }
44
+ }
45
+
46
+ .sub2 {
47
+ // transition: max-width .3s ease-in-out;
48
+ padding-right: 5px;
49
+ transition: all .4s cubic-bezier(0, .74, .58, 1.04);
50
+
51
+ div[class*="control"] {
52
+ flex-wrap: nowrap;
53
+ border-radius: 15px;
54
+ }
55
+ }
56
+
57
+ .dropDownFilter-invisble {
58
+ opacity: 0;
59
+ max-width: 0px;
60
+ height: 0px;
61
+ overflow: hidden;
62
+ padding: 0;
63
+ }
64
+
65
+ .dropDownFilter-visible {
66
+ max-width: 150px;
67
+ height: auto;
68
+ opacity: 1;
69
+ }
70
+ }
@@ -1,16 +1,18 @@
1
1
  import React, { useEffect, useCallback, useRef, useState } from "react";
2
2
  import Select from "react-select";
3
- import { useHistory } from "react-router-dom";
3
+ import { useNavigate } from "react-router-dom";
4
4
  import useAxios from "../../../hooks/useAxios";
5
- import { Translator } from "react-translated";
5
+ import { Translator, Translate} from "react-translated";
6
+ import queryString from "query-string";
7
+ import { iam } from "./../../Filters/IamData";
8
+ import { menuStyles } from "./../../Filters/SelectStyles";
6
9
 
7
10
  function Filters(props) {
8
- let history = useHistory();
9
- const queryString = require("query-string");
10
-
11
+ let navigate = useNavigate();
11
12
  const [inputValues, setInputValues] = useState(props.activeFilter);
12
13
  const [topicsFilter, setTopicsFilter] = useState(null);
13
14
  const [taxonomyFilter, setTaxonomyFilter] = useState(null);
15
+ const [localsCategoryFilter, setLocalsCategoryFilter] = useState([]);
14
16
  const { response, error, isLoading } = useAxios({
15
17
  method: "get",
16
18
  url: "",
@@ -31,13 +33,34 @@ function Filters(props) {
31
33
  ? response.category.map((d) => ({
32
34
  value: d.token,
33
35
  label: d.title,
36
+ queryString: "category",
34
37
  }))
35
38
  : "";
39
+ const optionsLocalsCategory =
40
+ response.local_category &&
41
+ response.local_category.map((d) => ({
42
+ value: d.token,
43
+ label: d.title,
44
+ queryString: "local_category",
45
+ }));
36
46
  setTopicsFilter(optionsTopics);
37
47
  setTaxonomyFilter(optionsTaxonomy);
48
+ setLocalsCategoryFilter(optionsLocalsCategory)
38
49
  }
39
50
  }, [response]);
40
51
 
52
+ // const to group category and local category
53
+ const groupedOptions = [
54
+ {
55
+ label: <Translate text="Catégories spécifiques" />,
56
+ options: localsCategoryFilter,
57
+ },
58
+ {
59
+ label: <Translate text="Catégories" />,
60
+ options: taxonomyFilter,
61
+ },
62
+ ];
63
+
41
64
  const onChangeHandler = useCallback(({ target: { name, value } }) => {
42
65
  if (value.length > 2) {
43
66
  setInputValues((state) => ({ ...state, [name]: value }), []);
@@ -62,6 +85,18 @@ function Filters(props) {
62
85
  }
63
86
  });
64
87
 
88
+ const onChangeGroupSelect = useCallback((value, action) => {
89
+ if (value) {
90
+ setInputValues((state) => ({ ...state, [value.queryString]: value.value }), []);
91
+ } else {
92
+ setInputValues((prevState) => {
93
+ const state = { ...prevState };
94
+ const { [action.removedValues[0].queryString]: remove, ...rest } = state;
95
+ return rest;
96
+ });
97
+ }
98
+ });
99
+
65
100
  // make to no launch useEffect first time
66
101
  const firstUpdate = useRef(true);
67
102
  useEffect(() => {
@@ -69,7 +104,7 @@ function Filters(props) {
69
104
  firstUpdate.current = false;
70
105
  return;
71
106
  }
72
- history.push({
107
+ navigate({
73
108
  pathname: "./",
74
109
  search: queryString.stringify(inputValues),
75
110
  });
@@ -88,86 +123,107 @@ function Filters(props) {
88
123
  let actTaxo =
89
124
  taxonomyFilter &&
90
125
  taxonomyFilter.filter((option) => option.value === props.activeFilter.category);
91
- const customStyles = {
92
- control: (styles) => ({
93
- ...styles,
94
- backgroundColor: "white",
95
- borderRadius: "0",
96
- height: "50px",
97
- }),
98
- placeholder: (styles) => ({
99
- ...styles,
100
- color: "000",
101
- fontWeight: "bold",
102
- fontSize: "12px",
103
- textTransform: "uppercase",
104
- letterSpacing: "1.2px",
105
- }),
106
- option: (styles, { data, isDisabled, isFocused, isSelected }) => {
107
- return {
108
- ...styles,
109
- };
110
- },
111
- };
126
+
127
+ let actIam = iam && iam.filter((option) => option.value === props.activeFilter.topics);
128
+
112
129
  return (
113
130
  <React.Fragment>
114
- <form className="r-filter" onSubmit={handleSubmit}>
115
- {/* <label>Recherche</label> */}
116
- <div className="r-filter-search">
117
- <Translator>
118
- {({ translate }) => (
119
- <input
120
- className="input-custom-class"
121
- name="SearchableText"
122
- type="text"
123
- value={inputValues.SearchableText}
124
- onChange={onChangeHandler}
125
- placeholder={translate({
126
- text: 'Recherche'
127
- })}
128
- />
129
- )}
130
- </Translator>
131
- <button type="submit"></button>
131
+ <div className="react-filters-menu">
132
+ <div className="react-filters-container">
133
+ <form className="r-filter r-filter-search" onSubmit={handleSubmit}>
134
+ {/* <label>Recherche</label> */}
135
+ <div className="relative">
136
+ <Translator>
137
+ {({ translate }) => (
138
+ <input
139
+ className="input-custom-class"
140
+ name="SearchableText"
141
+ type="text"
142
+ value={inputValues.SearchableText}
143
+ onChange={onChangeHandler}
144
+ placeholder={translate({
145
+ text: "Recherche",
146
+ })}
147
+ />
148
+ )}
149
+ </Translator>
150
+ <svg
151
+ xmlns="http://www.w3.org/2000/svg"
152
+ fill="none"
153
+ stroke="#9f9f9f"
154
+ strokeWidth="4"
155
+ aria-hidden="true"
156
+ display="block"
157
+ overflow="visible"
158
+ style={{ height: 16, width: 16 }}
159
+ viewBox="0 0 32 32"
160
+ >
161
+ <path d="M13 24a11 11 0 1 0 0-22 11 11 0 0 0 0 22zm8-3 9 9" />
162
+ </svg>
163
+ </div>
164
+ </form>
165
+ <div className="react-sep-menu"></div>
166
+ <div className="r-filter top-filter topics-Filter">
167
+ {/* <label>Thématiques</label> */}
168
+ <Translator>
169
+ {({ translate }) => (
170
+ <Select
171
+ styles={menuStyles}
172
+ name={"topics"}
173
+ className="select-custom-no-border library-topics"
174
+ isClearable
175
+ onChange={onChangeHandlerSelect}
176
+ options={topicsFilter && topicsFilter}
177
+ placeholder={translate({
178
+ text: "Thématiques",
179
+ })}
180
+ value={actTopi && actTopi[0]}
181
+ />
182
+ )}
183
+ </Translator>
184
+ </div>
185
+ <div className="react-sep-menu"></div>
186
+ <div className="r-filter top-filter facilities-Filter">
187
+ {/* <label>Catégories</label> */}
188
+ <Translator>
189
+ {({ translate }) => (
190
+ <Select
191
+ styles={menuStyles}
192
+ name={"category"}
193
+ className="select-custom-no-border library-facilities"
194
+ isClearable
195
+ onChange={onChangeGroupSelect}
196
+ options={localsCategoryFilter.length === 0 ? taxonomyFilter && taxonomyFilter : groupedOptions}
197
+ placeholder={translate({
198
+ text: "Catégories",
199
+ })}
200
+ value={actTaxo && actTaxo[0]}
201
+ />
202
+ )}
203
+ </Translator>
204
+ </div>
205
+ <div className="react-sep-menu"></div>
206
+ {/* Filtre iam */}
207
+ <div className="r-filter top-filter iam-Filter">
208
+ {/* <label>Thématiques</label> */}
209
+ <Translator>
210
+ {({ translate }) => (
211
+ <Select
212
+ styles={menuStyles}
213
+ name={"iam"}
214
+ className="select-custom-no-border library-topics"
215
+ isClearable
216
+ onChange={onChangeHandlerSelect}
217
+ options={iam && iam}
218
+ placeholder={translate({
219
+ text: "Profil",
220
+ })}
221
+ value={actIam && actIam[0]}
222
+ />
223
+ )}
224
+ </Translator>
225
+ </div>
132
226
  </div>
133
- </form>
134
- <div className="r-filter topics-Filter">
135
- {/* <label>Thématiques</label> */}
136
- <Translator>
137
- {({ translate }) => (
138
- <Select
139
- styles={customStyles}
140
- name={"topics"}
141
- className="select-custom-class library-topics"
142
- isClearable
143
- onChange={onChangeHandlerSelect}
144
- options={topicsFilter && topicsFilter}
145
- placeholder={translate({
146
- text: 'Thématiques'
147
- })}
148
- value={actTopi && actTopi[0]}
149
- />
150
- )}
151
- </Translator>
152
- </div>
153
- <div className="r-filter facilities-Filter">
154
- {/* <label>Catégories</label> */}
155
- <Translator>
156
- {({ translate }) => (
157
- <Select
158
- styles={customStyles}
159
- name={"category"}
160
- className="select-custom-class library-facilities"
161
- isClearable
162
- onChange={onChangeHandlerSelect}
163
- options={taxonomyFilter && taxonomyFilter}
164
- placeholder={translate({
165
- text: 'Catégories'
166
- })}
167
- value={actTaxo && actTaxo[0]}
168
- />
169
- )}
170
- </Translator>
171
227
  </div>
172
228
  </React.Fragment>
173
229
  );
@@ -1,37 +1,50 @@
1
- import React, { useEffect, useState, createContext, useContex } from "react";
2
- import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
1
+ import React, { useEffect, useState, useContext, createContext } from "react";
2
+ import { BrowserRouter, Routes, Route } from "react-router-dom";
3
+ import { ScrollContext } from "../../hooks/ScrollContext";
3
4
  import Filters from "./Filters/Filter";
4
5
  import NewsContent from "./NewsContent/NewsContent";
5
6
  import NewsList from "./NewsList/NewsList";
6
7
  import useAxios from "../../hooks/useAxios";
7
8
  import "./News.scss";
9
+ import "../Filters/MainFilter.scss";
8
10
  import useFilterQuery from "../../hooks/useFilterQuery";
9
11
  import { Provider, Translate } from "react-translated";
10
- import translation from '../../utils/translation';
12
+ import translation from "../../utils/translation";
13
+ import queryString from "query-string";
11
14
 
12
15
  export const LanguageContext = createContext("fr");
13
16
  export default function News(props) {
17
+ // Utilisation de useState pour gérer la valeur du contexte
18
+ const [scrollPos, setScrollPos] = useState(0);
19
+ // Fonction pour mettre à jour la position du scroll
20
+ const updateScrollPos = (newScrollPos) => {
21
+ setScrollPos(newScrollPos);
22
+ };
14
23
  return (
15
24
  <LanguageContext.Provider value={props.currentLanguage}>
16
- <Router basename={props.viewPath}>
25
+ <BrowserRouter basename={props.viewPath}>
17
26
  <Provider language={props.currentLanguage} translation={translation}>
18
- <NewsView
19
- queryFilterUrl={props.queryFilterUrl}
20
- queryUrl={props.queryUrl}
21
- proposeUrl={props.proposeUrl}
22
- batchSize={props.batchSize}
23
- />
27
+ <ScrollContext.Provider value={{ scrollPos, updateScrollPos }}>
28
+ <NewsView
29
+ queryFilterUrl={props.queryFilterUrl}
30
+ queryUrl={props.queryUrl}
31
+ proposeUrl={props.proposeUrl}
32
+ batchSize={props.batchSize}
33
+ showCategoriesOrTopics={props.showCategoriesOrTopics}
34
+ contextAuthenticatedUser={props.contextAuthenticatedUser}
35
+ />
36
+ </ScrollContext.Provider>
24
37
  </Provider>
25
- </Router>
38
+ </BrowserRouter>
26
39
  </LanguageContext.Provider>
27
40
  );
28
41
  }
29
42
  const NewsView = (props) => {
30
- const queryString = require("query-string");
31
43
  const { u, ...parsed } = Object.assign(
32
44
  { b_start: 0, fullobjects: 1 },
33
45
  queryString.parse(useFilterQuery().toString())
34
46
  );
47
+ const { scrollPos, updateScrollPos } = useContext(ScrollContext);
35
48
  const [itemsArray, setItemsArray] = useState([]);
36
49
  const [itemsNumber, setItemsNumber] = useState([]);
37
50
  const [clickId, setClickId] = useState(null);
@@ -78,6 +91,7 @@ const NewsView = (props) => {
78
91
 
79
92
  // set batch
80
93
  const loadMore = () => {
94
+ updateScrollPos(window.scrollY);
81
95
  setBatchStart((batchStart) => batchStart + parseInt(props.batchSize));
82
96
  setLoadMoreLaunch(true);
83
97
  };
@@ -93,69 +107,121 @@ const NewsView = (props) => {
93
107
  // coditional list render
94
108
  let listRender;
95
109
  if (itemsArray && itemsArray.length > 0) {
96
- listRender = <NewsList onChange={clickID} itemsArray={itemsArray} />;
110
+ listRender = (
111
+ <NewsList
112
+ onChange={clickID}
113
+ itemsArray={itemsArray}
114
+ showCategoriesOrTopics={props.showCategoriesOrTopics}
115
+ contextAuthenticatedUser={props.contextAuthenticatedUser}
116
+ />
117
+ );
97
118
  } else if (!isLoading) {
98
- listRender = <p><Translate text="Aucune actualité n'a été trouvée" /></p>;
119
+ listRender = (
120
+ <p>
121
+ <Translate text="Aucune actualité n'a été trouvée" />
122
+ </p>
123
+ );
99
124
  }
100
125
 
101
- const divLoader = <div className="lds-roller-container"><div className="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>;
102
-
126
+ const divLoader = (
127
+ <div className="lds-roller-container">
128
+ <div className="lds-roller">
129
+ <div></div>
130
+ <div></div>
131
+ <div></div>
132
+ <div></div>
133
+ <div></div>
134
+ <div></div>
135
+ <div></div>
136
+ <div></div>
137
+ </div>
138
+ </div>
139
+ );
103
140
  return (
104
141
  <div>
105
142
  <div className="r-wrapper r-actu-wrapper">
106
143
  <div className="r-result r-annuaire-result">
107
- <Switch>
108
- <Route exact path="/">
109
- <div className="r-result-filter actu-result-filter">
110
- <Filters
111
- url={props.queryFilterUrl}
112
- activeFilter={filters}
113
- onChange={filtersChange}
114
- />
115
- {props.proposeUrl &&
116
- (
117
- <div className="r-add-news">
118
- <a target="_blank" href={props.proposeUrl}><Translate text='Proposer une actualité' /></a>
119
- </div>
120
- )
121
- }
122
- {itemsNumber > 0 ? (
123
- <p className="r-results-numbers">
124
- <span>{itemsNumber}</span>{" "}
125
- {itemsNumber > 1
126
- ? <Translate text='Actualités trouvées' />
127
- : <Translate text='Actualité trouvée' />}
128
- </p>
129
- ) : (
130
- <p className="r-results-numbers"><Translate text='Aucun résultat' /></p>
131
- )}
132
- </div>
133
- <div>{listRender}</div>
134
- <div className="r-load-more">
135
- {itemsNumber - props.batchSize > batchStart ? (
136
- <div>
137
- <span className="no-more-result">
138
- {isLoading ? divLoader : ""}
139
- </span>
140
- <button onClick={loadMore} className="btn-grad">
141
- {isLoading ? <Translate text='Chargement...' /> : <Translate text='Plus de résultats' />}
142
- </button>
144
+ <Routes>
145
+ <Route
146
+ exact
147
+ path="/"
148
+ element={
149
+ <>
150
+ <div className="r-result-filter actu-result-filter">
151
+ <Filters
152
+ url={props.queryFilterUrl}
153
+ activeFilter={filters}
154
+ onChange={filtersChange}
155
+ />
156
+ {props.proposeUrl && (
157
+ <div className="r-add-news">
158
+ <a target="_blank" href={props.proposeUrl}>
159
+ <Translate text="Proposer une actualité" />
160
+ <svg
161
+ xmlns="http://www.w3.org/2000/svg"
162
+ width="16"
163
+ height="16"
164
+ fill="currentColor"
165
+ className="bi bi-plus-circle"
166
+ viewBox="0 0 16 16"
167
+ >
168
+ <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16" />
169
+ <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4" />
170
+ </svg>
171
+ </a>
172
+ </div>
173
+ )}
143
174
  </div>
144
- ) : (
145
- <span className="no-more-result">
146
- {isLoading ? divLoader : ""}
147
- </span>
148
- )}
149
- </div>
150
- </Route>
151
- <Route path={"/:name"}>
152
- <NewsContent
153
- onChange={clickID}
154
- onReturn={filtersChange}
155
- queryUrl={props.queryUrl}
156
- />
157
- </Route>
158
- </Switch>
175
+ {itemsNumber > 0 ? (
176
+ <p className="r-results-numbers">
177
+ <span>{itemsNumber}</span>{" "}
178
+ {itemsNumber > 1 ? (
179
+ <Translate text="Actualités trouvées" />
180
+ ) : (
181
+ <Translate text="Actualité trouvée" />
182
+ )}
183
+ </p>
184
+ ) : (
185
+ <p className="r-results-numbers">
186
+ <Translate text="Aucun résultat" />
187
+ </p>
188
+ )}
189
+ <div>{listRender}</div>
190
+ <div className="r-load-more">
191
+ {itemsNumber - props.batchSize > batchStart ? (
192
+ <div>
193
+ <span className="no-more-result">
194
+ {isLoading ? divLoader : ""}
195
+ </span>
196
+ <button onClick={loadMore} className="btn-grad">
197
+ {isLoading ? (
198
+ <Translate text="Chargement..." />
199
+ ) : (
200
+ <Translate text="Plus de résultats" />
201
+ )}
202
+ </button>
203
+ </div>
204
+ ) : (
205
+ <span className="no-more-result">
206
+ {isLoading ? divLoader : ""}
207
+ </span>
208
+ )}
209
+ </div>
210
+ </>
211
+ }
212
+ ></Route>
213
+ <Route
214
+ path={"/:name"}
215
+ element={
216
+ <NewsContent
217
+ onChange={clickID}
218
+ onReturn={filtersChange}
219
+ queryUrl={props.queryUrl}
220
+ contextAuthenticatedUser={props.contextAuthenticatedUser}
221
+ />
222
+ }
223
+ ></Route>
224
+ </Routes>
159
225
  </div>
160
226
  </div>
161
227
  </div>