Use appropriate icons for toasts (#4803)

* use appropriate icons for toasts

* use info for session expiry

* tweak size

* message -> safeMessage

---------

Co-authored-by: Samuel Newman <10959775+mozzius@users.noreply.github.com>
This commit is contained in:
Samuel Newman
2024-07-23 15:01:04 +01:00
committed by GitHub
parent 59bafb426f
commit 27d712290a
48 changed files with 134 additions and 95 deletions
+7 -6
View File
@@ -77,7 +77,7 @@ export function Component({}: {}) {
const onCopy = React.useCallback(() => {
if (appPassword) {
setStringAsync(appPassword)
Toast.show(_(msg`Copied to clipboard`))
Toast.show(_(msg`Copied to clipboard`), 'clipboard-check')
setWasCopied(true)
}
}, [appPassword, _])
@@ -93,7 +93,7 @@ export function Component({}: {}) {
_(
msg`Please enter a name for your app password. All spaces is not allowed.`,
),
'times',
'xmark',
)
return
}
@@ -101,13 +101,13 @@ export function Component({}: {}) {
if (name.length < 4) {
Toast.show(
_(msg`App Password names must be at least 4 characters long.`),
'times',
'xmark',
)
return
}
if (passwords?.find(p => p.name === name)) {
Toast.show(_(msg`This name is already in use`), 'times')
Toast.show(_(msg`This name is already in use`), 'xmark')
return
}
@@ -116,11 +116,11 @@ export function Component({}: {}) {
if (newPassword) {
setAppPassword(newPassword.password)
} else {
Toast.show(_(msg`Failed to create app password.`), 'times')
Toast.show(_(msg`Failed to create app password.`), 'xmark')
// TODO: better error handling (?)
}
} catch (e) {
Toast.show(_(msg`Failed to create app password.`), 'times')
Toast.show(_(msg`Failed to create app password.`), 'xmark')
logger.error('Failed to create app password', {message: e})
}
}
@@ -137,6 +137,7 @@ export function Component({}: {}) {
_(
msg`App Password names can only contain letters, numbers, spaces, dashes, and underscores.`,
),
'xmark',
)
}
}