Skip to content

Commit d50dad0

Browse files
author
Pavithra K
committed
Dont display voting options when not logged in
1 parent f2914f1 commit d50dad0

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

components/vote/app.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ export default class VoteApp extends React.Component {
188188
</div>
189189
{this.renderSelf()}
190190
{ listInfo && <div>
191-
<button className="vote-app__update-button" disabled={inProgress} onClick={() => {
191+
{voteAppToken && <button className="vote-app__update-button" disabled={inProgress} onClick={() => {
192192
this.updateSelf();
193193
this.updateList();
194-
}}>Update</button>
194+
}}>Update</button>}
195195
<h1>{listInfo.displayName}</h1>
196196
<div>{listInfo.description}</div>
197197
<ul className="vote-app__items-list">

components/vote/button/button.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react';
22

33
export default (props) => {
4-
let { value, myValue, maxDown, maxUp, color, onVote, className } = props;
4+
let { value, myValue, maxDown, maxUp, color, onVote, className, isLoginActive } = props;
5+
let {voteAppToken} = localStorage;
56

67
let click = (e, n) => {
78
onVote(Math.min(maxUp, Math.max(n, -maxDown)));
@@ -34,7 +35,7 @@ export default (props) => {
3435
}
3536
};
3637

37-
return <div className="vote-button" style={{color: color}}>
38+
return voteAppToken ? (<div className="vote-button" style={{color: color}}>
3839
{makeTriangle(Infinity, triangleUp, 30, 11)}
3940
{makeTriangle(10, triangleUp, 20, 2)}
4041
{makeTriangle(1, triangleUp, 15, 1)}
@@ -47,7 +48,11 @@ export default (props) => {
4748
{makeTriangle(-1, triangleDown, 15, 1)}
4849
{makeTriangle(-10, triangleDown, 20, 2)}
4950
{makeTriangle(-Infinity, triangleDown, 30, 11)}
50-
</div>;
51+
</div>): (<div className="vote-button" style={{color: color}}>
52+
<div className="vote-button__value" title={value + " was voted in total by all users."}>
53+
<span className={className}>{value}</span>
54+
</div>
55+
</div>);
5156
};
5257

5358
function triangleUp({color, size}) {

0 commit comments

Comments
 (0)