Refactor update failed strings to remove nesting
This commit is contained in:
parent
24a22bf191
commit
233a18bc81
3 changed files with 67 additions and 35 deletions
|
@ -1108,10 +1108,18 @@
|
||||||
},
|
},
|
||||||
"icu:cannotUpdateDetail": {
|
"icu:cannotUpdateDetail": {
|
||||||
"messageformat": "Signal couldn't update. {retry} or visit {url} to install it manually. Then, {support} about this problem",
|
"messageformat": "Signal couldn't update. {retry} or visit {url} to install it manually. Then, {support} about this problem",
|
||||||
|
"description": "(Deleted 2024/07/23) Shown if a general error happened while trying to install update package"
|
||||||
|
},
|
||||||
|
"icu:cannotUpdateDetail-v2": {
|
||||||
|
"messageformat": "Signal couldn't update. <retryUpdateButton>Retry update</retryUpdateButton> or visit {url} to install it manually. Then, <contactSupportLink>contact support</contactSupportLink> about this problem",
|
||||||
"description": "Shown if a general error happened while trying to install update package"
|
"description": "Shown if a general error happened while trying to install update package"
|
||||||
},
|
},
|
||||||
"icu:cannotUpdateRequireManualDetail": {
|
"icu:cannotUpdateRequireManualDetail": {
|
||||||
"messageformat": "Signal couldn't update. Visit {url} to install it manually. Then, {support} about this problem",
|
"messageformat": "Signal couldn't update. Visit {url} to install it manually. Then, {support} about this problem",
|
||||||
|
"description": "(Deleted 2024/07/23) Shown if a general error happened while trying to install update package and manual update is required"
|
||||||
|
},
|
||||||
|
"icu:cannotUpdateRequireManualDetail-v2": {
|
||||||
|
"messageformat": "Signal couldn't update. Visit {url} to install it manually. Then, <contactSupportLink>contact support</contactSupportLink> about this problem",
|
||||||
"description": "Shown if a general error happened while trying to install update package and manual update is required"
|
"description": "Shown if a general error happened while trying to install update package and manual update is required"
|
||||||
},
|
},
|
||||||
"icu:readOnlyVolume": {
|
"icu:readOnlyVolume": {
|
||||||
|
@ -2436,7 +2444,8 @@
|
||||||
"messageformat": "Retry update"
|
"messageformat": "Retry update"
|
||||||
},
|
},
|
||||||
"icu:autoUpdateContactSupport": {
|
"icu:autoUpdateContactSupport": {
|
||||||
"messageformat": "contact support"
|
"messageformat": "contact support",
|
||||||
|
"description": "(Deleted 2024/07/23)"
|
||||||
},
|
},
|
||||||
"icu:autoUpdateNewVersionMessage": {
|
"icu:autoUpdateNewVersionMessage": {
|
||||||
"messageformat": "Click to restart Signal"
|
"messageformat": "Click to restart Signal"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Copyright 2020 Signal Messenger, LLC
|
// Copyright 2020 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import React from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
import React, { useCallback } from 'react';
|
||||||
import { isBeta } from '../util/version';
|
import { isBeta } from '../util/version';
|
||||||
import { DialogType } from '../types/Dialogs';
|
import { DialogType } from '../types/Dialogs';
|
||||||
import type { LocalizerType } from '../types/Util';
|
import type { LocalizerType } from '../types/Util';
|
||||||
|
@ -12,6 +12,19 @@ import { LeftPaneDialog } from './LeftPaneDialog';
|
||||||
import type { WidthBreakpoint } from './_util';
|
import type { WidthBreakpoint } from './_util';
|
||||||
import { formatFileSize } from '../util/formatFileSize';
|
import { formatFileSize } from '../util/formatFileSize';
|
||||||
|
|
||||||
|
function contactSupportLink(parts: ReactNode): JSX.Element {
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
key="signal-support"
|
||||||
|
href="https://support.signal.org/hc/en-us/requests/new?desktop"
|
||||||
|
rel="noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{parts}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export type PropsType = {
|
export type PropsType = {
|
||||||
containerWidthBreakpoint: WidthBreakpoint;
|
containerWidthBreakpoint: WidthBreakpoint;
|
||||||
dialogType: DialogType;
|
dialogType: DialogType;
|
||||||
|
@ -37,6 +50,22 @@ export function DialogUpdate({
|
||||||
version,
|
version,
|
||||||
currentVersion,
|
currentVersion,
|
||||||
}: PropsType): JSX.Element | null {
|
}: PropsType): JSX.Element | null {
|
||||||
|
const retryUpdateButton = useCallback(
|
||||||
|
(parts: ReactNode): JSX.Element => {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
className="LeftPaneDialog__retry"
|
||||||
|
key="signal-retry"
|
||||||
|
onClick={startUpdate}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
{parts}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[startUpdate]
|
||||||
|
);
|
||||||
|
|
||||||
if (dialogType === DialogType.Cannot_Update) {
|
if (dialogType === DialogType.Cannot_Update) {
|
||||||
const url = isBeta(currentVersion)
|
const url = isBeta(currentVersion)
|
||||||
? BETA_DOWNLOAD_URL
|
? BETA_DOWNLOAD_URL
|
||||||
|
@ -50,16 +79,7 @@ export function DialogUpdate({
|
||||||
<span>
|
<span>
|
||||||
<I18n
|
<I18n
|
||||||
components={{
|
components={{
|
||||||
retry: (
|
retryUpdateButton,
|
||||||
<button
|
|
||||||
className="LeftPaneDialog__retry"
|
|
||||||
key="signal-retry"
|
|
||||||
onClick={startUpdate}
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
{i18n('icu:autoUpdateRetry')}
|
|
||||||
</button>
|
|
||||||
),
|
|
||||||
url: (
|
url: (
|
||||||
<a
|
<a
|
||||||
key="signal-download"
|
key="signal-download"
|
||||||
|
@ -70,19 +90,10 @@ export function DialogUpdate({
|
||||||
{url}
|
{url}
|
||||||
</a>
|
</a>
|
||||||
),
|
),
|
||||||
support: (
|
contactSupportLink,
|
||||||
<a
|
|
||||||
key="signal-support"
|
|
||||||
href="https://support.signal.org/hc/en-us/requests/new?desktop"
|
|
||||||
rel="noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
{i18n('icu:autoUpdateContactSupport')}
|
|
||||||
</a>
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
id="icu:cannotUpdateDetail"
|
id="icu:cannotUpdateDetail-v2"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</LeftPaneDialog>
|
</LeftPaneDialog>
|
||||||
|
@ -112,19 +123,10 @@ export function DialogUpdate({
|
||||||
{url}
|
{url}
|
||||||
</a>
|
</a>
|
||||||
),
|
),
|
||||||
support: (
|
contactSupportLink,
|
||||||
<a
|
|
||||||
key="signal-support"
|
|
||||||
href="https://support.signal.org/hc/en-us/requests/new?desktop"
|
|
||||||
rel="noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
{i18n('icu:autoUpdateContactSupport')}
|
|
||||||
</a>
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
id="icu:cannotUpdateRequireManualDetail"
|
id="icu:cannotUpdateRequireManualDetail-v2"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</LeftPaneDialog>
|
</LeftPaneDialog>
|
||||||
|
|
|
@ -73,3 +73,24 @@ export function FromContactWithLongNamesBeforeAndAfter(): JSX.Element {
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function WithNickname(): JSX.Element {
|
||||||
|
return (
|
||||||
|
<ProfileChangeNotification
|
||||||
|
i18n={i18n}
|
||||||
|
changedContact={getDefaultConversation({
|
||||||
|
id: 'some-guid',
|
||||||
|
type: 'direct',
|
||||||
|
title: 'Mr. Fire 🔥',
|
||||||
|
nicknameFamilyName: 'test',
|
||||||
|
nicknameGivenName: 'test',
|
||||||
|
})}
|
||||||
|
change={{
|
||||||
|
type: 'name',
|
||||||
|
oldName: 'Mr. Fire 🔥 Old',
|
||||||
|
newName: 'Mr. Fire 🔥 New',
|
||||||
|
}}
|
||||||
|
onOpenEditNicknameAndNoteModal={action('onOpenEditNicknameAndNoteModal')}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue