1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
import { defineMessages, useIntl } from 'react-intl';
import { mdiInformation } from '@mdi/js';
import InfoBar from './ui/InfoBar';
import { GITHUB_FERDIUM_URL } from '../config';
import { openExternalUrl } from '../helpers/url-helpers';
import Icon from './ui/icon';
const messages = defineMessages({
updateAvailable: {
id: 'infobar.updateAvailable',
defaultMessage: 'A new update for Ferdium is available.',
},
changelog: {
id: 'infobar.buttonChangelog',
defaultMessage: 'What is new?',
},
buttonInstallUpdate: {
id: 'infobar.buttonInstallUpdate',
defaultMessage: 'Restart & install update',
},
});
type Props = {
onInstallUpdate: () => void;
onHide: () => void;
};
const AppUpdateInfoBar = ({ onInstallUpdate, onHide }: Props) => {
const intl = useIntl();
return (
<InfoBar
type="primary"
ctaLabel={intl.formatMessage(messages.buttonInstallUpdate)}
onClick={onInstallUpdate}
onHide={onHide}
>
<Icon icon={mdiInformation} />
{intl.formatMessage(messages.updateAvailable)}{' '}
<button
className="info-bar__inline-button"
type="button"
onClick={() =>
openExternalUrl(
`${GITHUB_FERDIUM_URL}/ferdium-app/blob/develop/CHANGELOG.md`,
true,
)
}
>
<u>{intl.formatMessage(messages.changelog)}</u>
</button>
</InfoBar>
);
};
export default AppUpdateInfoBar;
|