Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(/welcome): add messages for new intents and results #482

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/pages/welcome.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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' | 'update_budget'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add messages for reconnect and update_budget as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added messages for update_budget intent.
for the reconnect intent we don't need messages as we reuse the grant we have (we do not ask to accept/reject grant), KEY_SUCCESS and KEY_ERROR act as messages for reconnect


const DEFAULT_ERROR_MESSAGE = function (_version: string, intent: Intent) {
if(intent === 'funds') {
Expand All @@ -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.'
},
Expand All @@ -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.'
Expand Down Expand Up @@ -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
Expand Down