forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve compose form performance, upgrade JS dependencies. LightingBox
now allows to cycle through multiple images
- Loading branch information
Showing
14 changed files
with
1,245 additions
and
707 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
27 changes: 27 additions & 0 deletions
27
app/assets/javascripts/components/features/compose/components/private_toggle.jsx
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,27 @@ | ||
import PureRenderMixin from 'react-addons-pure-render-mixin'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import Toggle from 'react-toggle'; | ||
|
||
const PrivateToggle = React.createClass({ | ||
|
||
propTypes: { | ||
isPrivate: React.PropTypes.bool, | ||
onChange: React.PropTypes.func.isRequired | ||
}, | ||
|
||
mixins: [PureRenderMixin], | ||
|
||
render () { | ||
const { isPrivate, onChange } = this.props; | ||
|
||
return ( | ||
<label className='compose-form__label with-border'> | ||
<Toggle checked={isPrivate} onChange={onChange} /> | ||
<span className='compose-form__label__text'><FormattedMessage id='compose_form.private' defaultMessage='Mark as private' /></span> | ||
</label> | ||
); | ||
} | ||
|
||
}); | ||
|
||
export default PrivateToggle; |
31 changes: 31 additions & 0 deletions
31
app/assets/javascripts/components/features/compose/components/sensitive_toggle.jsx
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,31 @@ | ||
import PureRenderMixin from 'react-addons-pure-render-mixin'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import Toggle from 'react-toggle'; | ||
import Collapsable from '../../../components/collapsable'; | ||
|
||
const SensitiveToggle = React.createClass({ | ||
|
||
propTypes: { | ||
hasMedia: React.PropTypes.bool, | ||
isSensitive: React.PropTypes.bool, | ||
onChange: React.PropTypes.func.isRequired | ||
}, | ||
|
||
mixins: [PureRenderMixin], | ||
|
||
render () { | ||
const { hasMedia, isSensitive, onChange } = this.props; | ||
|
||
return ( | ||
<Collapsable isVisible={hasMedia} fullHeight={39.5}> | ||
<label className='compose-form__label'> | ||
<Toggle checked={isSensitive} onChange={onChange} /> | ||
<span className='compose-form__label__text'><FormattedMessage id='compose_form.sensitive' defaultMessage='Mark media as sensitive' /></span> | ||
</label> | ||
</Collapsable> | ||
); | ||
} | ||
|
||
}); | ||
|
||
export default SensitiveToggle; |
27 changes: 27 additions & 0 deletions
27
app/assets/javascripts/components/features/compose/components/spoiler_toggle.jsx
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,27 @@ | ||
import PureRenderMixin from 'react-addons-pure-render-mixin'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import Toggle from 'react-toggle'; | ||
|
||
const SpoilerToggle = React.createClass({ | ||
|
||
propTypes: { | ||
isSpoiler: React.PropTypes.bool, | ||
onChange: React.PropTypes.func.isRequired | ||
}, | ||
|
||
mixins: [PureRenderMixin], | ||
|
||
render () { | ||
const { isSpoiler, onChange } = this.props; | ||
|
||
return ( | ||
<label className='compose-form__label with-border' style={{ marginTop: '10px' }}> | ||
<Toggle checked={isSpoiler} onChange={onChange} /> | ||
<span className='compose-form__label__text'><FormattedMessage id='compose_form.spoiler' defaultMessage='Hide text behind warning' /></span> | ||
</label> | ||
); | ||
} | ||
|
||
}); | ||
|
||
export default SpoilerToggle; |
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
17 changes: 17 additions & 0 deletions
17
app/assets/javascripts/components/features/compose/containers/private_toggle_container.jsx
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,17 @@ | ||
import { connect } from 'react-redux'; | ||
import PrivateToggle from '../components/private_toggle'; | ||
import { changeComposeVisibility } from '../../../actions/compose'; | ||
|
||
const mapStateToProps = state => ({ | ||
isPrivate: state.getIn(['compose', 'private']) | ||
}); | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
|
||
onChange (e) { | ||
dispatch(changeComposeVisibility(e.target.checked)); | ||
} | ||
|
||
}); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(PrivateToggle); |
18 changes: 18 additions & 0 deletions
18
app/assets/javascripts/components/features/compose/containers/sensitive_toggle_container.jsx
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,18 @@ | ||
import { connect } from 'react-redux'; | ||
import SensitiveToggle from '../components/sensitive_toggle'; | ||
import { changeComposeSensitivity } from '../../../actions/compose'; | ||
|
||
const mapStateToProps = state => ({ | ||
hasMedia: state.getIn(['compose', 'media_attachments']).size > 0, | ||
isSensitive: state.getIn(['compose', 'sensitive']) | ||
}); | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
|
||
onChange (e) { | ||
dispatch(changeComposeSensitivity(e.target.checked)); | ||
} | ||
|
||
}); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(SensitiveToggle); |
17 changes: 17 additions & 0 deletions
17
app/assets/javascripts/components/features/compose/containers/spoiler_toggle_container.jsx
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,17 @@ | ||
import { connect } from 'react-redux'; | ||
import SpoilerToggle from '../components/spoiler_toggle'; | ||
import { changeComposeSpoilerness } from '../../../actions/compose'; | ||
|
||
const mapStateToProps = state => ({ | ||
isSpoiler: state.getIn(['compose', 'spoiler']) | ||
}); | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
|
||
onChange (e) { | ||
dispatch(changeComposeSpoilerness(e.target.checked)); | ||
} | ||
|
||
}); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(SpoilerToggle); |
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
Oops, something went wrong.