Skip to content

Commit 3aab600

Browse files
authored
Merge pull request #420 from webpack/develop
Deploy
2 parents 902c027 + c7bf12b commit 3aab600

File tree

10 files changed

+114
-19
lines changed

10 files changed

+114
-19
lines changed

components/sidebar-mobile/sidebar-mobile.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export default class SidebarMobile extends React.Component {
181181
_handleTouchEnd(e){
182182
// Free up all the inline styling
183183
this.container.classList.remove('no-delay');
184-
this.container.style = '';
184+
this.container.style.transform = '';
185185

186186
if (initialTouchPosition.x - lastTouchPosition.x > 100) {
187187
this._close();

components/vote/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
vote as devVote
99
} from "./api.dev";
1010

11-
const API_URL = "https://ipttmcpme6.execute-api.us-east-1.amazonaws.com/production";
11+
const API_URL = "https://oswils44oj.execute-api.us-east-1.amazonaws.com/production/";
1212
const GITHUB_CLIENT_ID = "4d355e2799cb8926c665";
1313
const PRODUCTION_HOST = "webpack.js.org";
1414

components/vote/app-style.scss

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,33 @@
11
@import 'vars';
22
@import 'mixins';
3+
@import 'functions';
34

45
.vote-app {
6+
margin: 1.5em;
7+
8+
&__influence-descriptions {
9+
display: flex;
10+
flex-direction: column;
11+
12+
@include break(medium) {
13+
flex-direction: row;
14+
}
15+
}
16+
17+
&__influence-section {
18+
flex: 0 0 100%;
19+
}
20+
21+
&__influence-disclaimer {
22+
padding: 1em 0;
23+
flex: 0 0 100%;
24+
font-size: smaller;
25+
color: red;
26+
@include break(medium) {
27+
text-align: center;
28+
}
29+
}
30+
531
&__self-info {
632
margin-top: 10px;
733
}
@@ -36,6 +62,8 @@
3662

3763
&__item-score {
3864
font-size: 150%;
65+
width: 90px;
66+
text-align: right;
3967
}
4068

4169
&__items-list {

components/vote/app.jsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import React from 'react';
2+
import 'whatwg-fetch';
23
import SidebarItem from '../sidebar-item/sidebar-item';
34
import * as api from "./api";
45
import './app-style';
6+
import './influence-style';
57
import VoteButton from './button/button';
8+
import Influence from './influence.jsx';
69

710
function updateByProperty(array, property, propertyValue, update) {
811
return array.map(item => {
@@ -26,7 +29,7 @@ export default class VoteApp extends React.Component {
2629
}
2730

2831
isBrowserSupported() {
29-
return typeof localStorage === 'object' && typeof fetch === 'function';
32+
return typeof localStorage === 'object';
3033
}
3134

3235
componentDidMount() {
@@ -114,7 +117,7 @@ export default class VoteApp extends React.Component {
114117
...vote,
115118
votes: vote.votes + diffValue
116119
})),
117-
score: item.score + score
120+
score: item.score + score * diffValue
118121
}))
119122
},
120123
selfInfo: selfInfo && {
@@ -176,6 +179,15 @@ export default class VoteApp extends React.Component {
176179

177180
return (
178181
<div className="vote-app">
182+
<div className="vote-app__influence">
183+
<div className="vote-app__influence-descriptions">
184+
<Influence className="vote-app__influence-section" type="normal"/>
185+
<Influence className="vote-app__influence-section" type="golden"/>
186+
</div>
187+
<div className="vote-app__influence-disclaimer">
188+
DISCLAIMER: Since this feature is its Alpha stages, the formula for calculating influence may change.
189+
</div>
190+
</div>
179191
{this.renderSelf()}
180192
{ listInfo && <div>
181193
<button className="vote-app__update-button" disabled={inProgress} onClick={() => {
@@ -203,8 +215,8 @@ export default class VoteApp extends React.Component {
203215
return <td>
204216
<VoteButton
205217
className={"vote-app__vote-" + voteSettings.name}
206-
value={vote.votes} myValue={userVote.votes}
207-
maxUp={maximum - userVote.votes} maxDown={userVote.votes - minimum}
218+
value={vote.votes} myValue={value}
219+
maxUp={userVote ? maximum - value : 0} maxDown={userVote ? value - minimum : 0}
208220
color={this.getColor(voteSettings.name)} onVote={(diffValue) => {
209221
this.vote(item.id, voteSettings.name, diffValue, voteSettings.currency, voteSettings.score);
210222
}} />

components/vote/button/button-style.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
font-size: 150%;
55
}
66

7-
&__value, &__my-value, &__upMax, &__up10, &__up1, &__down1, &__down10, &__downMax {
7+
&__value, &__my-value, &__upDown {
88
display: block;
9+
width: 90px;
910
}
1011

11-
&__upMax, &__up10, &__up1, &__down1, &__down10, &__downMax {
12+
&__upDown {
1213
border: 0;
1314
padding: 0;
1415
margin: 0;

components/vote/button/button.jsx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,33 @@ export default (props) => {
1818
};
1919

2020
let makeTriangle = (n, fn, size, minForEnabled) => {
21-
const enabled = n > 0 ? (maxUp >= minForEnabled) : (maxDown >= minForEnabled);
22-
return <a href="#"
23-
title={titleText(n)}
24-
onClick={e => click(e, n)}
25-
className="vote-button__upMax">
26-
{fn({size: size, color: enabled ? color : "transparent"})}
27-
</a>;
21+
const enabled = n !== 0 && (n > 0 ? (maxUp >= minForEnabled) : (maxDown >= minForEnabled));
22+
const className = "vote-button__upDown";
23+
if(enabled) {
24+
return <a href="#"
25+
title={titleText(n)}
26+
onClick={e => click(e, n)}
27+
className={className}>
28+
{fn({size: size, color: color})}
29+
</a>;
30+
} else {
31+
return <a
32+
className={className}>
33+
{fn({size: size, color: "#eee"})}
34+
</a>;
35+
}
2836
};
2937

3038
return <div className="vote-button" style={{color: color}}>
3139
{makeTriangle(Infinity, triangleUp, 30, 11)}
3240
{makeTriangle(10, triangleUp, 20, 2)}
3341
{makeTriangle(1, triangleUp, 15, 1)}
34-
<div className="vote-button__value"><span className={className}>{value}</span></div>
35-
<div className="vote-button__my-value">(<span className={className}>{myValue}</span>)</div>
42+
<div className="vote-button__value" title={value + " was voted in total by all users."}>
43+
<span className={className}>{value}</span>
44+
</div>
45+
<div className="vote-button__my-value" title={myValue + " was voted by you."}>
46+
(<span className={className}>{myValue}</span>)
47+
</div>
3648
{makeTriangle(-1, triangleDown, 15, 1)}
3749
{makeTriangle(-10, triangleDown, 20, 2)}
3850
{makeTriangle(-Infinity, triangleDown, 30, 11)}

components/vote/influence-style.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@import 'mixins';
2+
@import 'functions';
3+
4+
.influence-info {
5+
em {
6+
font-weight: bolder;
7+
}
8+
9+
i {
10+
font-style: italic;
11+
}
12+
13+
&__section {
14+
padding: 0.5em 0;
15+
@include break(medium) {
16+
padding: 0 .5em;
17+
}
18+
}
19+
}

components/vote/influence.jsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
import './influence-style.scss';
3+
4+
export default class InfluenceComponent extends React.Component {
5+
constructor(props) {
6+
super(props);
7+
}
8+
9+
render() {
10+
return (this.props.type === "normal" ? (
11+
<section className="influence-info influence-info__section">
12+
<h1 className="influence-info__header">What is Influence?</h1>
13+
<p><em>Influence</em> is a unit of measure based on time you have been a member on github. However, in 2017 and on you will recieve one influence per day.</p>
14+
</section>
15+
) : (
16+
<section className="influence-info influence-info__section">
17+
<h1 className="influence-info__header">What is Golden Influence?</h1>
18+
<p><em>Golden Influence</em> is equal to 100 <i>normal influence</i>. Golden Influence is obtained by being a backer or sponsor on our <a href="https://opencollective.com/webpack">Open Collective page</a>.</p>
19+
</section>
20+
));
21+
}
22+
}

content/get-started/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ To bundle the `lodash` dependency with the `index.js`, we need to import `lodash
7171
__app/index.js__
7272

7373
```diff
74-
+ import _ from `lodash`;
74+
+ import _ from 'lodash';
7575

7676
function component () {
7777
...

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"preact-compat": "^3.6.0",
9898
"react": "^15.3.2",
9999
"react-dom": "^15.3.2",
100-
"react-router": "^2.8.1"
100+
"react-router": "^2.8.1",
101+
"whatwg-fetch": "^2.0.1"
101102
}
102103
}

0 commit comments

Comments
 (0)