Introduce a bit of luck into the elefriend selection. #294.

This commit is contained in:
David Yip 2018-01-14 04:19:29 -06:00
parent 53cbc9933e
commit e64cc311dd
No known key found for this signature in database
GPG key ID: 7DA0036508FCC0CC
6 changed files with 25 additions and 12 deletions

View file

@ -74,9 +74,8 @@ class Drawer extends React.Component {
submitted, submitted,
} = this.props; } = this.props;
let elefriendAttrs = { let innerDrawerAttrs = {
className: classNames('mastodon', 'mbstobon-' + elefriend), className: classNames('drawer--inner', 'mbstobon-' + elefriend),
onClick: onClickElefriend,
}; };
// The result. // The result.
@ -100,9 +99,9 @@ class Drawer extends React.Component {
/> />
<div className='contents'> <div className='contents'>
<DrawerAccount account={account} /> <DrawerAccount account={account} />
<div className='drawer__inner'> <div {...innerDrawerAttrs}>
<Composer /> <Composer />
{multiColumn && <div {...elefriendAttrs} />} {multiColumn && <div className='mastodon' onClick={onClickElefriend} role='button' />}
</div> </div>
<DrawerResults <DrawerResults
results={results} results={results}

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -38,6 +38,10 @@ import { overwrite } from 'flavours/glitch/util/js_helpers';
const totalElefriends = 3; const totalElefriends = 3;
// ~4% chance you'll end up with an unexpected friend
// glitch-soc/mastodon repo created_at date: 2017-04-20T21:55:28Z
const glitchProbability = 1 - 0.0420215528;
const initialState = ImmutableMap({ const initialState = ImmutableMap({
mounted: false, mounted: false,
advanced_options: ImmutableMap({ advanced_options: ImmutableMap({
@ -45,7 +49,7 @@ const initialState = ImmutableMap({
threaded_mode: false, threaded_mode: false,
}), }),
sensitive: false, sensitive: false,
elefriend: Math.floor(Math.random() * totalElefriends), elefriend: Math.random() < glitchProbability ? Math.floor(Math.random() * totalElefriends) : totalElefriends,
spoiler: false, spoiler: false,
spoiler_text: '', spoiler_text: '',
privacy: null, privacy: null,

View file

@ -50,9 +50,8 @@
contain: strict; contain: strict;
} }
.drawer__inner { .drawer--inner {
position: absolute; position: absolute;
background: lighten($ui-base-color, 13%) url('~flavours/glitch/images/wave-drawer.png') no-repeat bottom / 100% auto;
top: 0; top: 0;
left: 0; left: 0;
box-sizing: border-box; box-sizing: border-box;
@ -66,11 +65,22 @@
.mastodon { .mastodon {
flex: 1; flex: 1;
}
}
@for $i from 0 through 2 { @for $i from 0 through 3 {
&.mbstobon-#{$i} { .drawer--inner.mbstobon-#{$i} {
background: url("~flavours/glitch/images/mbstobon-ui-#{$i}.png") no-repeat left bottom / contain; @if $i == 3 {
filter: saturate(80%) contrast(50%) brightness(50%); background: lighten($ui-base-color, 13%) url('~flavours/glitch/images/wave-drawer.png') no-repeat bottom / 100% auto;
} @else {
background: lighten($ui-base-color, 13%) url('~flavours/glitch/images/wave-drawer-glitched.png') no-repeat bottom / 100% auto;
}
.mastodon {
background: url("~flavours/glitch/images/mbstobon-ui-#{$i}.png") no-repeat left bottom / contain;
@if $i != 3 {
filter: contrast(50%) brightness(50%);
} }
} }
} }