From 92857101cdfe246b6e7564b74820d60699603eba Mon Sep 17 00:00:00 2001 From: Ryan Miller Date: Fri, 30 Aug 2024 11:26:59 +1000 Subject: [PATCH] fix: password modal strings --- .../dialog/SessionSetPasswordDialog.tsx | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/ts/components/dialog/SessionSetPasswordDialog.tsx b/ts/components/dialog/SessionSetPasswordDialog.tsx index f43c89635..bc5e00839 100644 --- a/ts/components/dialog/SessionSetPasswordDialog.tsx +++ b/ts/components/dialog/SessionSetPasswordDialog.tsx @@ -5,7 +5,6 @@ import { isEmpty } from 'lodash'; import { Component } from 'react'; import { ToastUtils } from '../../session/utils'; import { sessionPassword } from '../../state/ducks/modalDialog'; -import { LocalizerToken } from '../../types/Localizer'; import type { PasswordAction } from '../../types/ReduxTypes'; import { assertUnreachable } from '../../types/sqlSharedTypes'; import { matchesHash, validatePassword } from '../../util/passwordUtils'; @@ -67,7 +66,7 @@ export class SessionSetPasswordDialog extends Component { ]; break; case 'remove': - placeholders = [window.i18n('passwordCreate')]; + placeholders = [window.i18n('passwordRemove')]; break; case 'enter': placeholders = [window.i18n('passwordCreate')]; @@ -78,18 +77,22 @@ export class SessionSetPasswordDialog extends Component { const confirmButtonText = passwordAction === 'remove' ? window.i18n('remove') : window.i18n('done'); - // do this separately so typescript's compiler likes it - const localizedKeyAction: LocalizerToken = - passwordAction === 'change' - ? 'passwordChange' - : passwordAction === 'remove' - ? 'passwordRemove' - : passwordAction === 'enter' - ? 'passwordEnter' - : 'passwordSet'; + + const titleString = () => { + switch (passwordAction) { + case 'change': + return window.i18n('passwordChange'); + case 'remove': + return window.i18n('passwordRemove'); + case 'enter': + return window.i18n('passwordEnter'); + default: + return window.i18n('passwordSet'); + } + }; return ( - +