This repository was archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 969
/
Copy pathbrave.js
66 lines (57 loc) · 2.17 KB
/
brave.js
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
61
62
63
64
65
66
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
const React = require('react')
const Immutable = require('immutable')
const messages = require('../constants/messages')
const SortableTable = require('../components/sortableTable')
const aboutActions = require('./aboutActions')
const ipc = window.chrome.ipcRenderer
require('../../less/about/history.less')
require('../../less/about/brave.less')
require('../../node_modules/font-awesome/css/font-awesome.css')
const tranformVersionInfoToString = (versionInformation) =>
versionInformation
.reduce((coll, entry) => `${coll} \n${entry.get('name')}: ${entry.get('version')}`, '')
class AboutBrave extends React.Component {
constructor () {
super()
this.state = { versionInformation: Immutable.fromJS([]) }
ipc.on(messages.VERSION_INFORMATION_UPDATED, (e, versionInformation) => {
if (this.state.versionInformation.size === 0) {
this.setState({versionInformation: Immutable.fromJS(versionInformation)})
}
})
this.onCopy = this.onCopy.bind(this)
}
onCopy () {
aboutActions.setClipboard(tranformVersionInfoToString(this.state.versionInformation))
}
render () {
return <div className='siteDetailsPage'>
<div className='siteDetailsPageHeader'>
<div data-l10n-id='aboutBrave' className='sectionTitle' />
</div>
<div className='siteDetailsPageContent aboutAbout'>
<div className='title'>
<span className='sectionTitle' data-l10n-id='versionInformation' />
<span className='fa fa-clipboard' title='Copy password to clipboard' onClick={this.onCopy} />
</div>
<SortableTable
headings={['Name', 'Version']}
rows={this.state.versionInformation.map((entry) => [
{
html: entry.get('name'),
value: entry.get('name')
},
{
html: entry.get('version'),
value: entry.get('version')
}
])}
/>
</div>
</div>
}
}
module.exports = <AboutBrave />