From 828f50a4cd3e670f4d99cff4bf3e2d8d14b2c664 Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Thu, 3 Aug 2023 13:52:47 -0700 Subject: [PATCH] refactor: account callback action copy for i18n --- components/UserProfile/CallbackFeedback.vue | 30 ++++++++++++++++++++- store/account.ts | 27 ------------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/components/UserProfile/CallbackFeedback.vue b/components/UserProfile/CallbackFeedback.vue index 2b2d74927..70283c5c1 100644 --- a/components/UserProfile/CallbackFeedback.vue +++ b/components/UserProfile/CallbackFeedback.vue @@ -27,9 +27,9 @@ const promoStore = usePromoStore(); const serverStore = useServerStore(); const { + accountAction, accountActionHide, accountActionStatus, - accountActionStatusCopy, accountActionType, } = storeToRefs(accountStore); const { @@ -47,6 +47,7 @@ const { registered, authAction, refreshServerStateStatus, + username, } = storeToRefs(serverStore); /** @@ -106,6 +107,33 @@ const promoClick = () => { }; const { copy, copied, isSupported } = useClipboard({ source: keyUrl.value }); + +const accountActionStatusCopy = computed((): { text: string; } => { + switch (accountActionStatus.value) { + case 'ready': + return { + text: props.t('Ready to update Connect account configuration'), + }; + case 'updating': + return { + text: accountAction.value?.type === 'signIn' + ? props.t('Signing in {0}...', [accountAction.value.user?.preferred_username]) + : props.t('Signing out {0}...', [username.value]), + }; + case 'success': + return { + text: accountAction.value?.type === 'signIn' + ? props.t('{0} Signed In Successfully', [accountAction.value.user?.preferred_username]) + : props.t('{0} Signed Out Successfully', [username.value]), + }; + case 'failed': + return { + text: accountAction.value?.type === 'signIn' + ? props.t('Sign In Failed') + : props.t('Sign Out Failed'), + }; + } +});