Update release notes for v5.20.0

This commit is contained in:
Evan Hahn 2021-10-06 16:53:06 -05:00 committed by GitHub
parent 95404f27a0
commit b9acd0238d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 37 deletions

View file

@ -6489,5 +6489,9 @@
"WhatsNew__v5.19--4": { "WhatsNew__v5.19--4": {
"message": "This feature goes out to everyone who reacts with 💅 more than 👍: you can now customize the emojis that appear by default when you want to react to a message.", "message": "This feature goes out to everyone who reacts with 💅 more than 👍: you can now customize the emojis that appear by default when you want to react to a message.",
"description": "Release notes for v5.19" "description": "Release notes for v5.19"
},
"WhatsNew__v5.20": {
"message": "This version contains a number of small tweaks and bug fixes to keep Signal running smoothly.",
"description": "Release notes for v5.20"
} }
} }

View file

@ -1,13 +1,13 @@
// Copyright 2021 Signal Messenger, LLC // Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import React, { useState } from 'react'; import React, { ReactChild, ReactNode, useState } from 'react';
import moment from 'moment'; import moment from 'moment';
import { Modal } from './Modal'; import { Modal } from './Modal';
import { Intl, IntlComponentsType } from './Intl'; import { Intl, IntlComponentsType } from './Intl';
import { Emojify } from './conversation/Emojify'; import { Emojify } from './conversation/Emojify';
import { LocalizerType } from '../types/Util'; import type { LocalizerType, RenderTextCallbackType } from '../types/Util';
export type PropsType = { export type PropsType = {
i18n: LocalizerType; i18n: LocalizerType;
@ -19,6 +19,10 @@ type ReleaseNotesType = {
features: Array<{ key: string; components: IntlComponentsType }>; features: Array<{ key: string; components: IntlComponentsType }>;
}; };
const renderText: RenderTextCallbackType = ({ key, text }) => (
<Emojify key={key} text={text} />
);
export const WhatsNew = ({ i18n }: PropsType): JSX.Element => { export const WhatsNew = ({ i18n }: PropsType): JSX.Element => {
const [releaseNotes, setReleaseNotes] = useState< const [releaseNotes, setReleaseNotes] = useState<
ReleaseNotesType | undefined ReleaseNotesType | undefined
@ -28,18 +32,43 @@ export const WhatsNew = ({ i18n }: PropsType): JSX.Element => {
setReleaseNotes({ setReleaseNotes({
date: new Date(window.getBuildCreation?.() || Date.now()), date: new Date(window.getBuildCreation?.() || Date.now()),
version: window.getVersion(), version: window.getVersion(),
features: [ features: [{ key: 'WhatsNew__v5.20', components: undefined }],
{ key: 'WhatsNew__v5.19--1', components: undefined },
{ key: 'WhatsNew__v5.19--2', components: undefined },
{ key: 'WhatsNew__v5.19--3', components: undefined },
{ key: 'WhatsNew__v5.19--4', components: undefined },
],
}); });
}; };
return ( let modalNode: ReactNode;
<> if (releaseNotes) {
{releaseNotes && ( let contentNode: ReactChild;
if (releaseNotes.features.length === 1) {
const { key, components } = releaseNotes.features[0];
contentNode = (
<p>
<Intl
i18n={i18n}
id={key}
renderText={renderText}
components={components}
/>
</p>
);
} else {
contentNode = (
<ul>
{releaseNotes.features.map(({ key, components }) => (
<li key={key}>
<Intl
i18n={i18n}
id={key}
renderText={renderText}
components={components}
/>
</li>
))}
</ul>
);
}
modalNode = (
<Modal <Modal
hasXButton hasXButton
i18n={i18n} i18n={i18n}
@ -51,23 +80,15 @@ export const WhatsNew = ({ i18n }: PropsType): JSX.Element => {
{moment(releaseNotes.date).format('LL')} &middot;{' '} {moment(releaseNotes.date).format('LL')} &middot;{' '}
{releaseNotes.version} {releaseNotes.version}
</span> </span>
<ul> {contentNode}
{releaseNotes.features.map(({ key, components }) => (
<li key={key}>
<Intl
i18n={i18n}
id={key}
renderText={({ key: innerKey, text }) => (
<Emojify key={innerKey} text={text} />
)}
components={components}
/>
</li>
))}
</ul>
</> </>
</Modal> </Modal>
)} );
}
return (
<>
{modalNode}
<Intl <Intl
i18n={i18n} i18n={i18n}
id="whatsNew" id="whatsNew"