about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/home_timeline
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-05-12 21:44:10 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-12 14:44:10 +0200
commit2991a7cfe685ca9b42230b7030b9e7d0ece94c88 (patch)
tree72da0f02bc6279aeab1e641fb7d51527efcb9066 /app/javascript/mastodon/features/home_timeline
parent44a3584e2d54488393e6f50e482ed61d2765e312 (diff)
Use ES Class Fields & Static Properties (#3008)
Use ES Class Fields & Static Properties (currently stage 2) for improve class outlook.

Added babel-plugin-transform-class-properties as a Babel plugin.
Diffstat (limited to 'app/javascript/mastodon/features/home_timeline')
-rw-r--r--app/javascript/mastodon/features/home_timeline/components/column_settings.js14
-rw-r--r--app/javascript/mastodon/features/home_timeline/components/setting_text.js21
-rw-r--r--app/javascript/mastodon/features/home_timeline/index.js12
3 files changed, 21 insertions, 26 deletions
diff --git a/app/javascript/mastodon/features/home_timeline/components/column_settings.js b/app/javascript/mastodon/features/home_timeline/components/column_settings.js
index 460221fc3..96cade870 100644
--- a/app/javascript/mastodon/features/home_timeline/components/column_settings.js
+++ b/app/javascript/mastodon/features/home_timeline/components/column_settings.js
@@ -13,6 +13,13 @@ const messages = defineMessages({
 
 class ColumnSettings extends React.PureComponent {
 
+  static propTypes = {
+    settings: ImmutablePropTypes.map.isRequired,
+    onChange: PropTypes.func.isRequired,
+    onSave: PropTypes.func.isRequired,
+    intl: PropTypes.object.isRequired
+  };
+
   render () {
     const { settings, onChange, onSave, intl } = this.props;
 
@@ -41,11 +48,4 @@ class ColumnSettings extends React.PureComponent {
 
 }
 
-ColumnSettings.propTypes = {
-  settings: ImmutablePropTypes.map.isRequired,
-  onChange: PropTypes.func.isRequired,
-  onSave: PropTypes.func.isRequired,
-  intl: PropTypes.object.isRequired
-}
-
 export default injectIntl(ColumnSettings);
diff --git a/app/javascript/mastodon/features/home_timeline/components/setting_text.js b/app/javascript/mastodon/features/home_timeline/components/setting_text.js
index dfa2939b7..a872ae76f 100644
--- a/app/javascript/mastodon/features/home_timeline/components/setting_text.js
+++ b/app/javascript/mastodon/features/home_timeline/components/setting_text.js
@@ -4,12 +4,14 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
 
 class SettingText extends React.PureComponent {
 
-  constructor (props, context) {
-    super(props, context);
-    this.handleChange = this.handleChange.bind(this);
-  }
-
-  handleChange (e) {
+  static propTypes = {
+    settings: ImmutablePropTypes.map.isRequired,
+    settingKey: PropTypes.array.isRequired,
+    label: PropTypes.string.isRequired,
+    onChange: PropTypes.func.isRequired
+  };
+
+  handleChange = (e) => {
     this.props.onChange(this.props.settingKey, e.target.value)
   }
 
@@ -28,11 +30,4 @@ class SettingText extends React.PureComponent {
 
 }
 
-SettingText.propTypes = {
-  settings: ImmutablePropTypes.map.isRequired,
-  settingKey: PropTypes.array.isRequired,
-  label: PropTypes.string.isRequired,
-  onChange: PropTypes.func.isRequired
-};
-
 export default SettingText;
diff --git a/app/javascript/mastodon/features/home_timeline/index.js b/app/javascript/mastodon/features/home_timeline/index.js
index d6bfef8cd..2cb6c5c84 100644
--- a/app/javascript/mastodon/features/home_timeline/index.js
+++ b/app/javascript/mastodon/features/home_timeline/index.js
@@ -18,6 +18,12 @@ const mapStateToProps = state => ({
 
 class HomeTimeline extends React.PureComponent {
 
+  static propTypes = {
+    intl: PropTypes.object.isRequired,
+    hasUnread: PropTypes.bool,
+    hasFollows: PropTypes.bool
+  };
+
   render () {
     const { intl, hasUnread, hasFollows } = this.props;
 
@@ -45,10 +51,4 @@ class HomeTimeline extends React.PureComponent {
 
 }
 
-HomeTimeline.propTypes = {
-  intl: PropTypes.object.isRequired,
-  hasUnread: PropTypes.bool,
-  hasFollows: PropTypes.bool
-};
-
 export default connect(mapStateToProps)(injectIntl(HomeTimeline));