Skip to content

Commit

Permalink
fix(app): translate close button text for ODD toasts (#17459)
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 authored Feb 7, 2025
1 parent f0ec5e5 commit d16cbaf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/src/App/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function useSoftwareUpdatePoll(): void {

export function useProtocolReceiptToast(): void {
const host = useHost()
const { t } = useTranslation('protocol_info')
const { t, i18n } = useTranslation(['protocol_info', 'shared'])
const { makeToast } = useToaster()
const queryClient = useQueryClient()
const protocolIdsQuery = useAllProtocolIdsQuery(
Expand Down Expand Up @@ -83,7 +83,7 @@ export function useProtocolReceiptToast(): void {
}) as string,
'success',
{
closeButton: true,
buttonText: i18n.format(t('shared:close'), 'capitalize'),
disableTimeout: true,
displayType: 'odd',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function useRecoveryToasts({
...rest
}: BuildToast): RecoveryToasts {
const { currentStepNumber, hasRunDiverged } = stepCounts
const { i18n, t } = useTranslation('shared')
const { makeToast } = useToaster()
const displayType = isOnDevice ? 'odd' : 'desktop'

Expand All @@ -53,6 +54,10 @@ export function useRecoveryToasts({
const makeSuccessToast = (): void => {
if (selectedRecoveryOption !== RECOVERY_MAP.CANCEL_RUN.ROUTE) {
makeToast(bodyText, 'success', {
buttonText:
displayType === 'odd'
? i18n.format(t('shared:close'), 'capitalize')
: undefined,
closeButton: true,
disableTimeout: true,
displayType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function SelectDestWells(props: SelectDestWellsProps): JSX.Element {
}) as string,
'error',
{
closeButton: true,
buttonText: i18n.format(t('shared:close'), 'capitalize'),
disableTimeout: true,
displayType: 'odd',
linkText: t('learn_more'),
Expand Down

0 comments on commit d16cbaf

Please sign in to comment.