Set glitchy elephant friend variant in initial state. #294.

Also lay some groundwork needed to interactively change the
glitchfriend.

The codebase uses "elefriend" because it's shorter and didn't require me
to realign the actions in actions/compose.js.  Same idea, though.
This commit is contained in:
David Yip
2018-01-13 21:22:37 -06:00
parent 1e0b707018
commit 1dbb6b5e08
8 changed files with 22 additions and 7 deletions

View File

@ -28,6 +28,7 @@ import { wrap } from 'flavours/glitch/util/redux_helpers';
const mapStateToProps = state => ({
account: state.getIn(['accounts', me]),
columns: state.getIn(['settings', 'columns']),
elefriend: state.getIn(['compose', 'elefriend']),
results: state.getIn(['search', 'results']),
searchHidden: state.getIn(['search', 'hidden']),
searchValue: state.getIn(['search', 'value']),
@ -56,6 +57,7 @@ class Drawer extends React.Component {
const {
account,
columns,
elefriend,
intl,
multiColumn,
onChange,
@ -69,10 +71,8 @@ class Drawer extends React.Component {
submitted,
} = this.props;
let choices = ['mbstobon-bg-1', 'mbstobon-bg-2', 'mbstobon-bg-3'];
let glitchyFriendDecision = choices[Math.floor(Math.random() * choices.length)];
let drawerAttrs = {
className: classNames('contents', glitchyFriendDecision)
let elefriendAttrs = {
className: classNames('mastodon', 'mbstobon-' + elefriend),
};
// The result.
@ -98,7 +98,7 @@ class Drawer extends React.Component {
<DrawerAccount account={account} />
<div className='drawer__inner'>
<Composer />
{multiColumn && <div className="mastodon mbstobon-bg-1" />}
{multiColumn && <div {...elefriendAttrs} />}
</div>
<DrawerResults
results={results}
@ -120,6 +120,7 @@ Drawer.propTypes = {
account: ImmutablePropTypes.map,
columns: ImmutablePropTypes.list,
results: ImmutablePropTypes.map,
elefriend: PropTypes.number,
searchHidden: PropTypes.bool,
searchValue: PropTypes.string,
submitted: PropTypes.bool,