chore: cross domain banner between APP_HOST_LEGACY and APP_HOST

This commit is contained in:
Colin Darie 2024-02-23 14:05:12 +01:00
parent 61a9bedfff
commit 4dd24f0925
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
10 changed files with 137 additions and 11 deletions

View file

@ -0,0 +1,5 @@
---
en:
message_new_domain: "demarches-simplifiees.fr is now called"
follow_link: Follow this link to connect to the new address.
detected_error: We have detected a network error in your access. Contact your IT department to authorize connection to demarches.gouv.fr.

View file

@ -0,0 +1,5 @@
---
fr:
message_new_domain: "demarches-simplifiees.fr sappelle maintenant"
follow_link: Suivez ce lien pour vous connecter à la nouvelle adresse.
detected_error: Nous avons détecté une erreur réseau pour vous y accéder. Contactez votre service informatique pour autoriser la connexion sur demarches.gouv.fr.

View file

@ -0,0 +1,19 @@
- if auto_switch?
:javascript
const hintUrl = "http://#{ApplicationHelper::APP_HOST}/favicon.ico"
fetch(hintUrl, { mode: 'cors' }).then(() => {
window.location = '#{new_host_url}';
}).catch((e) => {
// TODO: notify us in order to monitor connectivity issues volume
})
= render Dsfr::NoticeComponent.new(closable: true) do |c|
- c.with_title do
= t(".message_new_domain")
= "#{helpers.link_to APPLICATION_NAME, new_host_url}."
- if manual_switch?
= t(".follow_link")
- elsif auto_switch? || true
= t(".detected_error")