glitchier-soc/app/javascript/flavours/glitch/features/local_settings/navigation/index.jsx

96 lines
2.9 KiB
React
Raw Normal View History

2017-07-20 05:54:02 +03:00
// Package imports
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
2017-07-20 05:54:02 +03:00
import { injectIntl, defineMessages } from 'react-intl';
// Our imports
import { preferencesLink } from 'flavours/glitch/utils/backend_links';
2017-07-20 05:54:02 +03:00
import LocalSettingsNavigationItem from './item';
2017-07-20 05:54:02 +03:00
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
const messages = defineMessages({
general: { id: 'settings.general', defaultMessage: 'General' },
compose: { id: 'settings.compose_box_opts', defaultMessage: 'Compose box' },
content_warnings: { id: 'settings.content_warnings', defaultMessage: 'Content Warnings' },
2017-07-20 05:54:02 +03:00
collapsed: { id: 'settings.collapsed_statuses', defaultMessage: 'Collapsed toots' },
media: { id: 'settings.media', defaultMessage: 'Media' },
preferences: { id: 'settings.preferences', defaultMessage: 'Preferences' },
close: { id: 'settings.close', defaultMessage: 'Close' },
});
class LocalSettingsNavigation extends PureComponent {
2017-07-20 05:54:02 +03:00
static propTypes = {
index : PropTypes.number,
intl : PropTypes.object.isRequired,
onClose : PropTypes.func.isRequired,
onNavigate : PropTypes.func.isRequired,
};
render () {
const { index, intl, onClose, onNavigate } = this.props;
return (
<nav className='glitch local-settings__navigation'>
<LocalSettingsNavigationItem
active={index === 0}
index={0}
onNavigate={onNavigate}
icon='cogs'
2017-07-20 05:54:02 +03:00
title={intl.formatMessage(messages.general)}
/>
<LocalSettingsNavigationItem
active={index === 1}
index={1}
onNavigate={onNavigate}
icon='pencil'
title={intl.formatMessage(messages.compose)}
2017-07-20 05:54:02 +03:00
/>
<LocalSettingsNavigationItem
active={index === 2}
index={2}
onNavigate={onNavigate}
textIcon='CW'
title={intl.formatMessage(messages.content_warnings)}
2017-07-20 05:54:02 +03:00
/>
<LocalSettingsNavigationItem
active={index === 3}
index={3}
onNavigate={onNavigate}
icon='angle-double-up'
title={intl.formatMessage(messages.collapsed)}
/>
<LocalSettingsNavigationItem
active={index === 4}
index={4}
onNavigate={onNavigate}
icon='image'
title={intl.formatMessage(messages.media)}
/>
<LocalSettingsNavigationItem
active={index === 5}
href={preferencesLink}
index={5}
icon='cog'
2017-07-20 05:54:02 +03:00
title={intl.formatMessage(messages.preferences)}
/>
<LocalSettingsNavigationItem
active={index === 6}
2017-07-20 05:54:02 +03:00
className='close'
index={6}
2017-07-20 05:54:02 +03:00
onNavigate={onClose}
icon='times'
2017-07-20 05:54:02 +03:00
title={intl.formatMessage(messages.close)}
/>
</nav>
);
}
}
export default injectIntl(LocalSettingsNavigation);