about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/drawer
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-01-13 21:22:37 -0600
committerDavid Yip <yipdw@member.fsf.org>2018-01-14 03:06:11 -0600
commit1dbb6b5e08b6672a77d2f7f4121e7874b750db60 (patch)
tree158f5bd61cf785bfbb9f81eeead007bc8dbfdfb5 /app/javascript/flavours/glitch/features/drawer
parent1e0b7070185b748e27a301acfc325bfb38be7b31 (diff)
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.
Diffstat (limited to 'app/javascript/flavours/glitch/features/drawer')
-rw-r--r--app/javascript/flavours/glitch/features/drawer/index.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/javascript/flavours/glitch/features/drawer/index.js b/app/javascript/flavours/glitch/features/drawer/index.js
index ba56f1a30..8f9719096 100644
--- a/app/javascript/flavours/glitch/features/drawer/index.js
+++ b/app/javascript/flavours/glitch/features/drawer/index.js
@@ -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,