imio.smartweb.core 1.2.11__py3-none-any.whl → 1.2.19__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.
- imio/smartweb/core/browser/configure.zcml +1 -1
- imio/smartweb/core/browser/dashboards/configure.zcml +0 -2
- imio/smartweb/core/browser/dashboards/plausible.py +4 -4
- imio/smartweb/core/browser/static/smartweb-edit-compiled.js +1 -1
- imio/smartweb/core/browser/static/src/edit.js +5 -0
- imio/smartweb/core/browser/utils.py +4 -30
- imio/smartweb/core/contents/__init__.py +2 -0
- imio/smartweb/core/contents/rest/base.py +12 -0
- imio/smartweb/core/contents/rest/configure.zcml +7 -0
- imio/smartweb/core/contents/rest/directory/content.py +2 -2
- imio/smartweb/core/contents/rest/directory/view.pt +2 -1
- imio/smartweb/core/contents/rest/directory/view.py +3 -0
- imio/smartweb/core/contents/rest/events/content.py +2 -2
- imio/smartweb/core/contents/rest/events/view.pt +2 -1
- imio/smartweb/core/contents/rest/events/view.py +3 -0
- imio/smartweb/core/contents/rest/news/content.py +2 -2
- imio/smartweb/core/contents/rest/news/view.pt +2 -1
- imio/smartweb/core/contents/rest/news/view.py +3 -0
- imio/smartweb/core/contents/rest/search/endpoint.py +1 -1
- imio/smartweb/core/contents/rest/traversal.py +18 -0
- imio/smartweb/core/contents/rest/view.py +7 -0
- imio/smartweb/core/contents/sections/events/view.py +1 -1
- imio/smartweb/core/contents/sections/news/view.py +1 -1
- imio/smartweb/core/interfaces.py +4 -0
- imio/smartweb/core/profiles/default/actions.xml +15 -0
- imio/smartweb/core/profiles/default/metadata.xml +1 -1
- imio/smartweb/core/rest/authentic_sources.py +47 -10
- imio/smartweb/core/rest/configure.zcml +54 -0
- imio/smartweb/core/tests/test_rest.py +120 -0
- imio/smartweb/core/tests/utils.py +15 -0
- imio/smartweb/core/upgrades/configure.zcml +18 -0
- imio/smartweb/core/upgrades/profiles/1051_to_1052/actions.xml +20 -0
- imio/smartweb/core/utils.py +31 -0
- imio/smartweb/core/viewlets/configure.zcml +11 -0
- imio/smartweb/core/viewlets/httpheaders.py +13 -0
- imio/smartweb/core/viewlets/ogp_tag_header.pt +10 -0
- imio/smartweb/core/viewlets/ogptags.py +8 -0
- imio/smartweb/core/webcomponents/build/css/54.smartweb-webcomponents-compiled.css +1 -0
- imio/smartweb/core/webcomponents/build/css/647.smartweb-webcomponents-compiled.css +1 -0
- imio/smartweb/core/webcomponents/build/js/3.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/323.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/363.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/493.smartweb-webcomponents-compiled.js +1 -0
- imio/smartweb/core/webcomponents/build/js/54.smartweb-webcomponents-compiled.js +1 -0
- imio/smartweb/core/webcomponents/build/js/647.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/647.smartweb-webcomponents-compiled.js.LICENSE.txt +1 -0
- imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/package.json +14 -17
- imio/smartweb/core/webcomponents/src/assets/contentIcon/download.svg +1 -0
- imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.jsx +85 -84
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactCard/ContactCard.jsx +22 -23
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +109 -93
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/download.svg +1 -0
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactList/ContactList.jsx +7 -7
- imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +43 -0
- imio/smartweb/core/webcomponents/src/components/Events/{ContactContent/ContactContent.jsx → EventContent/EventContent.jsx} +76 -81
- imio/smartweb/core/webcomponents/src/components/Events/{ContactList/ContactList.jsx → EventList/EventList.jsx} +9 -9
- imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +99 -98
- imio/smartweb/core/webcomponents/src/components/Events/Events.scss +1 -1
- imio/smartweb/core/webcomponents/src/components/News/News.jsx +23 -25
- imio/smartweb/core/webcomponents/src/components/News/News.scss +3 -5
- imio/smartweb/core/webcomponents/src/components/News/{ContactCard/ContactCard.jsx → NewsCard/NewsCard.jsx} +14 -27
- imio/smartweb/core/webcomponents/src/components/News/{ContactContent/ContactContent.jsx → NewsContent/NewsContent.jsx} +37 -40
- imio/smartweb/core/webcomponents/src/components/News/{ContactList/ContactList.jsx → NewsList/NewsList.jsx} +9 -9
- imio/smartweb/core/webcomponents/src/components/Search/ContactResult/ContactResult.jsx +5 -5
- imio/smartweb/core/webcomponents/src/components/Search/EventsResult/EventsResult.jsx +5 -5
- imio/smartweb/core/webcomponents/src/components/Search/NewsResult/NewsResult.jsx +5 -5
- imio/smartweb/core/webcomponents/src/components/Search/WebResult/WebResult.jsx +3 -3
- imio/smartweb/core/webcomponents/src/{components/Events/ContactMap/ContactMap.jsx → utils/Map.jsx} +60 -64
- {imio.smartweb.core-1.2.11.dist-info → imio.smartweb.core-1.2.19.dist-info}/METADATA +72 -1
- {imio.smartweb.core-1.2.11.dist-info → imio.smartweb.core-1.2.19.dist-info}/RECORD +81 -83
- imio/smartweb/core/webcomponents/build/css/267.smartweb-webcomponents-compiled.css +0 -1
- imio/smartweb/core/webcomponents/build/css/779.smartweb-webcomponents-compiled.css +0 -1
- imio/smartweb/core/webcomponents/build/js/267.smartweb-webcomponents-compiled.js +0 -1
- imio/smartweb/core/webcomponents/build/js/552.smartweb-webcomponents-compiled.js +0 -2
- imio/smartweb/core/webcomponents/build/js/565.smartweb-webcomponents-compiled.js +0 -1
- imio/smartweb/core/webcomponents/build/js/612.smartweb-webcomponents-compiled.js +0 -2
- imio/smartweb/core/webcomponents/build/js/779.smartweb-webcomponents-compiled.js +0 -1
- imio/smartweb/core/webcomponents/pnpm-lock.yaml +0 -7066
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactMap/ContactMap.jsx +0 -156
- imio/smartweb/core/webcomponents/src/components/Annuaire/Skeleton/LoaderCss.jsx +0 -7
- imio/smartweb/core/webcomponents/src/components/Annuaire/Skeleton/Skeleton.jsx +0 -20
- imio/smartweb/core/webcomponents/src/components/Events/ContactCard/ContactCard.jsx +0 -49
- imio/smartweb/core/webcomponents/src/components/Events/ContactMap/ContactMap.scss +0 -0
- imio/smartweb/core/webcomponents/src/components/Events/Skeleton/Skeleton.jsx +0 -20
- imio/smartweb/core/webcomponents/src/components/News/ContactMap/ContactMap.jsx +0 -127
- imio/smartweb/core/webcomponents/src/components/News/ContactMap/ContactMap.scss +0 -4
- imio/smartweb/core/webcomponents/src/components/News/Skeleton/Skeleton.jsx +0 -20
- imio/smartweb/core/webcomponents/src/components/Search/Skeleton/Skeleton.jsx +0 -20
- /imio/smartweb/core/webcomponents/build/css/{552.smartweb-webcomponents-compiled.css → 363.smartweb-webcomponents-compiled.css} +0 -0
- /imio/smartweb/core/webcomponents/build/js/{552.smartweb-webcomponents-compiled.js.LICENSE.txt → 3.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
- /imio/smartweb/core/webcomponents/build/js/{612.smartweb-webcomponents-compiled.js.LICENSE.txt → 363.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
- /imio/smartweb/core/webcomponents/src/{components/Annuaire/ContactMap/ContactMap.scss → utils/Map.scss} +0 -0
- /imio.smartweb.core-1.2.11-py3.10-nspkg.pth → /imio.smartweb.core-1.2.19-py3.10-nspkg.pth +0 -0
- {imio.smartweb.core-1.2.11.dist-info → imio.smartweb.core-1.2.19.dist-info}/LICENSE.GPL +0 -0
- {imio.smartweb.core-1.2.11.dist-info → imio.smartweb.core-1.2.19.dist-info}/LICENSE.rst +0 -0
- {imio.smartweb.core-1.2.11.dist-info → imio.smartweb.core-1.2.19.dist-info}/WHEEL +0 -0
- {imio.smartweb.core-1.2.11.dist-info → imio.smartweb.core-1.2.19.dist-info}/namespace_packages.txt +0 -0
- {imio.smartweb.core-1.2.11.dist-info → imio.smartweb.core-1.2.19.dist-info}/top_level.txt +0 -0
@@ -16,9 +16,9 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
16
16
|
{ UID: queryString.parse(useFilterQuery().toString())['u'], fullobjects: 1 },
|
17
17
|
);
|
18
18
|
const [params, setParams] = useState(parsed);
|
19
|
-
const [
|
20
|
-
const [files, setFiles] = useState(
|
21
|
-
const [gallery, setGallery] = useState(
|
19
|
+
const [item, setitem] = useState({});
|
20
|
+
const [files, setFiles] = useState();
|
21
|
+
const [gallery, setGallery] = useState();
|
22
22
|
const { response, error, isLoading } = useAxios(
|
23
23
|
{
|
24
24
|
method: "get",
|
@@ -37,40 +37,40 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
37
37
|
// set all contacts state
|
38
38
|
useEffect(() => {
|
39
39
|
if (response !== null) {
|
40
|
-
|
40
|
+
setitem(response.items[0]);
|
41
41
|
}
|
42
42
|
window.scrollTo(0, 0);
|
43
43
|
}, [response]);
|
44
44
|
|
45
45
|
/// use to set file and gallery items
|
46
46
|
useEffect(() => {
|
47
|
-
if (
|
48
|
-
setFiles(
|
49
|
-
setGallery(
|
47
|
+
if (item.items && item.items.length > 0) {
|
48
|
+
setFiles(item.items.filter(files => files['@type'] === 'File'));
|
49
|
+
setGallery(item.items.filter(files => files['@type'] === 'Image'));
|
50
50
|
}
|
51
|
-
}, [
|
51
|
+
}, [item]);
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
function handleClick() {
|
54
|
+
history.push("./");
|
55
|
+
onChange(null);
|
56
|
+
}
|
57
57
|
moment.locale('be');
|
58
|
-
const start = moment.utc(
|
59
|
-
const end = moment.utc(
|
60
|
-
const startHours = moment.utc(
|
61
|
-
const endHours = moment.utc(
|
58
|
+
const start = moment.utc(item.start).format('DD-MM-YYYY');
|
59
|
+
const end = moment.utc(item.end).format('DD-MM-YYYY');
|
60
|
+
const startHours = moment.utc(item.start).format('LT');
|
61
|
+
const endHours = moment.utc(item.end).format('LT');
|
62
62
|
|
63
63
|
let itineraryLink =
|
64
64
|
"https://www.google.com/maps/dir/?api=1&destination=" +
|
65
|
-
|
65
|
+
item.street +
|
66
66
|
"+" +
|
67
|
-
|
67
|
+
item.number +
|
68
68
|
"+" +
|
69
|
-
|
69
|
+
item.complement +
|
70
70
|
"+" +
|
71
|
-
|
71
|
+
item.zipcode +
|
72
72
|
"+" +
|
73
|
-
|
73
|
+
item.city
|
74
74
|
itineraryLink = itineraryLink.replaceAll('+null', '')
|
75
75
|
|
76
76
|
return (
|
@@ -80,14 +80,14 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
80
80
|
</button>
|
81
81
|
<article>
|
82
82
|
<header>
|
83
|
-
<h2 className="r-content-title">{
|
83
|
+
<h2 className="r-content-title">{item.title}</h2>
|
84
84
|
</header>
|
85
85
|
<figure>
|
86
86
|
<div
|
87
87
|
className="r-content-img"
|
88
88
|
style={{
|
89
|
-
backgroundImage:
|
90
|
-
? "url(" +
|
89
|
+
backgroundImage: item.image_affiche_scale
|
90
|
+
? "url(" + item.image_affiche_scale + ")"
|
91
91
|
: "",
|
92
92
|
}}
|
93
93
|
/>
|
@@ -110,12 +110,12 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
110
110
|
<div className="r-content-news-info--date">
|
111
111
|
{start === end
|
112
112
|
? (<div>
|
113
|
-
{
|
113
|
+
{item.whole_day
|
114
114
|
? <div className="r-content-date-start">
|
115
115
|
<span>Le </span>
|
116
116
|
<div className="r-time">{start}</div>
|
117
117
|
</div>
|
118
|
-
:
|
118
|
+
: item.open_end ?
|
119
119
|
<>
|
120
120
|
<div className="r-content-date-one-day">
|
121
121
|
<div className="r-content-date-start">
|
@@ -160,7 +160,7 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
160
160
|
</div>
|
161
161
|
{/* adress */}
|
162
162
|
<div className="r-content-news-info-aera">
|
163
|
-
{
|
163
|
+
{item.street ? (
|
164
164
|
<div className="icon-baseline">
|
165
165
|
<svg
|
166
166
|
xmlns="http://www.w3.org/2000/svg"
|
@@ -175,7 +175,7 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
175
175
|
|
176
176
|
<div className="dpinlb">
|
177
177
|
<div className="r-content-news-info--itinirary">
|
178
|
-
{
|
178
|
+
{item.street ? (
|
179
179
|
<a href={itineraryLink} target="_blank">
|
180
180
|
<span>Itinéraire</span>
|
181
181
|
</a>
|
@@ -183,7 +183,7 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
183
183
|
""
|
184
184
|
)}
|
185
185
|
</div>
|
186
|
-
{
|
186
|
+
{item.reduced_mobility_facilities === true ? (
|
187
187
|
<div className="r-content-news-info--reduced">
|
188
188
|
<span><Translate text="Accessible aux PMR" /></span>
|
189
189
|
</div>
|
@@ -196,26 +196,26 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
196
196
|
<div className="r-content-news-info-contact">
|
197
197
|
<div className="dpinlb">
|
198
198
|
<div className="r-content-news-info--name">
|
199
|
-
<span>{
|
199
|
+
<span>{item.contact_name}</span>
|
200
200
|
</div>
|
201
201
|
<div className="r-content-news-info--phone">
|
202
202
|
<span>
|
203
|
-
<a href={`tel:${
|
204
|
-
{
|
203
|
+
<a href={`tel:${item.contact_phone}`}>
|
204
|
+
{item.contact_phone}
|
205
205
|
</a>
|
206
206
|
</span>
|
207
207
|
</div>
|
208
208
|
<div className="r-content-news-info--email">
|
209
|
-
<a href={`mailto:${
|
210
|
-
{
|
209
|
+
<a href={`mailto:${item.contact_email}`}>
|
210
|
+
{item.contact_email}
|
211
211
|
</a>
|
212
212
|
</div>
|
213
213
|
</div>
|
214
214
|
</div>
|
215
215
|
{/* link */}
|
216
|
-
{
|
217
|
-
|
218
|
-
|
216
|
+
{item.event_url === null &&
|
217
|
+
item.online_participation === null &&
|
218
|
+
item.video_url === null ? (
|
219
219
|
""
|
220
220
|
) : (
|
221
221
|
<div className="r-content-news-info-link">
|
@@ -228,27 +228,27 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
228
228
|
</svg>
|
229
229
|
</div>
|
230
230
|
<div className="dpinlb">
|
231
|
-
{
|
231
|
+
{item.event_url === null ? (
|
232
232
|
""
|
233
233
|
) : (
|
234
234
|
<div className="r-content-news-info-event_link">
|
235
|
-
<a href={
|
235
|
+
<a href={item.event_url}><Translate text="Lien de l'événement" /></a>
|
236
236
|
</div>
|
237
237
|
)}
|
238
|
-
{
|
238
|
+
{item.online_participation === null ? (
|
239
239
|
""
|
240
240
|
) : (
|
241
241
|
<div className="r-content-news-info--online_participation">
|
242
|
-
<a href={
|
242
|
+
<a href={item.online_participation}>
|
243
243
|
<Translate text="Participation en ligne" />
|
244
244
|
</a>
|
245
245
|
</div>
|
246
246
|
)}
|
247
|
-
{
|
247
|
+
{item.video_url === null ? (
|
248
248
|
""
|
249
249
|
) : (
|
250
250
|
<div className="r-content-news-info--video">
|
251
|
-
<a href={
|
251
|
+
<a href={item.video_url}><Translate text="Lien vers la vidéo" /></a>
|
252
252
|
</div>
|
253
253
|
)}
|
254
254
|
</div>
|
@@ -256,18 +256,18 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
256
256
|
)}
|
257
257
|
|
258
258
|
{/* Social */}
|
259
|
-
{
|
260
|
-
|
261
|
-
|
259
|
+
{item.facebook === null &&
|
260
|
+
item.instagram === null &&
|
261
|
+
item.twitter === null ? (
|
262
262
|
""
|
263
263
|
) : (
|
264
264
|
<div className="r-content-news-info-social">
|
265
265
|
<ul>
|
266
|
-
{!
|
266
|
+
{!item.facebook ? (
|
267
267
|
""
|
268
268
|
) : (
|
269
269
|
<li>
|
270
|
-
<a href={
|
270
|
+
<a href={item.facebook} target="_blank">
|
271
271
|
<svg
|
272
272
|
xmlns="http://www.w3.org/2000/svg"
|
273
273
|
height="800"
|
@@ -286,11 +286,11 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
286
286
|
</a>
|
287
287
|
</li>
|
288
288
|
)}
|
289
|
-
{!
|
289
|
+
{!item.instagram ? (
|
290
290
|
""
|
291
291
|
) : (
|
292
292
|
<li>
|
293
|
-
<a href={
|
293
|
+
<a href={item.instagram} target="_blank">
|
294
294
|
<svg
|
295
295
|
xmlns="http://www.w3.org/2000/svg"
|
296
296
|
height="800"
|
@@ -305,11 +305,11 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
305
305
|
</a>
|
306
306
|
</li>
|
307
307
|
)}
|
308
|
-
{!
|
308
|
+
{!item.twitter ? (
|
309
309
|
""
|
310
310
|
) : (
|
311
311
|
<li>
|
312
|
-
<a href={
|
312
|
+
<a href={item.twitter} target="_blank">
|
313
313
|
<svg
|
314
314
|
xmlns="http://www.w3.org/2000/svg"
|
315
315
|
height="800"
|
@@ -330,9 +330,9 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
330
330
|
</div>
|
331
331
|
{/* booking */}
|
332
332
|
<div className="r-content-news-info-action">
|
333
|
-
{
|
333
|
+
{item.ticket_url ? (
|
334
334
|
<div className="r-content-booking">
|
335
|
-
<a href={
|
335
|
+
<a href={item.ticket_url}>
|
336
336
|
<svg
|
337
337
|
xmlns="http://www.w3.org/2000/svg"
|
338
338
|
viewBox="0 0 19.41 19.41"
|
@@ -355,43 +355,38 @@ const ContactContent = ({ queryUrl, onChange }) => {
|
|
355
355
|
</div>
|
356
356
|
</div>
|
357
357
|
<div className="r-content-description">
|
358
|
-
<ReactMarkdown>{
|
358
|
+
<ReactMarkdown>{item.description}</ReactMarkdown>
|
359
359
|
</div>
|
360
360
|
<div
|
361
361
|
className="r-content-text"
|
362
362
|
dangerouslySetInnerHTML={{
|
363
|
-
__html:
|
363
|
+
__html: item.text && item.text.data,
|
364
364
|
}}
|
365
365
|
></div>
|
366
366
|
{/* add files to download */}
|
367
|
-
{
|
368
|
-
files
|
369
|
-
|
370
|
-
{
|
371
|
-
<
|
372
|
-
<
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
))}
|
379
|
-
</div>
|
380
|
-
) : ("")
|
367
|
+
{files &&
|
368
|
+
<div className="r-content-files">
|
369
|
+
{files.map((file, i) => (
|
370
|
+
<div key={i} className="r-content-file">
|
371
|
+
<a href={file.targetUrl} className="r-content-file-link" rel="nofollow">
|
372
|
+
<span className="r-content-file-title">{file.title}</span>
|
373
|
+
<span className="r-content-file-icon"><svg width="21" height="21" viewBox="0 0 24 24" fill="none" stroke="#8899a4" stroke-width="2" stroke-linecap="square" stroke-linejoin="arcs"><path d="M3 15v4c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-4M17 9l-5 5-5-5M12 12.8V2.5"></path></svg> </span>
|
374
|
+
</a>
|
375
|
+
</div>
|
376
|
+
))}
|
377
|
+
</div>
|
381
378
|
}
|
382
379
|
{/* add gallery */}
|
383
|
-
{
|
384
|
-
gallery
|
385
|
-
<div className="r-content-gallery">
|
386
|
-
|
387
|
-
{
|
388
|
-
<
|
389
|
-
|
390
|
-
|
391
|
-
))}
|
392
|
-
</div>
|
380
|
+
{gallery &&
|
381
|
+
<div className="r-content-gallery">
|
382
|
+
<div className="spotlight-group flexbin r-content-gallery">
|
383
|
+
{gallery.map((image, i) => (
|
384
|
+
<a key={i} className="spotlight" href={image.image_extralarge_scale}>
|
385
|
+
<img src={image.image_vignette_scale} />
|
386
|
+
</a>
|
387
|
+
))}
|
393
388
|
</div>
|
394
|
-
|
389
|
+
</div>
|
395
390
|
}
|
396
391
|
</article>
|
397
392
|
</div>
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import
|
1
|
+
import EventCard from "../EventCard/EventCard";
|
2
2
|
import { Link } from "react-router-dom";
|
3
3
|
import React from "react";
|
4
4
|
import removeAccents from "remove-accents";
|
5
|
-
const ContactList = ({
|
5
|
+
const ContactList = ({ itemsArray, onChange, onHover, parentCallback }) => {
|
6
6
|
function handleClick(event) {
|
7
7
|
onChange(event);
|
8
8
|
}
|
@@ -13,26 +13,26 @@ const ContactList = ({ contactArray, onChange, onHover, parentCallback }) => {
|
|
13
13
|
return (
|
14
14
|
<React.Fragment>
|
15
15
|
<ul className="r-result-list event-result-list">
|
16
|
-
{
|
16
|
+
{itemsArray.map((item, i) => (
|
17
17
|
<li
|
18
18
|
key={i}
|
19
19
|
className="r-list-item-group"
|
20
|
-
onMouseEnter={() => handleHover(
|
20
|
+
onMouseEnter={() => handleHover(item.UID)}
|
21
21
|
onMouseLeave={() => handleHover(null)}
|
22
|
-
onClick={() => handleClick(
|
22
|
+
onClick={() => handleClick(item.UID)}
|
23
23
|
>
|
24
24
|
<Link
|
25
25
|
className="r-list-item-link"
|
26
26
|
style={{ textDecoration: "none" }}
|
27
27
|
to={{
|
28
|
-
pathname: removeAccents(
|
29
|
-
search: `?u=${
|
28
|
+
pathname: removeAccents(item.title).replace(/[^a-zA-Z ]/g, "").replace(/\s/g, "-").toLowerCase(),
|
29
|
+
search: `?u=${item.UID}`,
|
30
30
|
state: {
|
31
|
-
idItem:
|
31
|
+
idItem: item.UID,
|
32
32
|
},
|
33
33
|
}}
|
34
34
|
></Link>
|
35
|
-
<
|
35
|
+
<EventCard item={item} key={item.created} />
|
36
36
|
</li>
|
37
37
|
))}
|
38
38
|
</ul>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { useEffect, useState, useRef } from "react";
|
2
|
-
import {
|
2
|
+
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
|
3
3
|
import Filters from "./Filters/Filter";
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
4
|
+
import EventContent from "./EventContent/EventContent";
|
5
|
+
import EventList from "./EventList/EventList";
|
6
|
+
import Map from "../../utils/Map";
|
7
7
|
import useAxios from "../../hooks/useAxios";
|
8
8
|
import "./Events.scss";
|
9
9
|
import useFilterQuery from "../../hooks/useFilterQuery";
|
@@ -12,7 +12,7 @@ import translation from '../../utils/translation';
|
|
12
12
|
|
13
13
|
export default function Events(props) {
|
14
14
|
return (
|
15
|
-
<Router>
|
15
|
+
<Router basename={props.viewPath}>
|
16
16
|
<Provider language={props.currentLanguage} translation={translation}>
|
17
17
|
<EventsView
|
18
18
|
queryFilterUrl={props.queryFilterUrl}
|
@@ -31,14 +31,14 @@ function EventsView(props) {
|
|
31
31
|
{ b_start: 0, fullobjects: 1 },
|
32
32
|
queryString.parse(useFilterQuery().toString())
|
33
33
|
);
|
34
|
-
const [
|
35
|
-
const [
|
34
|
+
const [itemsArray, setItemsArray] = useState([]);
|
35
|
+
const [itemsNumber, setItemsNumber] = useState([]);
|
36
36
|
const [clickId, setClickId] = useState(null);
|
37
37
|
const [hoverId, setHoverId] = useState(null);
|
38
38
|
const [filters, setFilters] = useState(parsed);
|
39
39
|
const [batchStart, setBatchStart] = useState(0);
|
40
40
|
const [loadMoreLaunch, setLoadMoreLaunch] = useState(false);
|
41
|
-
const displayMap =
|
41
|
+
const displayMap = props.displayMap === "True" ? true : false;
|
42
42
|
const { response, error, isLoading, isMore } = useAxios(
|
43
43
|
{
|
44
44
|
method: "get",
|
@@ -57,11 +57,11 @@ function EventsView(props) {
|
|
57
57
|
useEffect(() => {
|
58
58
|
if (response !== null) {
|
59
59
|
if (isMore) {
|
60
|
-
|
60
|
+
setItemsArray((itemsArray) => [...itemsArray, ...response.items]);
|
61
61
|
} else {
|
62
|
-
|
62
|
+
setItemsArray(response.items);
|
63
63
|
}
|
64
|
-
|
64
|
+
setItemsNumber(response.items_total);
|
65
65
|
}
|
66
66
|
}, [response]);
|
67
67
|
|
@@ -78,7 +78,7 @@ function EventsView(props) {
|
|
78
78
|
// set state filters when active filter selection
|
79
79
|
const filtersChange = (value) => {
|
80
80
|
setLoadMoreLaunch(false);
|
81
|
-
setBatchStart((
|
81
|
+
setBatchStart(() => 0);
|
82
82
|
setFilters(value);
|
83
83
|
window.scrollTo(0, 0);
|
84
84
|
};
|
@@ -104,7 +104,7 @@ function EventsView(props) {
|
|
104
104
|
let portalHeaderHeight = portalHeader.offsetHeight;
|
105
105
|
|
106
106
|
const filterRef = useRef();
|
107
|
-
const [style, setStyle] = React.useState({ height:0 });
|
107
|
+
const [style, setStyle] = React.useState({ height: 0 });
|
108
108
|
useEffect(() => {
|
109
109
|
setStyle({
|
110
110
|
height: filterRef.current.clientHeight,
|
@@ -114,16 +114,17 @@ function EventsView(props) {
|
|
114
114
|
// coditional list render
|
115
115
|
let listRender;
|
116
116
|
let MapRender;
|
117
|
-
if (
|
117
|
+
if (itemsArray && itemsArray.length > 0) {
|
118
118
|
listRender = (
|
119
|
-
<
|
119
|
+
<EventList onChange={clickID} itemsArray={itemsArray} onHover={hoverID} />
|
120
120
|
);
|
121
121
|
MapRender = (
|
122
|
-
<
|
122
|
+
<Map
|
123
123
|
headerHeight={style.height + portalHeaderHeight}
|
124
124
|
clickId={clickId}
|
125
125
|
hoverId={hoverId}
|
126
|
-
items={
|
126
|
+
items={itemsArray}
|
127
|
+
queryUrl={props.queryUrl}
|
127
128
|
/>
|
128
129
|
);
|
129
130
|
} else if (!isLoading) {
|
@@ -131,95 +132,95 @@ function EventsView(props) {
|
|
131
132
|
}
|
132
133
|
|
133
134
|
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>;
|
135
|
+
|
134
136
|
return (
|
135
|
-
<
|
136
|
-
<div
|
137
|
+
<div className={`ref ${displayMap ? "view-map" : "no-map"}`}>
|
138
|
+
<div
|
139
|
+
className="r-result-filter-container"
|
140
|
+
ref={filterRef}
|
141
|
+
style={{ top: portalHeaderHeight }}
|
142
|
+
>
|
137
143
|
<div
|
138
|
-
|
139
|
-
|
140
|
-
style={{ top: portalHeaderHeight }}
|
144
|
+
id="r-result-filter"
|
145
|
+
className="r-result-filter container annuaire-result-filter"
|
141
146
|
>
|
142
|
-
<
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
{props.proposeUrl &&
|
152
|
-
(
|
153
|
-
<div className="r-add-event">
|
154
|
-
<a target="_blank" href={props.proposeUrl}><Translate text='Proposer un événement' /></a>
|
155
|
-
</div>
|
156
|
-
)
|
157
|
-
}
|
158
|
-
{contactNumber > 0 ? (
|
159
|
-
<p className="r-results-numbers">
|
160
|
-
<span>{contactNumber}</span>
|
161
|
-
{contactNumber > 1
|
162
|
-
? <Translate text='événements trouvés' />
|
163
|
-
: <Translate text='événement trouvé' />}
|
164
|
-
</p>
|
165
|
-
) : (
|
166
|
-
<p className="r-results-numbers"><Translate text='Aucun résultat' /></p>
|
167
|
-
)}
|
168
|
-
</div>
|
169
|
-
</div>
|
170
|
-
<Switch>
|
171
|
-
<Route path={"/:name"}>
|
172
|
-
<div className="r-wrapper container r-annuaire-wrapper">
|
173
|
-
<div className="r-result r-annuaire-result">
|
174
|
-
<ContactContent queryUrl={props.queryUrl} onChange={clickID} />
|
175
|
-
</div>
|
176
|
-
{displayMap && <div
|
177
|
-
className="r-map annuaire-map"
|
178
|
-
style={{
|
179
|
-
top: style.height + portalHeaderHeight,
|
180
|
-
height: "calc(100vh-" + style.height + portalHeaderHeight,
|
181
|
-
}}
|
182
|
-
>
|
183
|
-
{MapRender}
|
147
|
+
<Filters
|
148
|
+
url={props.queryFilterUrl}
|
149
|
+
activeFilter={filters}
|
150
|
+
onChange={filtersChange}
|
151
|
+
/>
|
152
|
+
{props.proposeUrl &&
|
153
|
+
(
|
154
|
+
<div className="r-add-event">
|
155
|
+
<a target="_blank" href={props.proposeUrl}><Translate text='Proposer un événement' /></a>
|
184
156
|
</div>
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
<
|
192
|
-
<
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
157
|
+
)
|
158
|
+
}
|
159
|
+
{itemsNumber > 0 ? (
|
160
|
+
<p className="r-results-numbers">
|
161
|
+
<span>{itemsNumber}</span>
|
162
|
+
{itemsNumber > 1
|
163
|
+
? <Translate text='événements trouvés' />
|
164
|
+
: <Translate text='événement trouvé' />}
|
165
|
+
</p>
|
166
|
+
) : (
|
167
|
+
<p className="r-results-numbers"><Translate text='Aucun résultat' /></p>
|
168
|
+
)}
|
169
|
+
</div>
|
170
|
+
</div>
|
171
|
+
<Switch>
|
172
|
+
|
173
|
+
<Route exact path="/">
|
174
|
+
<div className="r-wrapper container r-annuaire-wrapper">
|
175
|
+
<div className="r-result r-annuaire-result">
|
176
|
+
<div>{listRender}</div>
|
177
|
+
<div className="r-load-more">
|
178
|
+
{itemsNumber - props.batchSize > batchStart ? (
|
179
|
+
<div>
|
203
180
|
<span className="no-more-result">
|
204
181
|
{isLoading ? divLoader : ""}
|
205
182
|
</span>
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
}
|
215
|
-
>
|
216
|
-
{MapRender}
|
183
|
+
<button onClick={loadMore} className="btn-grad">
|
184
|
+
{isLoading ? <Translate text='Chargement...' /> : <Translate text='Plus de résultats' />}
|
185
|
+
</button>
|
186
|
+
</div>
|
187
|
+
) : (
|
188
|
+
<span className="no-more-result">
|
189
|
+
{isLoading ? divLoader : ""}
|
190
|
+
</span>
|
191
|
+
)}
|
217
192
|
</div>
|
218
|
-
}
|
219
193
|
</div>
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
194
|
+
{displayMap && <div
|
195
|
+
className="r-map annuaire-map"
|
196
|
+
style={{
|
197
|
+
top: style.height + portalHeaderHeight,
|
198
|
+
height: "calc(100vh-" + style.height + portalHeaderHeight,
|
199
|
+
}}
|
200
|
+
>
|
201
|
+
{MapRender}
|
202
|
+
</div>
|
203
|
+
}
|
204
|
+
</div>
|
205
|
+
</Route>
|
206
|
+
<Route path={"/:name"}>
|
207
|
+
<div className="r-wrapper container r-annuaire-wrapper">
|
208
|
+
<div className="r-result r-annuaire-result">
|
209
|
+
<EventContent queryUrl={props.queryUrl} onChange={clickID} />
|
210
|
+
</div>
|
211
|
+
{displayMap && <div
|
212
|
+
className="r-map annuaire-map"
|
213
|
+
style={{
|
214
|
+
top: style.height + portalHeaderHeight,
|
215
|
+
height: "calc(100vh-" + style.height + portalHeaderHeight,
|
216
|
+
}}
|
217
|
+
>
|
218
|
+
{MapRender}
|
219
|
+
</div>
|
220
|
+
}
|
221
|
+
</div>
|
222
|
+
</Route>
|
223
|
+
</Switch>
|
224
|
+
</div>
|
224
225
|
);
|
225
226
|
}
|