Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show What's New dialog in app via Help -> Go to release notes
- Loading branch information
1 parent
3e38a4b
commit 191bfee
Showing
14 changed files
with
246 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2021 Signal Messenger, LLC | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
import React from 'react'; | ||
|
||
import { Intl } from './Intl'; | ||
|
||
import { LocalizerType } from '../types/Util'; | ||
|
||
export type PropsType = { | ||
i18n: LocalizerType; | ||
showWhatsNewModal: () => unknown; | ||
}; | ||
|
||
export const WhatsNewLink = (props: PropsType): JSX.Element => { | ||
const { i18n, showWhatsNewModal } = props; | ||
|
||
return ( | ||
<Intl | ||
i18n={i18n} | ||
id="whatsNew" | ||
components={[ | ||
<button className="WhatsNew" type="button" onClick={showWhatsNewModal}> | ||
{i18n('viewReleaseNotes')} | ||
</button>, | ||
]} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright 2021 Signal Messenger, LLC | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
import React, { ReactChild } from 'react'; | ||
import moment from 'moment'; | ||
|
||
import { Modal } from './Modal'; | ||
import { Intl, IntlComponentsType } from './Intl'; | ||
import { Emojify } from './conversation/Emojify'; | ||
import type { LocalizerType, RenderTextCallbackType } from '../types/Util'; | ||
|
||
export type PropsType = { | ||
hideWhatsNewModal: () => unknown; | ||
i18n: LocalizerType; | ||
}; | ||
|
||
type ReleaseNotesType = { | ||
date: Date; | ||
version: string; | ||
features: Array<{ key: string; components: IntlComponentsType }>; | ||
}; | ||
|
||
const renderText: RenderTextCallbackType = ({ key, text }) => ( | ||
<Emojify key={key} text={text} /> | ||
); | ||
|
||
const releaseNotes: ReleaseNotesType = { | ||
date: new Date(window.getBuildCreation?.() || Date.now()), | ||
version: window.getVersion(), | ||
features: [ | ||
{ | ||
key: 'WhatsNew__v5.22', | ||
components: undefined, | ||
}, | ||
], | ||
}; | ||
|
||
export const WhatsNewModal = ({ | ||
i18n, | ||
hideWhatsNewModal, | ||
}: PropsType): JSX.Element => { | ||
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> | ||
); | ||
} | ||
|
||
return ( | ||
<Modal | ||
hasXButton | ||
i18n={i18n} | ||
onClose={hideWhatsNewModal} | ||
title={i18n('WhatsNew__modal-title')} | ||
> | ||
<> | ||
<span> | ||
{moment(releaseNotes.date).format('LL')} ·{' '} | ||
{releaseNotes.version} | ||
</span> | ||
{contentNode} | ||
</> | ||
</Modal> | ||
); | ||
}; |
Oops, something went wrong.