From 1dbb6b5e08b6672a77d2f7f4121e7874b750db60 Mon Sep 17 00:00:00 2001 From: David Yip Date: Sat, 13 Jan 2018 21:22:37 -0600 Subject: 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. --- app/javascript/flavours/glitch/reducers/compose.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/javascript/flavours/glitch/reducers/compose.js') diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js index f341977b7..dfab38387 100644 --- a/app/javascript/flavours/glitch/reducers/compose.js +++ b/app/javascript/flavours/glitch/reducers/compose.js @@ -2,6 +2,7 @@ import { COMPOSE_MOUNT, COMPOSE_UNMOUNT, COMPOSE_CHANGE, + COMPOSE_CYCLE_ELEFRIEND, COMPOSE_REPLY, COMPOSE_REPLY_CANCEL, COMPOSE_MENTION, @@ -35,6 +36,8 @@ import uuid from 'flavours/glitch/util/uuid'; import { me } from 'flavours/glitch/util/initial_state'; import { overwrite } from 'flavours/glitch/util/js_helpers'; +const totalElefriends = 3; + const initialState = ImmutableMap({ mounted: false, advanced_options: ImmutableMap({ @@ -42,6 +45,7 @@ const initialState = ImmutableMap({ threaded_mode: false, }), sensitive: false, + elefriend: Math.floor(Math.random() * totalElefriends), spoiler: false, spoiler_text: '', privacy: null, @@ -259,6 +263,9 @@ export default function compose(state = initialState, action) { return state .set('text', action.text) .set('idempotencyKey', uuid()); + case COMPOSE_CYCLE_ELEFRIEND: + return state + .set('elefriend', (state.get('elefriend') + 1) % totalElefriends); case COMPOSE_REPLY: return state.withMutations(map => { map.set('in_reply_to', action.status.get('id')); -- cgit From e64cc311dd8db5d56b6299e9d40e7060d0c25b7e Mon Sep 17 00:00:00 2001 From: David Yip Date: Sun, 14 Jan 2018 04:19:29 -0600 Subject: Introduce a bit of luck into the elefriend selection. #294. --- .../flavours/glitch/features/drawer/index.js | 9 ++++----- .../flavours/glitch/images/mbstobon-ui-3.png | Bin 0 -> 32449 bytes .../glitch/images/wave-drawer-glitched.png | Bin 0 -> 3544 bytes .../flavours/glitch/images/wave-drawer.png | Bin 0 -> 3269 bytes app/javascript/flavours/glitch/reducers/compose.js | 6 +++++- .../flavours/glitch/styles/components/drawer.scss | 22 +++++++++++++++------ 6 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 app/javascript/flavours/glitch/images/mbstobon-ui-3.png create mode 100644 app/javascript/flavours/glitch/images/wave-drawer-glitched.png create mode 100644 app/javascript/flavours/glitch/images/wave-drawer.png (limited to 'app/javascript/flavours/glitch/reducers/compose.js') diff --git a/app/javascript/flavours/glitch/features/drawer/index.js b/app/javascript/flavours/glitch/features/drawer/index.js index 832b16e6f..93457ad31 100644 --- a/app/javascript/flavours/glitch/features/drawer/index.js +++ b/app/javascript/flavours/glitch/features/drawer/index.js @@ -74,9 +74,8 @@ class Drawer extends React.Component { submitted, } = this.props; - let elefriendAttrs = { - className: classNames('mastodon', 'mbstobon-' + elefriend), - onClick: onClickElefriend, + let innerDrawerAttrs = { + className: classNames('drawer--inner', 'mbstobon-' + elefriend), }; // The result. @@ -100,9 +99,9 @@ class Drawer extends React.Component { />
-
+
- {multiColumn &&
} + {multiColumn &&
}