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
58
59
60
|
import { defineMessages, useIntl } from 'react-intl';
import { mdiInformation } from '@mdi/js';
import { MouseEventHandler } from 'react';
import InfoBar from './ui/InfoBar';
import Icon from './ui/icon';
import { onAuthGoToReleaseNotes } from '../helpers/update-helpers';
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',
},
});
export interface IProps {
onInstallUpdate: MouseEventHandler<HTMLButtonElement>;
onHide: () => void;
updateVersionParsed: string;
}
const AppUpdateInfoBar = (props: IProps) => {
const { onInstallUpdate, updateVersionParsed, 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={() => {
window.location.href = onAuthGoToReleaseNotes(
window.location.href,
updateVersionParsed,
);
}}
>
<u>{intl.formatMessage(messages.changelog)}</u>
</button>
</InfoBar>
);
};
export default AppUpdateInfoBar;
|