You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
176 lines
6.9 KiB
176 lines
6.9 KiB
7 years ago
|
// Package imports
|
||
8 years ago
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||
7 years ago
|
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
|
||
7 years ago
|
|
||
7 years ago
|
// Our imports
|
||
7 years ago
|
import LocalSettingsPageItem from './item';
|
||
8 years ago
|
|
||
7 years ago
|
// Stylesheet imports
|
||
|
import './style';
|
||
|
|
||
7 years ago
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||
|
|
||
8 years ago
|
const messages = defineMessages({
|
||
|
layout_auto: { id: 'layout.auto', defaultMessage: 'Auto' },
|
||
|
layout_desktop: { id: 'layout.desktop', defaultMessage: 'Desktop' },
|
||
|
layout_mobile: { id: 'layout.single', defaultMessage: 'Mobile' },
|
||
|
});
|
||
|
|
||
|
@injectIntl
|
||
7 years ago
|
export default class LocalSettingsPage extends React.PureComponent {
|
||
8 years ago
|
|
||
|
static propTypes = {
|
||
7 years ago
|
index : PropTypes.number,
|
||
|
intl : PropTypes.object.isRequired,
|
||
|
onChange : PropTypes.func.isRequired,
|
||
|
settings : ImmutablePropTypes.map.isRequired,
|
||
8 years ago
|
};
|
||
|
|
||
7 years ago
|
pages = [
|
||
|
({ intl, onChange, settings }) => (
|
||
|
<div className='glitch local-settings__page general'>
|
||
8 years ago
|
<h1><FormattedMessage id='settings.general' defaultMessage='General' /></h1>
|
||
7 years ago
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['layout']}
|
||
|
id='mastodon-settings--layout'
|
||
|
options={[
|
||
7 years ago
|
{ value: 'auto', message: intl.formatMessage(messages.layout_auto) },
|
||
|
{ value: 'multiple', message: intl.formatMessage(messages.layout_desktop) },
|
||
|
{ value: 'single', message: intl.formatMessage(messages.layout_mobile) },
|
||
8 years ago
|
]}
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
>
|
||
|
<FormattedMessage id='settings.layout' defaultMessage='Layout:' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['stretch']}
|
||
|
id='mastodon-settings--stretch'
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
>
|
||
|
<FormattedMessage id='settings.wide_view' defaultMessage='Wide view (Desktop mode only)' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
8 years ago
|
</div>
|
||
7 years ago
|
),
|
||
|
({ onChange, settings }) => (
|
||
|
<div className='glitch local-settings__page collapsed'>
|
||
8 years ago
|
<h1><FormattedMessage id='settings.collapsed_statuses' defaultMessage='Collapsed toots' /></h1>
|
||
7 years ago
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['collapsed', 'enabled']}
|
||
|
id='mastodon-settings--collapsed-enabled'
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
>
|
||
|
<FormattedMessage id='settings.enable_collapsed' defaultMessage='Enable collapsed toots' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
8 years ago
|
<section>
|
||
|
<h2><FormattedMessage id='settings.auto_collapse' defaultMessage='Automatic collapsing' /></h2>
|
||
7 years ago
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['collapsed', 'auto', 'all']}
|
||
|
id='mastodon-settings--collapsed-auto-all'
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
dependsOn={[['collapsed', 'enabled']]}
|
||
|
>
|
||
|
<FormattedMessage id='settings.auto_collapse_all' defaultMessage='Everything' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['collapsed', 'auto', 'notifications']}
|
||
|
id='mastodon-settings--collapsed-auto-notifications'
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
dependsOn={[['collapsed', 'enabled']]}
|
||
|
dependsOnNot={[['collapsed', 'auto', 'all']]}
|
||
|
>
|
||
|
<FormattedMessage id='settings.auto_collapse_notifications' defaultMessage='Notifications' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['collapsed', 'auto', 'lengthy']}
|
||
|
id='mastodon-settings--collapsed-auto-lengthy'
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
dependsOn={[['collapsed', 'enabled']]}
|
||
|
dependsOnNot={[['collapsed', 'auto', 'all']]}
|
||
|
>
|
||
|
<FormattedMessage id='settings.auto_collapse_lengthy' defaultMessage='Lengthy toots' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['collapsed', 'auto', 'replies']}
|
||
|
id='mastodon-settings--collapsed-auto-replies'
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
dependsOn={[['collapsed', 'enabled']]}
|
||
|
dependsOnNot={[['collapsed', 'auto', 'all']]}
|
||
|
>
|
||
|
<FormattedMessage id='settings.auto_collapse_replies' defaultMessage='Replies' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['collapsed', 'auto', 'media']}
|
||
|
id='mastodon-settings--collapsed-auto-media'
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
dependsOn={[['collapsed', 'enabled']]}
|
||
|
dependsOnNot={[['collapsed', 'auto', 'all']]}
|
||
|
>
|
||
|
<FormattedMessage id='settings.auto_collapse_media' defaultMessage='Toots with media' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
8 years ago
|
</section>
|
||
|
<section>
|
||
|
<h2><FormattedMessage id='settings.image_backgrounds' defaultMessage='Image backgrounds' /></h2>
|
||
7 years ago
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['collapsed', 'backgrounds', 'user_backgrounds']}
|
||
|
id='mastodon-settings--collapsed-user-backgrouns'
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
dependsOn={[['collapsed', 'enabled']]}
|
||
|
>
|
||
|
<FormattedMessage id='settings.image_backgrounds_users' defaultMessage='Give collapsed toots an image background' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['collapsed', 'backgrounds', 'preview_images']}
|
||
|
id='mastodon-settings--collapsed-preview-images'
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
dependsOn={[['collapsed', 'enabled']]}
|
||
|
>
|
||
|
<FormattedMessage id='settings.image_backgrounds_media' defaultMessage='Preview collapsed toot media' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
8 years ago
|
</section>
|
||
|
</div>
|
||
7 years ago
|
),
|
||
|
({ onChange, settings }) => (
|
||
|
<div className='glitch local-settings__page media'>
|
||
8 years ago
|
<h1><FormattedMessage id='settings.media' defaultMessage='Media' /></h1>
|
||
7 years ago
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
8 years ago
|
item={['media', 'letterbox']}
|
||
|
id='mastodon-settings--media-letterbox'
|
||
7 years ago
|
onChange={onChange}
|
||
8 years ago
|
>
|
||
|
<FormattedMessage id='settings.media_letterbox' defaultMessage='Letterbox media' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
|
<LocalSettingsPageItem
|
||
|
settings={settings}
|
||
7 years ago
|
item={['media', 'fullwidth']}
|
||
|
id='mastodon-settings--media-fullwidth'
|
||
7 years ago
|
onChange={onChange}
|
||
7 years ago
|
>
|
||
|
<FormattedMessage id='settings.media_fullwidth' defaultMessage='Full-width media previews' />
|
||
7 years ago
|
</LocalSettingsPageItem>
|
||
8 years ago
|
</div>
|
||
7 years ago
|
),
|
||
|
];
|
||
8 years ago
|
|
||
|
render () {
|
||
7 years ago
|
const { pages } = this;
|
||
|
const { index, intl, onChange, settings } = this.props;
|
||
|
const CurrentPage = pages[index] || pages[0];
|
||
8 years ago
|
|
||
7 years ago
|
return <CurrentPage intl={intl} onChange={onChange} settings={settings} />;
|
||
8 years ago
|
}
|
||
|
|
||
|
}
|