From 37ced4c90394184fcbc476180ad624b1a18e3540 Mon Sep 17 00:00:00 2001 From: cwm Date: Tue, 12 Dec 2017 00:01:17 -0600 Subject: add components to getting started column --- .../glitch/features/getting_started/index.js | 45 +++++++++++++--------- 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'app/javascript/flavours/glitch/features/getting_started') diff --git a/app/javascript/flavours/glitch/features/getting_started/index.js b/app/javascript/flavours/glitch/features/getting_started/index.js index 47142fdd1..1ca0a0b76 100644 --- a/app/javascript/flavours/glitch/features/getting_started/index.js +++ b/app/javascript/flavours/glitch/features/getting_started/index.js @@ -9,6 +9,8 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { me } from 'flavours/glitch/util/initial_state'; +import { createSelector } from 'reselect'; +import { fetchLists } from 'flavours/glitch/actions/lists'; const messages = defineMessages({ heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' }, @@ -23,19 +25,25 @@ const messages = defineMessages({ settings: { id: 'navigation_bar.app_settings', defaultMessage: 'App settings' }, follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' }, sign_out: { id: 'navigation_bar.logout', defaultMessage: 'Logout' }, - favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' }, - blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' }, - mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' }, - info: { id: 'navigation_bar.info', defaultMessage: 'Extended information' }, - show_me_around: { id: 'getting_started.onboarding', defaultMessage: 'Show me around' }, - pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned toots' }, lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' }, keyboard_shortcuts: { id: 'navigation_bar.keyboard_shortcuts', defaultMessage: 'Keyboard shortcuts' }, + lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' }, + lists_subheading: { id: 'column_subheading.lists', defaultMessage: 'Lists' }, + misc: { id: 'navigation_bar.misc', defaultMessage: 'Misc' }, +}); + +const getOrderedLists = createSelector([state => state.get('lists')], lists => { + if (!lists) { + return lists; +} + + return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title'))); }); const mapStateToProps = state => ({ myAccount: state.getIn(['accounts', me]), columns: state.getIn(['settings', 'columns']), + lists: getOrderedLists(state), }); @connect(mapStateToProps) @@ -48,6 +56,7 @@ export default class GettingStarted extends ImmutablePureComponent { columns: ImmutablePropTypes.list, multiColumn: PropTypes.bool, dispatch: PropTypes.func.isRequired, + lists: ImmutablePropTypes.list, }; openSettings = () => { @@ -59,8 +68,12 @@ export default class GettingStarted extends ImmutablePureComponent { this.props.dispatch(openModal('ONBOARDING')); } + componentWillMount () { + this.props.dispatch(fetchLists()); + } + render () { - const { intl, myAccount, columns, multiColumn } = this.props; + const { intl, myAccount, columns, multiColumn, lists } = this.props; let navItems = []; @@ -86,19 +99,12 @@ export default class GettingStarted extends ImmutablePureComponent { navItems.push(); } - navItems = navItems.concat([ - , - , - , - ]); - if (myAccount.get('locked')) { - navItems.push(); + navItems.push(); } navItems = navItems.concat([ - , - , + , ]); return ( @@ -107,9 +113,12 @@ export default class GettingStarted extends ImmutablePureComponent {
{navItems} + + + {lists.map(list => + + )} - - -- cgit