From bce53f18438ed63f482c6819b2851f446a03d34c Mon Sep 17 00:00:00 2001 From: Julien-Gr4z Date: Mon, 9 May 2022 15:17:16 +0200 Subject: [PATCH 1/4] feat: starting offline mode(waiting test) --- frontend/src/components/pages/details/Details.tsx | 4 +++- .../DetailsReservationWidget.tsx | 10 ++++++---- frontend/src/components/pages/site/OutdoorCourseUI.tsx | 1 + frontend/src/components/pages/site/OutdoorSiteUI.tsx | 1 + .../pages/touristicContent/TouristicContentUI.tsx | 1 + .../pages/touristicEvent/TouristicEventUI.tsx | 1 + 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/pages/details/Details.tsx b/frontend/src/components/pages/details/Details.tsx index d59948b95..c3e0eb6eb 100644 --- a/frontend/src/components/pages/details/Details.tsx +++ b/frontend/src/components/pages/details/Details.tsx @@ -222,6 +222,7 @@ export const DetailsUIWithoutContext: React.FC = ({ detailsId, parentId, )} {getGlobalConfig().enableMeteoWidget && + navigator && navigator.onLine && details.cities_raw && details.cities_raw[0] && ( @@ -426,7 +427,8 @@ export const DetailsUIWithoutContext: React.FC = ({ detailsId, parentId, )} - {details.reservation && details.reservation_id && ( + {details.reservation && details.reservation_id && + navigator && navigator.onLine && ( = routeId: id, }; - const spaClient = ITW.pages.getSinglePageApplicationClient({ layer }); - AllianceReseaux.jQuery(function () { - spaClient.executePage(); - }); + if(ITW){ + const spaClient = ITW.pages.getSinglePageApplicationClient({ layer }); + AllianceReseaux.jQuery(function () { + spaClient.executePage(); + }); + } })(window, (window as any)?.eitinerance?.core); }, []); diff --git a/frontend/src/components/pages/site/OutdoorCourseUI.tsx b/frontend/src/components/pages/site/OutdoorCourseUI.tsx index 1a1d2d9cd..6ae025c85 100644 --- a/frontend/src/components/pages/site/OutdoorCourseUI.tsx +++ b/frontend/src/components/pages/site/OutdoorCourseUI.tsx @@ -281,6 +281,7 @@ export const OutdoorCourseUIWithoutContext: React.FC = ({ outdoorCourseUr )} {getGlobalConfig().enableMeteoWidget && + navigator && navigator.onLine && outdoorCourseContent.cities_raw && outdoorCourseContent.cities_raw[0] && ( diff --git a/frontend/src/components/pages/site/OutdoorSiteUI.tsx b/frontend/src/components/pages/site/OutdoorSiteUI.tsx index c4a81735d..7e7996c46 100644 --- a/frontend/src/components/pages/site/OutdoorSiteUI.tsx +++ b/frontend/src/components/pages/site/OutdoorSiteUI.tsx @@ -317,6 +317,7 @@ const OutdoorSiteUIWithoutContext: React.FC = ({ outdoorSiteUrl, language )} {getGlobalConfig().enableMeteoWidget && + navigator && navigator.onLine && outdoorSiteContent.cities_raw && outdoorSiteContent.cities_raw[0] && ( diff --git a/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx b/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx index b4f5e844d..5eecd5359 100644 --- a/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx +++ b/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx @@ -167,6 +167,7 @@ export const TouristicContentUI: React.FC = ({ )} {getGlobalConfig().enableMeteoWidget && + navigator && navigator.onLine && touristicContent.cities_raw && touristicContent.cities_raw[0] && ( diff --git a/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx b/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx index f66afc176..ba083afd7 100644 --- a/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx +++ b/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx @@ -266,6 +266,7 @@ export const TouristicEventUIWithoutContext: React.FC = ({ )} {getGlobalConfig().enableMeteoWidget && + navigator && navigator.onLine && touristicEventContent.cities_raw && touristicEventContent.cities_raw[0] && ( From e07f0857ba6414508afd04df69b8fef5624d7ae8 Mon Sep 17 00:00:00 2001 From: Julien-Gr4z Date: Mon, 9 May 2022 15:18:15 +0200 Subject: [PATCH 2/4] Revert "feat: starting offline mode(waiting test)" This reverts commit bce53f18438ed63f482c6819b2851f446a03d34c. --- frontend/src/components/pages/details/Details.tsx | 4 +--- .../DetailsReservationWidget.tsx | 10 ++++------ frontend/src/components/pages/site/OutdoorCourseUI.tsx | 1 - frontend/src/components/pages/site/OutdoorSiteUI.tsx | 1 - .../pages/touristicContent/TouristicContentUI.tsx | 1 - .../pages/touristicEvent/TouristicEventUI.tsx | 1 - 6 files changed, 5 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/pages/details/Details.tsx b/frontend/src/components/pages/details/Details.tsx index c3e0eb6eb..d59948b95 100644 --- a/frontend/src/components/pages/details/Details.tsx +++ b/frontend/src/components/pages/details/Details.tsx @@ -222,7 +222,6 @@ export const DetailsUIWithoutContext: React.FC = ({ detailsId, parentId, )} {getGlobalConfig().enableMeteoWidget && - navigator && navigator.onLine && details.cities_raw && details.cities_raw[0] && ( @@ -427,8 +426,7 @@ export const DetailsUIWithoutContext: React.FC = ({ detailsId, parentId, )} - {details.reservation && details.reservation_id && - navigator && navigator.onLine && ( + {details.reservation && details.reservation_id && ( = routeId: id, }; - if(ITW){ - const spaClient = ITW.pages.getSinglePageApplicationClient({ layer }); - AllianceReseaux.jQuery(function () { - spaClient.executePage(); - }); - } + const spaClient = ITW.pages.getSinglePageApplicationClient({ layer }); + AllianceReseaux.jQuery(function () { + spaClient.executePage(); + }); })(window, (window as any)?.eitinerance?.core); }, []); diff --git a/frontend/src/components/pages/site/OutdoorCourseUI.tsx b/frontend/src/components/pages/site/OutdoorCourseUI.tsx index 6ae025c85..1a1d2d9cd 100644 --- a/frontend/src/components/pages/site/OutdoorCourseUI.tsx +++ b/frontend/src/components/pages/site/OutdoorCourseUI.tsx @@ -281,7 +281,6 @@ export const OutdoorCourseUIWithoutContext: React.FC = ({ outdoorCourseUr )} {getGlobalConfig().enableMeteoWidget && - navigator && navigator.onLine && outdoorCourseContent.cities_raw && outdoorCourseContent.cities_raw[0] && ( diff --git a/frontend/src/components/pages/site/OutdoorSiteUI.tsx b/frontend/src/components/pages/site/OutdoorSiteUI.tsx index 7e7996c46..c4a81735d 100644 --- a/frontend/src/components/pages/site/OutdoorSiteUI.tsx +++ b/frontend/src/components/pages/site/OutdoorSiteUI.tsx @@ -317,7 +317,6 @@ const OutdoorSiteUIWithoutContext: React.FC = ({ outdoorSiteUrl, language )} {getGlobalConfig().enableMeteoWidget && - navigator && navigator.onLine && outdoorSiteContent.cities_raw && outdoorSiteContent.cities_raw[0] && ( diff --git a/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx b/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx index 5eecd5359..b4f5e844d 100644 --- a/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx +++ b/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx @@ -167,7 +167,6 @@ export const TouristicContentUI: React.FC = ({ )} {getGlobalConfig().enableMeteoWidget && - navigator && navigator.onLine && touristicContent.cities_raw && touristicContent.cities_raw[0] && ( diff --git a/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx b/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx index ba083afd7..f66afc176 100644 --- a/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx +++ b/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx @@ -266,7 +266,6 @@ export const TouristicEventUIWithoutContext: React.FC = ({ )} {getGlobalConfig().enableMeteoWidget && - navigator && navigator.onLine && touristicEventContent.cities_raw && touristicEventContent.cities_raw[0] && ( From 36f2475568fbfdc857c6e392b3488242f9729bdd Mon Sep 17 00:00:00 2001 From: Julien-Gr4z Date: Mon, 9 May 2022 15:17:16 +0200 Subject: [PATCH 3/4] feat: starting offline mode(waiting test) --- frontend/src/components/pages/details/Details.tsx | 4 +++- .../DetailsReservationWidget.tsx | 10 ++++++---- frontend/src/components/pages/site/OutdoorCourseUI.tsx | 1 + frontend/src/components/pages/site/OutdoorSiteUI.tsx | 1 + .../pages/touristicContent/TouristicContentUI.tsx | 1 + .../pages/touristicEvent/TouristicEventUI.tsx | 1 + 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/pages/details/Details.tsx b/frontend/src/components/pages/details/Details.tsx index d59948b95..c3e0eb6eb 100644 --- a/frontend/src/components/pages/details/Details.tsx +++ b/frontend/src/components/pages/details/Details.tsx @@ -222,6 +222,7 @@ export const DetailsUIWithoutContext: React.FC = ({ detailsId, parentId, )} {getGlobalConfig().enableMeteoWidget && + navigator && navigator.onLine && details.cities_raw && details.cities_raw[0] && ( @@ -426,7 +427,8 @@ export const DetailsUIWithoutContext: React.FC = ({ detailsId, parentId, )} - {details.reservation && details.reservation_id && ( + {details.reservation && details.reservation_id && + navigator && navigator.onLine && ( = routeId: id, }; - const spaClient = ITW.pages.getSinglePageApplicationClient({ layer }); - AllianceReseaux.jQuery(function () { - spaClient.executePage(); - }); + if(ITW){ + const spaClient = ITW.pages.getSinglePageApplicationClient({ layer }); + AllianceReseaux.jQuery(function () { + spaClient.executePage(); + }); + } })(window, (window as any)?.eitinerance?.core); }, []); diff --git a/frontend/src/components/pages/site/OutdoorCourseUI.tsx b/frontend/src/components/pages/site/OutdoorCourseUI.tsx index 1a1d2d9cd..6ae025c85 100644 --- a/frontend/src/components/pages/site/OutdoorCourseUI.tsx +++ b/frontend/src/components/pages/site/OutdoorCourseUI.tsx @@ -281,6 +281,7 @@ export const OutdoorCourseUIWithoutContext: React.FC = ({ outdoorCourseUr )} {getGlobalConfig().enableMeteoWidget && + navigator && navigator.onLine && outdoorCourseContent.cities_raw && outdoorCourseContent.cities_raw[0] && ( diff --git a/frontend/src/components/pages/site/OutdoorSiteUI.tsx b/frontend/src/components/pages/site/OutdoorSiteUI.tsx index c4a81735d..7e7996c46 100644 --- a/frontend/src/components/pages/site/OutdoorSiteUI.tsx +++ b/frontend/src/components/pages/site/OutdoorSiteUI.tsx @@ -317,6 +317,7 @@ const OutdoorSiteUIWithoutContext: React.FC = ({ outdoorSiteUrl, language )} {getGlobalConfig().enableMeteoWidget && + navigator && navigator.onLine && outdoorSiteContent.cities_raw && outdoorSiteContent.cities_raw[0] && ( diff --git a/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx b/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx index b4f5e844d..5eecd5359 100644 --- a/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx +++ b/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx @@ -167,6 +167,7 @@ export const TouristicContentUI: React.FC = ({ )} {getGlobalConfig().enableMeteoWidget && + navigator && navigator.onLine && touristicContent.cities_raw && touristicContent.cities_raw[0] && ( diff --git a/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx b/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx index f66afc176..ba083afd7 100644 --- a/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx +++ b/frontend/src/components/pages/touristicEvent/TouristicEventUI.tsx @@ -266,6 +266,7 @@ export const TouristicEventUIWithoutContext: React.FC = ({ )} {getGlobalConfig().enableMeteoWidget && + navigator && navigator.onLine && touristicEventContent.cities_raw && touristicEventContent.cities_raw[0] && ( From 7b5d3c92895c5eb01fd9a2aeb9588a54ae3d6d3c Mon Sep 17 00:00:00 2001 From: Jordane Minaya Date: Fri, 10 Jun 2022 17:52:45 +0200 Subject: [PATCH 4/4] feat: typeof nav undefined --- .../src/components/pages/details/Details.tsx | 33 ++++++++++--------- .../components/pages/site/OutdoorCourseUI.tsx | 3 +- .../components/pages/site/OutdoorSiteUI.tsx | 3 +- .../touristicContent/TouristicContentUI.tsx | 3 +- .../pages/touristicEvent/TouristicEventUI.tsx | 3 +- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/pages/details/Details.tsx b/frontend/src/components/pages/details/Details.tsx index 97d878e96..03f8d1d8d 100644 --- a/frontend/src/components/pages/details/Details.tsx +++ b/frontend/src/components/pages/details/Details.tsx @@ -235,7 +235,8 @@ export const DetailsUIWithoutContext: React.FC = ({ detailsId, parentId, )} {getGlobalConfig().enableMeteoWidget && - navigator && navigator.onLine && + typeof navigator !== 'undefined' && + navigator.onLine && details.cities_raw && details.cities_raw[0] && ( @@ -434,20 +435,22 @@ export const DetailsUIWithoutContext: React.FC = ({ detailsId, parentId, )} - {details.reservation && details.reservation_id && - navigator && navigator.onLine && ( - - - - )} + {details.reservation && + details.reservation_id && + typeof navigator !== 'undefined' && + navigator.onLine && ( + + + + )}