2023-07-13 19:28:55 +10:00
|
|
|
/* 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 { useAppSelector, useAppDispatch } from 'mastodon/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) => {
|
2023-07-13 19:49:16 +10:00
|
|
|
dispatch(changeSetting(['home', ...key], checked));
|
2023-07-13 19:28:55 +10:00
|
|
|
},
|
2023-07-13 19:49:16 +10:00
|
|
|
[dispatch],
|
2023-07-13 19:28:55 +10:00
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
2024-03-12 02:02:21 +11:00
|
|
|
<div className='column-settings'>
|
|
|
|
<section>
|
|
|
|
<div className='column-settings__row'>
|
|
|
|
<SettingToggle
|
|
|
|
prefix='home_timeline'
|
|
|
|
settings={settings}
|
|
|
|
settingPath={['shows', 'reblog']}
|
|
|
|
onChange={onChange}
|
|
|
|
label={
|
|
|
|
<FormattedMessage
|
|
|
|
id='home.column_settings.show_reblogs'
|
|
|
|
defaultMessage='Show boosts'
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<SettingToggle
|
|
|
|
prefix='home_timeline'
|
|
|
|
settings={settings}
|
|
|
|
settingPath={['shows', 'reply']}
|
|
|
|
onChange={onChange}
|
|
|
|
label={
|
|
|
|
<FormattedMessage
|
|
|
|
id='home.column_settings.show_replies'
|
|
|
|
defaultMessage='Show replies'
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</section>
|
2023-07-13 19:28:55 +10:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|