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/index.js') 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 From b6ded7119ea4d13b03db4c384cc57b41f11a4811 Mon Sep 17 00:00:00 2001 From: cwm Date: Tue, 12 Dec 2017 08:50:31 -0600 Subject: travis fixes --- app/javascript/flavours/glitch/features/getting_started/index.js | 2 +- app/javascript/flavours/glitch/features/getting_started_misc/index.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'app/javascript/flavours/glitch/features/getting_started/index.js') diff --git a/app/javascript/flavours/glitch/features/getting_started/index.js b/app/javascript/flavours/glitch/features/getting_started/index.js index 1ca0a0b76..11fdd2344 100644 --- a/app/javascript/flavours/glitch/features/getting_started/index.js +++ b/app/javascript/flavours/glitch/features/getting_started/index.js @@ -35,7 +35,7 @@ const messages = defineMessages({ 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'))); }); diff --git a/app/javascript/flavours/glitch/features/getting_started_misc/index.js b/app/javascript/flavours/glitch/features/getting_started_misc/index.js index 1410d86ac..7310b1356 100644 --- a/app/javascript/flavours/glitch/features/getting_started_misc/index.js +++ b/app/javascript/flavours/glitch/features/getting_started_misc/index.js @@ -1,7 +1,5 @@ import React from 'react'; import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; import { defineMessages, injectIntl } from 'react-intl'; -- cgit From 9719983f2dcd8c47b7c6f59b46460a7a4878d8d4 Mon Sep 17 00:00:00 2001 From: cwm Date: Tue, 12 Dec 2017 22:50:20 -0600 Subject: move list items into an array, don't unnecessarily concat misc nav item --- .../flavours/glitch/features/getting_started/index.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'app/javascript/flavours/glitch/features/getting_started/index.js') diff --git a/app/javascript/flavours/glitch/features/getting_started/index.js b/app/javascript/flavours/glitch/features/getting_started/index.js index 11fdd2344..af1021dca 100644 --- a/app/javascript/flavours/glitch/features/getting_started/index.js +++ b/app/javascript/flavours/glitch/features/getting_started/index.js @@ -76,6 +76,7 @@ export default class GettingStarted extends ImmutablePureComponent { const { intl, myAccount, columns, multiColumn, lists } = this.props; let navItems = []; + let listItems = []; if (multiColumn) { if (!columns.find(item => item.get('id') === 'HOME')) { @@ -103,8 +104,15 @@ export default class GettingStarted extends ImmutablePureComponent { navItems.push(); } - navItems = navItems.concat([ - , + navItems.push(); + + listItems = listItems.concat([ +
+ + {lists.map(list => + + )} +
]); return ( @@ -114,10 +122,7 @@ export default class GettingStarted extends ImmutablePureComponent { {navItems} - - {lists.map(list => - - )} + {listItems} -- cgit From 17e53b931c12abab8548dba324beaae920c453a8 Mon Sep 17 00:00:00 2001 From: cwm Date: Tue, 12 Dec 2017 23:07:12 -0600 Subject: code style fixes --- app/javascript/flavours/glitch/features/getting_started/index.js | 2 +- app/javascript/flavours/glitch/features/getting_started_misc/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app/javascript/flavours/glitch/features/getting_started/index.js') diff --git a/app/javascript/flavours/glitch/features/getting_started/index.js b/app/javascript/flavours/glitch/features/getting_started/index.js index af1021dca..9782d4d32 100644 --- a/app/javascript/flavours/glitch/features/getting_started/index.js +++ b/app/javascript/flavours/glitch/features/getting_started/index.js @@ -112,7 +112,7 @@ export default class GettingStarted extends ImmutablePureComponent { {lists.map(list => )} -
+ , ]); return ( diff --git a/app/javascript/flavours/glitch/features/getting_started_misc/index.js b/app/javascript/flavours/glitch/features/getting_started_misc/index.js index 7310b1356..1209500a0 100644 --- a/app/javascript/flavours/glitch/features/getting_started_misc/index.js +++ b/app/javascript/flavours/glitch/features/getting_started_misc/index.js @@ -34,7 +34,7 @@ export default class gettingStartedMisc extends ImmutablePureComponent { openOnboardingModal = (e) => { e.preventDefault(); this.props.dispatch(openModal('ONBOARDING')); - } + } render () { const { intl } = this.props; -- cgit From be50e45a74dfb12b00f8bd4d9ad34109c602b0cb Mon Sep 17 00:00:00 2001 From: cwm Date: Sun, 17 Dec 2017 22:00:25 -0600 Subject: use makeMapStateToProps --- .../glitch/features/getting_started/index.js | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'app/javascript/flavours/glitch/features/getting_started/index.js') diff --git a/app/javascript/flavours/glitch/features/getting_started/index.js b/app/javascript/flavours/glitch/features/getting_started/index.js index 9782d4d32..ed9d9d1a0 100644 --- a/app/javascript/flavours/glitch/features/getting_started/index.js +++ b/app/javascript/flavours/glitch/features/getting_started/index.js @@ -32,22 +32,26 @@ const messages = defineMessages({ misc: { id: 'navigation_bar.misc', defaultMessage: 'Misc' }, }); -const getOrderedLists = createSelector([state => state.get('lists')], lists => { - if (!lists) { - return lists; - } +const makeMapStateToProps = () => { + 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'))); -}); + 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), -}); + const mapStateToProps = state => ({ + lists: getOrderedLists(state), + myAccount: state.getIn(['accounts', me]), + columns: state.getIn(['settings', 'columns']), + }); + + return mapStateToProps; +} -@connect(mapStateToProps) @injectIntl +@connect(makeMapStateToProps) export default class GettingStarted extends ImmutablePureComponent { static propTypes = { -- cgit From 14aae9c05c8e3053897e6bd3b762edbb1073379b Mon Sep 17 00:00:00 2001 From: cwm Date: Sun, 17 Dec 2017 22:21:15 -0600 Subject: missed a semicolon --- app/javascript/flavours/glitch/features/getting_started/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/javascript/flavours/glitch/features/getting_started/index.js') diff --git a/app/javascript/flavours/glitch/features/getting_started/index.js b/app/javascript/flavours/glitch/features/getting_started/index.js index ed9d9d1a0..89c77b507 100644 --- a/app/javascript/flavours/glitch/features/getting_started/index.js +++ b/app/javascript/flavours/glitch/features/getting_started/index.js @@ -48,7 +48,7 @@ const makeMapStateToProps = () => { }); return mapStateToProps; -} +}; @injectIntl @connect(makeMapStateToProps) -- cgit