From c00b05841e8d89f1a4fe1fc6256d6d2e099771cb Mon Sep 17 00:00:00 2001 From: darian Date: Thu, 28 Nov 2024 00:01:30 +0200 Subject: [PATCH 1/3] add new intent and results welcome page --- src/pages/welcome.astro | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/pages/welcome.astro b/src/pages/welcome.astro index 9c6e7928..a0916191 100644 --- a/src/pages/welcome.astro +++ b/src/pages/welcome.astro @@ -60,9 +60,11 @@ const description = t("site.description"); ERROR = 'grant_error', REJECTED = 'grant_rejected', INVALID = 'grant_invalid', + KEY_SUCCESS = 'key_add_success', + KEY_ERROR = 'key_add_error', } - type Intent = 'connect' | 'funds' + type Intent = 'connect' | 'reconnect' | 'funds' const DEFAULT_ERROR_MESSAGE = function (_version: string, intent: Intent) { if(intent === 'funds') { @@ -80,13 +82,13 @@ const description = t("site.description"); const ERROR_MESSAGES = { continuation_failed(_version: string, intent: Intent): string { if(intent === 'funds') { - return 'An error occured. Please try adding funds again.' + return 'An error occurred. Please try adding funds again.' } return 'An error occurred. Please try reconnecting the wallet.' }, hash_failed(_version: string, intent: Intent): string { if(intent === 'funds') { - return 'An error occured. Please try adding funds again.' + return 'An error occurred. Please try adding funds again.' } return 'An error occurred. Please try reconnecting the wallet.' }, @@ -99,12 +101,18 @@ const description = t("site.description"); } return 'Your wallet is now successfully connected to the extension.' }, + key_add_success(_version: string): string { + return 'Your wallet is now successfully reconnected to the extension.' + }, grant_rejected(_version: string, intent: Intent): string { if(intent === 'funds') { return 'No funds were added.' } return 'Your request was successfully rejected.' }, + key_add_error(_version: string): string { + return 'Something went wrong with your request. Please try reconnecting your wallet.' + }, grant_invalid(_version: string, intent: Intent): string { if(intent === 'funds') { return 'Something went wrong with your request. Please try adding funds again.' @@ -134,11 +142,21 @@ const description = t("site.description"); heroInfo.textContent = CLOSE_TAB_MESSAGE heroHeading.textContent = MESSAGES[SuccessParam.SUCCESS](version, intent) break + case SuccessParam.KEY_SUCCESS: + updateImage('success') + heroInfo.textContent = CLOSE_TAB_MESSAGE + heroHeading.textContent = MESSAGES[SuccessParam.KEY_SUCCESS](version) + break case SuccessParam.REJECTED: updateImage('warning') heroInfo.textContent = CLOSE_TAB_MESSAGE heroHeading.textContent = MESSAGES[SuccessParam.REJECTED](version, intent) break + case SuccessParam.KEY_ERROR: + updateImage('error') + heroInfo.textContent = CLOSE_TAB_MESSAGE + heroHeading.textContent = MESSAGES[SuccessParam.KEY_ERROR](version) + break case SuccessParam.INVALID: updateImage('error') heroInfo.textContent = CLOSE_TAB_MESSAGE From e69ac9751d415ff582c15dba8fd67d4b3901fb45 Mon Sep 17 00:00:00 2001 From: darian Date: Thu, 28 Nov 2024 00:14:41 +0200 Subject: [PATCH 2/3] add missing intent --- src/pages/welcome.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/welcome.astro b/src/pages/welcome.astro index a0916191..1a392c3d 100644 --- a/src/pages/welcome.astro +++ b/src/pages/welcome.astro @@ -64,7 +64,7 @@ const description = t("site.description"); KEY_ERROR = 'key_add_error', } - type Intent = 'connect' | 'reconnect' | 'funds' + type Intent = 'connect' | 'reconnect' | 'funds' | 'update_budget' const DEFAULT_ERROR_MESSAGE = function (_version: string, intent: Intent) { if(intent === 'funds') { From decbdaa6739d519f366243862295f5814ace49fe Mon Sep 17 00:00:00 2001 From: darian Date: Thu, 5 Dec 2024 13:42:38 +0200 Subject: [PATCH 3/3] add update_budget intent messages --- src/pages/welcome.astro | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pages/welcome.astro b/src/pages/welcome.astro index 1a392c3d..dd5a0f5d 100644 --- a/src/pages/welcome.astro +++ b/src/pages/welcome.astro @@ -70,6 +70,9 @@ const description = t("site.description"); if(intent === 'funds') { return 'Something went wrong. Please try adding funds again.' } + if(intent === 'update_budget') { + return 'Something went wrong. Please try updating your budget again.' + } return 'Something went wrong. Please try reconnecting your wallet.' } const CLOSE_TAB_MESSAGE = 'You may safely close this tab.' @@ -84,12 +87,18 @@ const description = t("site.description"); if(intent === 'funds') { return 'An error occurred. Please try adding funds again.' } + if(intent === 'update_budget') { + return 'An error occurred. Please try updating your budget again.' + } return 'An error occurred. Please try reconnecting the wallet.' }, hash_failed(_version: string, intent: Intent): string { if(intent === 'funds') { return 'An error occurred. Please try adding funds again.' } + if(intent === 'update_budget') { + return 'An error occurred. Please try updating your budget again.' + } return 'An error occurred. Please try reconnecting the wallet.' }, } @@ -99,6 +108,9 @@ const description = t("site.description"); if(intent === 'funds') { return 'You have successfully added more funds.' } + if(intent === 'update_budget') { + return 'You have successfully updated your budget.' + } return 'Your wallet is now successfully connected to the extension.' }, key_add_success(_version: string): string { @@ -108,6 +120,9 @@ const description = t("site.description"); if(intent === 'funds') { return 'No funds were added.' } + if(intent === 'update_budget') { + return 'Your budget was not updated.' + } return 'Your request was successfully rejected.' }, key_add_error(_version: string): string { @@ -117,6 +132,9 @@ const description = t("site.description"); if(intent === 'funds') { return 'Something went wrong with your request. Please try adding funds again.' } + if(intent === 'update_budget') { + return 'Something went wrong with your request. Please try updating your budget again.' + } return 'Something went wrong with your request. Please try reconnecting your wallet.' } }