diff --git a/resources/lang/en.json b/resources/lang/en.json index 9d152ece4..05b3c9101 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -20,6 +20,8 @@ "link_google_failed": "Couldn't start Google linking. Please try again.", "link_google_success": "Google account linked.", "linked_account": "Logged in as {account_name}", + "linked_to_google": "Linked to Google", + "linked_to_google_email": "Linked to Google ({email})", "log_out": "Log Out", "manage_subscription": "Manage", "no_games": "No games played yet.", diff --git a/src/client/AccountModal.ts b/src/client/AccountModal.ts index f5dedcc21..6fa65a669 100644 --- a/src/client/AccountModal.ts +++ b/src/client/AccountModal.ts @@ -258,7 +258,7 @@ export class AccountModal extends BaseModal { if (me?.discord) { return html`
- ${this.renderCurrency()} ${this.renderLinkGoogleButton()} + ${this.renderCurrency()} ${this.renderGoogleLink()} ${this.renderLogoutButton()}
`; @@ -281,7 +281,7 @@ export class AccountModal extends BaseModal { account_name: me.email, })} - ${this.renderCurrency()} ${this.renderLinkGoogleButton()} + ${this.renderCurrency()} ${this.renderGoogleLink()} ${this.renderLogoutButton()} `; @@ -289,6 +289,30 @@ export class AccountModal extends BaseModal { return html``; } + // Show the Google link state: a confirmation line when a Google account is + // already linked, otherwise the button to link one. + private renderGoogleLink(): TemplateResult { + const google = this.userMeResponse?.user?.google; + if (google) { + const label = google.email + ? translateText("account_modal.linked_to_google_email", { + email: google.email, + }) + : translateText("account_modal.linked_to_google"); + return html` +
+ ${translateText("account_modal.google_alt")} + ${label} +
+ `; + } + return this.renderLinkGoogleButton(); + } + // Shown when logged in without a Google identity yet. Lets the user attach // Google to their existing account (we never auto-merge by email). private renderLinkGoogleButton(): TemplateResult { @@ -388,7 +412,7 @@ export class AccountModal extends BaseModal { > Google