2021-08-19 22:56:29 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React, { useState } from 'react';
|
|
|
|
import moment from 'moment';
|
|
|
|
|
|
|
|
import { Modal } from './Modal';
|
|
|
|
import { Intl } from './Intl';
|
2021-08-26 20:41:43 +00:00
|
|
|
import { Emojify } from './conversation/Emojify';
|
2021-08-19 22:56:29 +00:00
|
|
|
import { LocalizerType } from '../types/Util';
|
|
|
|
|
|
|
|
export type PropsType = {
|
|
|
|
i18n: LocalizerType;
|
|
|
|
};
|
|
|
|
|
|
|
|
type ReleaseNotesType = {
|
|
|
|
date: Date;
|
|
|
|
version: string;
|
|
|
|
features: Array<string>;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const WhatsNew = ({ i18n }: PropsType): JSX.Element => {
|
|
|
|
const [releaseNotes, setReleaseNotes] = useState<
|
|
|
|
ReleaseNotesType | undefined
|
|
|
|
>();
|
|
|
|
|
|
|
|
const viewReleaseNotes = () => {
|
|
|
|
setReleaseNotes({
|
2021-09-03 00:39:20 +00:00
|
|
|
date: new Date('09/02/2021'),
|
2021-08-19 22:56:29 +00:00
|
|
|
version: window.getVersion(),
|
2021-09-03 00:39:20 +00:00
|
|
|
features: ['WhatsNew__v5.17--1', 'WhatsNew__v5.17--2'],
|
2021-08-19 22:56:29 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{releaseNotes && (
|
|
|
|
<Modal
|
|
|
|
hasXButton
|
|
|
|
i18n={i18n}
|
|
|
|
onClose={() => setReleaseNotes(undefined)}
|
|
|
|
title={i18n('WhatsNew__modal-title')}
|
|
|
|
>
|
|
|
|
<>
|
|
|
|
<span>
|
|
|
|
{moment(releaseNotes.date).format('LL')} ·{' '}
|
|
|
|
{releaseNotes.version}
|
|
|
|
</span>
|
|
|
|
<ul>
|
|
|
|
{releaseNotes.features.map(featureKey => (
|
|
|
|
<li key={featureKey}>
|
2021-08-26 20:41:43 +00:00
|
|
|
<Intl
|
|
|
|
i18n={i18n}
|
|
|
|
id={featureKey}
|
|
|
|
renderText={({ key, text }) => (
|
|
|
|
<Emojify key={key} text={text} />
|
|
|
|
)}
|
|
|
|
/>
|
2021-08-19 22:56:29 +00:00
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</>
|
|
|
|
</Modal>
|
|
|
|
)}
|
|
|
|
<Intl
|
|
|
|
i18n={i18n}
|
|
|
|
id="whatsNew"
|
|
|
|
components={[
|
|
|
|
<button className="WhatsNew" type="button" onClick={viewReleaseNotes}>
|
|
|
|
{i18n('viewReleaseNotes')}
|
|
|
|
</button>,
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|