Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Converts ReleaseNotes into redux component #9496

Merged
merged 1 commit into from
Jun 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions app/renderer/components/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class Main extends ImmutableComponent {
this.onHideClearBrowsingDataPanel = this.onHideClearBrowsingDataPanel.bind(this)
this.onHideAutofillAddressPanel = this.onHideAutofillAddressPanel.bind(this)
this.onHideAutofillCreditCardPanel = this.onHideAutofillCreditCardPanel.bind(this)
this.onHideReleaseNotes = this.onHideReleaseNotes.bind(this)
this.onTabContextMenu = this.onTabContextMenu.bind(this)
this.checkForTitleMode = debounce(this.checkForTitleMode.bind(this), 20)
this.resetAltMenuProcessing()
Expand Down Expand Up @@ -544,10 +543,6 @@ class Main extends ImmutableComponent {
windowActions.setAutofillCreditCardDetail()
}

onHideReleaseNotes () {
windowActions.setReleaseNotesVisible(false)
}

onMouseDown (e) {
// TODO(bsclifton): update this to use eventUtil.eventElHasAncestorWithClasses
let node = e.target
Expand Down Expand Up @@ -744,9 +739,7 @@ class Main extends ImmutableComponent {
}
{
releaseNotesIsVisible
? <ReleaseNotes
metadata={this.props.appState.getIn(['updates', 'metadata'])}
onHide={this.onHideReleaseNotes} />
? <ReleaseNotes />
: null
}
{
Expand Down
40 changes: 32 additions & 8 deletions app/renderer/components/main/releaseNotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,59 @@

const React = require('react')
const {StyleSheet, css} = require('aphrodite')
const Immutable = require('immutable')

// Components
const ImmutableComponent = require('../immutableComponent')
const ReduxComponent = require('../reduxComponent')
const Dialog = require('../common/dialog')

// Actions
const windowActions = require('../../../../js/actions/windowActions')

// Styles
const commonStyles = require('../styles/commonStyles')

class ReleaseNotes extends ImmutableComponent {
class ReleaseNotes extends React.Component {
constructor (props) {
super(props)
this.onClick = this.onClick.bind(this)
}

onClick (e) {
e.stopPropagation()
}

onHide () {
windowActions.setReleaseNotesVisible(false)
}

mergeProps (state, ownProps) {
const metadata = state.getIn(['updates', 'metadata'], Immutable.Map())

const props = {}
props.name = metadata.get('name')
props.notes = metadata.get('notes')

return props
}

render () {
const className = css(
commonStyles.flyoutDialog,
styles.releaseNotes
)

return <Dialog onHide={this.props.onHide} isClickDismiss>
<div className={className} onClick={this.onClick.bind(this)}>
<h1 className={css(styles.header)}>{this.props.metadata.get('name')}</h1>
<div>{this.props.metadata.get('notes')}</div>
return <Dialog onHide={this.onHide} isClickDismiss>
<div className={className} onClick={this.onClick}>
<h1 className={css(styles.header)}>{this.props.name}</h1>
<div>{this.props.notes}</div>
</div>
</Dialog>
}
}

module.exports = ReduxComponent.connect(ReleaseNotes)

const styles = StyleSheet.create({
releaseNotes: {
width: 'auto',
Expand All @@ -42,5 +68,3 @@ const styles = StyleSheet.create({
marginBottom: '10px'
}
})

module.exports = ReleaseNotes