From 3434b626746a1661b1d283178f3dcf1f58e73346 Mon Sep 17 00:00:00 2001 From: Beatriz Rizental Date: Fri, 17 Nov 2023 19:09:01 +0100 Subject: [PATCH] Show error message and troubleshooting steps on contextual identitier error --- src/css/popup.css | 15 + src/js/popup.js | 9 +- src/popup.html | 851 +++++++++++++++++++++++----------------------- 3 files changed, 452 insertions(+), 423 deletions(-) diff --git a/src/css/popup.css b/src/css/popup.css index 5980894..982017b 100644 --- a/src/css/popup.css +++ b/src/css/popup.css @@ -2395,3 +2395,18 @@ tr:hover > td > .trash-button { .searchbar input { inline-size: 100%; } + +/* ----- Error ---------- */ + +#on-error { + margin-block: auto; +} + +#on-error h2 { + font-weight: bold; +} + +#on-error h2, +#on-error p { + text-align: center; +} diff --git a/src/js/popup.js b/src/js/popup.js index ec53006..8c8ee35 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -74,12 +74,19 @@ const Logic = { // Retrieve the list of identities. const identitiesPromise = this.refreshIdentities(); + const errorBlock = document.getElementById("on-error"); + const successBlock = document.getElementById("on-success"); try { await identitiesPromise; } catch (e) { - throw new Error("Failed to retrieve the identities or variation. We cannot continue. ", e.message); + errorBlock.style.display = "block"; + successBlock.style.display = "none"; + return; } + errorBlock.style.display = "none"; + successBlock.style.display = "block"; + // Routing to the correct panel. // If localStorage is disabled, we don't show the onboarding. const onboardingData = await browser.storage.local.get([ONBOARDING_STORAGE_KEY]); diff --git a/src/popup.html b/src/popup.html index fac21fe..0f10d4a 100644 --- a/src/popup.html +++ b/src/popup.html @@ -6,462 +6,469 @@ -
- -

-

- +
+

+

-
- -

-

- -
- -
- -

-

- -
- -
- -

-

- -
- -
- -

-

- -
- -
- -

-

-
- - +
+
+ +

+

+
-
-
- -

-

-
- - +
+ +

+

+
-
-
-
- -

-

+
+ +

+

+
-
- + +
+ +

+

+
-
-
- -
+ +
+ +

+

+ +
+ +
+ +

+

- - + +
-
-
- -

-

-

- - -
- -