imio.smartweb.core 1.2.38__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.38.dist-info → imio.smartweb.core-1.2.79.dist-info}/METADATA +403 -10
  200. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.79.dist-info}/RECORD +206 -160
  201. {imio.smartweb.core-1.2.38.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/40.smartweb-webcomponents-compiled.js +0 -1
  209. imio/smartweb/core/webcomponents/build/js/674.smartweb-webcomponents-compiled.js +0 -2
  210. imio/smartweb/core/webcomponents/build/js/686.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.38-py3.8-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.38.dist-info → imio.smartweb.core-1.2.79.dist-info}/LICENSE.GPL +0 -0
  220. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.79.dist-info}/LICENSE.rst +0 -0
  221. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.79.dist-info}/namespace_packages.txt +0 -0
  222. {imio.smartweb.core-1.2.38.dist-info → imio.smartweb.core-1.2.79.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,30 @@
1
+ import React, { useEffect, useContext } from "react";
1
2
  import EventCard from "../EventCard/EventCard";
2
3
  import { Link } from "react-router-dom";
3
- import React from "react";
4
4
  import removeAccents from "remove-accents";
5
- const ContactList = ({ itemsArray, onChange, onHover, parentCallback }) => {
5
+ import { ScrollContext } from "../../../hooks/ScrollContext";
6
+ const ContactList = ({
7
+ itemsArray,
8
+ onChange,
9
+ onHover,
10
+ showCategoriesOrTopics,
11
+ contextAuthenticatedUser,
12
+ }) => {
13
+ const { scrollPos, updateScrollPos } = useContext(ScrollContext);
14
+
6
15
  function handleClick(event) {
7
16
  onChange(event);
17
+ updateScrollPos(window.scrollY);
8
18
  }
9
19
 
10
20
  function handleHover(event) {
11
21
  onHover(event);
12
22
  }
23
+
24
+ useEffect(() => {
25
+ window.scrollTo({ top: scrollPos, left: 0, behavior: "instant" });
26
+ }, [itemsArray]);
27
+
13
28
  return (
14
29
  <React.Fragment>
15
30
  <ul className="r-result-list event-result-list">
@@ -25,14 +40,24 @@ const ContactList = ({ itemsArray, onChange, onHover, parentCallback }) => {
25
40
  className="r-list-item-link"
26
41
  style={{ textDecoration: "none" }}
27
42
  to={{
28
- pathname: "/"+removeAccents(item.title).replace(/[^a-zA-Z ]/g, "").replace(/\s/g, "-").toLowerCase(),
43
+ pathname:
44
+ "/" +
45
+ removeAccents(item.title)
46
+ .replace(/[^a-zA-Z ]/g, "")
47
+ .replace(/\s/g, "-")
48
+ .toLowerCase(),
29
49
  search: `?u=${item.UID}`,
30
50
  state: {
31
51
  idItem: item.UID,
32
52
  },
33
53
  }}
34
54
  ></Link>
35
- <EventCard item={item} key={item.created} />
55
+ <EventCard
56
+ item={item}
57
+ showCategoriesOrTopics={showCategoriesOrTopics}
58
+ key={item.created}
59
+ contextAuthenticatedUser={contextAuthenticatedUser}
60
+ />
36
61
  </li>
37
62
  ))}
38
63
  </ul>
@@ -1,38 +1,57 @@
1
- import React, { useEffect, useState, useRef } from "react";
2
- import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
1
+ import React, { useEffect, useState, useContext, useRef } 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 EventContent from "./EventContent/EventContent";
5
6
  import EventList from "./EventList/EventList";
6
7
  import Map from "../../utils/Map";
7
8
  import useAxios from "../../hooks/useAxios";
8
9
  import "./Events.scss";
10
+ import "../Filters/MainFilter.scss";
9
11
  import useFilterQuery from "../../hooks/useFilterQuery";
10
12
  import { Provider, Translate } from "react-translated";
11
- import translation from '../../utils/translation';
13
+ import translation from "../../utils/translation";
12
14
  import moment from "moment";
15
+ import queryString from "query-string";
13
16
 
14
17
  export default function Events(props) {
18
+ // Utilisation de useState pour gérer la valeur du contexte
19
+ const [scrollPos, setScrollPos] = useState(0);
20
+ // Fonction pour mettre à jour la position du scroll
21
+ const updateScrollPos = (newScrollPos) => {
22
+ setScrollPos(newScrollPos);
23
+ };
15
24
  return (
16
- <Router basename={props.viewPath}>
25
+ <BrowserRouter basename={props.viewPath}>
17
26
  <Provider language={props.currentLanguage} translation={translation}>
18
- <EventsView
19
- queryFilterUrl={props.queryFilterUrl}
20
- queryUrl={props.queryUrl}
21
- proposeUrl={props.proposeUrl}
22
- batchSize={props.batchSize}
23
- displayMap={props.displayMap}
24
- language={props.currentLanguage}
25
- />
27
+ <ScrollContext.Provider value={{ scrollPos, updateScrollPos }}>
28
+ <EventsView
29
+ queryFilterUrl={props.queryFilterUrl}
30
+ queryUrl={props.queryUrl}
31
+ proposeUrl={props.proposeUrl}
32
+ batchSize={props.batchSize}
33
+ displayMap={props.displayMap}
34
+ onlyPastEvents={props.onlyPastEvents}
35
+ language={props.currentLanguage}
36
+ showCategoriesOrTopics={props.showCategoriesOrTopics}
37
+ contextAuthenticatedUser={props.contextAuthenticatedUser}
38
+ />
39
+ </ScrollContext.Provider>
26
40
  </Provider>
27
- </Router>
41
+ </BrowserRouter>
28
42
  );
29
43
  }
30
44
  function EventsView(props) {
31
- const queryString = require("query-string");
32
45
  const { u, ...parsed } = Object.assign(
33
- { b_start: 0, fullobjects: 1, "event_dates.query":[moment().format('YYYY-MM-DD')],"event_dates.range":"min"},
46
+ {
47
+ b_start: 0,
48
+ fullobjects: 1,
49
+ "event_dates.query": [moment().format("YYYY-MM-DD")],
50
+ "event_dates.range": props.onlyPastEvents === "True" ? "max" : "min",
51
+ },
34
52
  queryString.parse(useFilterQuery().toString())
35
53
  );
54
+ const { scrollPos, updateScrollPos } = useContext(ScrollContext);
36
55
  const [itemsArray, setItemsArray] = useState([]);
37
56
  const [itemsNumber, setItemsNumber] = useState([]);
38
57
  const [clickId, setClickId] = useState(null);
@@ -88,6 +107,7 @@ function EventsView(props) {
88
107
 
89
108
  // set batch
90
109
  const loadMore = () => {
110
+ updateScrollPos(window.scrollY);
91
111
  setBatchStart((batchStart) => batchStart + parseInt(props.batchSize));
92
112
  setLoadMoreLaunch(true);
93
113
  };
@@ -103,27 +123,32 @@ function EventsView(props) {
103
123
  }, [batchStart]);
104
124
 
105
125
  // filter top style
106
- let portalHeader = document.getElementById("portal-header");
107
- let portalHeaderHeight = portalHeader.offsetHeight;
108
-
109
126
  const filterRef = useRef();
110
127
  const [style, setStyle] = React.useState({ height: 0 });
128
+ const [headerHeight, setHeaderHeight] = useState(0);
111
129
  useEffect(() => {
112
130
  setStyle({
113
131
  height: filterRef.current.clientHeight,
114
132
  });
115
- }, [filterRef.current]);
133
+ setHeaderHeight(filterRef.current.offsetTop);
134
+ }, [filterRef]);
116
135
 
117
136
  // coditional list render
118
137
  let listRender;
119
138
  let MapRender;
120
139
  if (itemsArray && itemsArray.length > 0) {
121
140
  listRender = (
122
- <EventList onChange={clickID} itemsArray={itemsArray} onHover={hoverID} />
141
+ <EventList
142
+ onChange={clickID}
143
+ itemsArray={itemsArray}
144
+ onHover={hoverID}
145
+ showCategoriesOrTopics={props.showCategoriesOrTopics}
146
+ contextAuthenticatedUser={props.contextAuthenticatedUser}
147
+ />
123
148
  );
124
149
  MapRender = (
125
150
  <Map
126
- headerHeight={style.height + portalHeaderHeight}
151
+ headerHeight={style.height + headerHeight}
127
152
  clickId={clickId}
128
153
  hoverId={hoverId}
129
154
  items={itemsArray}
@@ -131,16 +156,32 @@ function EventsView(props) {
131
156
  />
132
157
  );
133
158
  } else if (!isLoading) {
134
- listRender = <p><Translate text="Aucun événement n'a été trouvé" /></p>;
159
+ listRender = (
160
+ <p>
161
+ <Translate text="Aucun événement n'a été trouvé" />
162
+ </p>
163
+ );
135
164
  }
136
-
137
- 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>;
165
+ const divLoader = (
166
+ <div className="lds-roller-container">
167
+ <div className="lds-roller">
168
+ <div></div>
169
+ <div></div>
170
+ <div></div>
171
+ <div></div>
172
+ <div></div>
173
+ <div></div>
174
+ <div></div>
175
+ <div></div>
176
+ </div>
177
+ </div>
178
+ );
138
179
  return (
139
180
  <div className={`ref ${displayMap ? "view-map" : "no-map"}`}>
140
181
  <div
141
182
  className="r-result-filter-container"
142
183
  ref={filterRef}
143
- style={{ top: portalHeaderHeight }}
184
+ style={{ top: headerHeight }}
144
185
  >
145
186
  <div
146
187
  id="r-result-filter"
@@ -151,79 +192,112 @@ function EventsView(props) {
151
192
  activeFilter={filters}
152
193
  onChange={filtersChange}
153
194
  language={props.language}
195
+ onlyPastEvents={props.onlyPastEvents}
154
196
  />
155
- {props.proposeUrl &&
156
- (
157
- <div className="r-add-event">
158
- <a target="_blank" href={props.proposeUrl}><Translate text='Proposer un événement' /></a>
159
- </div>
160
- )
161
- }
162
- {itemsNumber > 0 ? (
163
- <p className="r-results-numbers">
164
- <span>{itemsNumber}</span>
165
- {itemsNumber > 1
166
- ? <Translate text='événements trouvés' />
167
- : <Translate text='événement trouvé' />}
168
- </p>
169
- ) : (
170
- <p className="r-results-numbers"><Translate text='Aucun résultat' /></p>
197
+ {props.proposeUrl && (
198
+ <div className="r-add-event">
199
+ <a target="_blank" href={props.proposeUrl}>
200
+ <Translate text="Proposer un événement" />
201
+ <svg
202
+ xmlns="http://www.w3.org/2000/svg"
203
+ width="16"
204
+ height="16"
205
+ fill="currentColor"
206
+ className="bi bi-plus-circle"
207
+ viewBox="0 0 16 16"
208
+ >
209
+ <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" />
210
+ <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" />
211
+ </svg>
212
+ </a>
213
+ </div>
171
214
  )}
172
215
  </div>
173
216
  </div>
174
- <Switch>
175
-
176
- <Route exact path="/">
177
- <div className="r-wrapper container r-annuaire-wrapper">
178
- <div className="r-result r-annuaire-result">
179
- <div>{listRender}</div>
180
- <div className="r-load-more">
181
- {itemsNumber - props.batchSize > batchStart ? (
182
- <div>
217
+ <Routes>
218
+ <Route
219
+ exact
220
+ path="/"
221
+ element={
222
+ <div className="r-wrapper container r-annuaire-wrapper">
223
+ <div className="r-result r-annuaire-result">
224
+ {itemsNumber > 0 ? (
225
+ <p className="r-results-numbers">
226
+ <span>{itemsNumber}</span>
227
+ {itemsNumber > 1 ? (
228
+ <Translate text="événements trouvés" />
229
+ ) : (
230
+ <Translate text="événement trouvé" />
231
+ )}
232
+ </p>
233
+ ) : (
234
+ <p className="r-results-numbers">
235
+ <Translate text="Aucun résultat" />
236
+ </p>
237
+ )}
238
+ <div>{listRender}</div>
239
+ <div className="r-load-more">
240
+ {itemsNumber - props.batchSize > batchStart ? (
241
+ <div>
242
+ <span className="no-more-result">
243
+ {isLoading ? divLoader : ""}
244
+ </span>
245
+ <button onClick={loadMore} className="btn-grad">
246
+ {isLoading ? (
247
+ <Translate text="Chargement..." />
248
+ ) : (
249
+ <Translate text="Plus de résultats" />
250
+ )}
251
+ </button>
252
+ </div>
253
+ ) : (
183
254
  <span className="no-more-result">
184
255
  {isLoading ? divLoader : ""}
185
256
  </span>
186
- <button onClick={loadMore} className="btn-grad">
187
- {isLoading ? <Translate text='Chargement...' /> : <Translate text='Plus de résultats' />}
188
- </button>
189
- </div>
190
- ) : (
191
- <span className="no-more-result">
192
- {isLoading ? divLoader : ""}
193
- </span>
194
- )}
257
+ )}
258
+ </div>
195
259
  </div>
260
+ {displayMap && (
261
+ <div
262
+ className="r-map annuaire-map"
263
+ style={{
264
+ top: style.height + headerHeight,
265
+ height: "calc(100vh-" + style.height + headerHeight,
266
+ }}
267
+ >
268
+ {MapRender}
269
+ </div>
270
+ )}
196
271
  </div>
197
- {displayMap && <div
198
- className="r-map annuaire-map"
199
- style={{
200
- top: style.height + portalHeaderHeight,
201
- height: "calc(100vh-" + style.height + portalHeaderHeight,
202
- }}
203
- >
204
- {MapRender}
205
- </div>
206
- }
207
- </div>
208
- </Route>
209
- <Route path={"/:name"}>
210
- <div className="r-wrapper container r-annuaire-wrapper">
211
- <div className="r-result r-annuaire-result">
212
- <EventContent queryUrl={props.queryUrl} onChange={clickID} />
213
- </div>
214
- {displayMap && <div
215
- className="r-map annuaire-map"
216
- style={{
217
- top: style.height + portalHeaderHeight,
218
- height: "calc(100vh-" + style.height + portalHeaderHeight,
219
- }}
220
- >
221
- {MapRender}
272
+ }
273
+ ></Route>
274
+ <Route
275
+ path={"/:name"}
276
+ element={
277
+ <div className="r-wrapper container r-annuaire-wrapper">
278
+ <div className="r-result r-annuaire-result">
279
+ <EventContent
280
+ queryUrl={props.queryUrl}
281
+ onChange={clickID}
282
+ onlyPastEvents={props.onlyPastEvents}
283
+ contextAuthenticatedUser={props.contextAuthenticatedUser}
284
+ />
285
+ </div>
286
+ {displayMap && (
287
+ <div
288
+ className="r-map annuaire-map"
289
+ style={{
290
+ top: style.height + headerHeight,
291
+ height: "calc(100vh-" + style.height + headerHeight,
292
+ }}
293
+ >
294
+ {MapRender}
295
+ </div>
296
+ )}
222
297
  </div>
223
- }
224
- </div>
225
- </Route>
226
- </Switch>
298
+ }
299
+ ></Route>
300
+ </Routes>
227
301
  </div>
228
302
  );
229
303
  }