diff --git a/app/javascript/flavours/glitch/features/home_timeline/components/column_settings.jsx b/app/javascript/flavours/glitch/features/home_timeline/components/column_settings.jsx deleted file mode 100644 index 52b3ad0604..0000000000 --- a/app/javascript/flavours/glitch/features/home_timeline/components/column_settings.jsx +++ /dev/null @@ -1,54 +0,0 @@ -import PropTypes from 'prop-types'; -import { PureComponent } from 'react'; - -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; - -import ImmutablePropTypes from 'react-immutable-proptypes'; - -import SettingText from 'flavours/glitch/components/setting_text'; -import SettingToggle from 'flavours/glitch/features/notifications/components/setting_toggle'; - -const messages = defineMessages({ - filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' }, - settings: { id: 'home.settings', defaultMessage: 'Column settings' }, -}); - -class ColumnSettings extends PureComponent { - - static propTypes = { - settings: ImmutablePropTypes.map.isRequired, - onChange: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - }; - - render () { - const { settings, onChange, intl } = this.props; - - return ( -
- - -
- } /> -
- -
- } /> -
- -
- } /> -
- - - -
- -
-
- ); - } - -} - -export default injectIntl(ColumnSettings); diff --git a/app/javascript/flavours/glitch/features/home_timeline/components/column_settings.tsx b/app/javascript/flavours/glitch/features/home_timeline/components/column_settings.tsx new file mode 100644 index 0000000000..7e6f79a7af --- /dev/null +++ b/app/javascript/flavours/glitch/features/home_timeline/components/column_settings.tsx @@ -0,0 +1,104 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call, + @typescript-eslint/no-unsafe-return, + @typescript-eslint/no-unsafe-assignment, + @typescript-eslint/no-unsafe-member-access + -- the settings store is not yet typed */ +import { useCallback } from 'react'; + +import { FormattedMessage } from 'react-intl'; + +import SettingText from 'flavours/glitch/components/setting_text'; +import { useAppSelector, useAppDispatch } from 'flavours/glitch/store'; + +import { changeSetting } from '../../../actions/settings'; +import SettingToggle from '../../notifications/components/setting_toggle'; + +export const ColumnSettings: React.FC = () => { + const settings = useAppSelector((state) => state.settings.get('home')); + + const dispatch = useAppDispatch(); + const onChange = useCallback( + (key: string, checked: boolean) => { + void dispatch(changeSetting(['home', ...key], checked)); + }, + [dispatch], + ); + + return ( +
+ + + + +
+ + } + /> +
+ +
+ + } + /> +
+ +
+ + } + /> +
+ + + + + +
+ + } + /> +
+
+ ); +}; diff --git a/app/javascript/flavours/glitch/features/home_timeline/components/explore_prompt.jsx b/app/javascript/flavours/glitch/features/home_timeline/components/explore_prompt.jsx deleted file mode 100644 index bea883345f..0000000000 --- a/app/javascript/flavours/glitch/features/home_timeline/components/explore_prompt.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; - -import { FormattedMessage } from 'react-intl'; - -import { Link } from 'react-router-dom'; - -import { DismissableBanner } from 'flavours/glitch/components/dismissable_banner'; -import background from 'mastodon/../images/friends-cropped.png'; - - -export const ExplorePrompt = () => ( - - - -

-

- -
-
- - -
-
-
-); diff --git a/app/javascript/flavours/glitch/features/home_timeline/components/explore_prompt.tsx b/app/javascript/flavours/glitch/features/home_timeline/components/explore_prompt.tsx new file mode 100644 index 0000000000..250b2407da --- /dev/null +++ b/app/javascript/flavours/glitch/features/home_timeline/components/explore_prompt.tsx @@ -0,0 +1,46 @@ +import { FormattedMessage } from 'react-intl'; + +import { Link } from 'react-router-dom'; + +import { DismissableBanner } from 'flavours/glitch/components/dismissable_banner'; +import background from 'mastodon/../images/friends-cropped.png'; + +export const ExplorePrompt = () => ( + + + +

+ +

+

+ +

+ +
+
+ + + + + + +
+
+
+); diff --git a/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js deleted file mode 100644 index 215b8c42f0..0000000000 --- a/app/javascript/flavours/glitch/features/home_timeline/containers/column_settings_container.js +++ /dev/null @@ -1,23 +0,0 @@ -import { connect } from 'react-redux'; - -import { changeSetting, saveSettings } from 'flavours/glitch/actions/settings'; - -import ColumnSettings from '../components/column_settings'; - -const mapStateToProps = state => ({ - settings: state.getIn(['settings', 'home']), -}); - -const mapDispatchToProps = dispatch => ({ - - onChange (path, checked) { - dispatch(changeSetting(['home', ...path], checked)); - }, - - onSave () { - dispatch(saveSettings()); - }, - -}); - -export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings); diff --git a/app/javascript/flavours/glitch/features/home_timeline/index.jsx b/app/javascript/flavours/glitch/features/home_timeline/index.jsx index df25e86489..e17680d8bb 100644 --- a/app/javascript/flavours/glitch/features/home_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/home_timeline/index.jsx @@ -22,8 +22,8 @@ import Column from '../../components/column'; import ColumnHeader from '../../components/column_header'; import StatusListContainer from '../ui/containers/status_list_container'; +import { ColumnSettings } from './components/column_settings'; import { ExplorePrompt } from './components/explore_prompt'; -import ColumnSettingsContainer from './containers/column_settings_container'; const messages = defineMessages({ title: { id: 'column.home', defaultMessage: 'Home' }, @@ -192,7 +192,7 @@ class HomeTimeline extends PureComponent { extraButton={announcementsButton} appendContent={hasAnnouncements && showAnnouncements && } > - + {signedIn ? ( diff --git a/app/javascript/mastodon/features/home_timeline/components/column_settings.tsx b/app/javascript/mastodon/features/home_timeline/components/column_settings.tsx index 477e94c9c5..ea20e94223 100644 --- a/app/javascript/mastodon/features/home_timeline/components/column_settings.tsx +++ b/app/javascript/mastodon/features/home_timeline/components/column_settings.tsx @@ -20,7 +20,7 @@ export const ColumnSettings: React.FC = () => { (key: string, checked: boolean) => { void dispatch(changeSetting(['home', ...key], checked)); }, - [dispatch] + [dispatch], ); return (