-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prompting Unauthenticated Users to sign in first to upvote a story #163
base: main
Are you sure you want to change the base?
Changes from 2 commits
1ccb8a6
86b6464
0f95814
ad570f1
764b96e
8f8fa1f
e234ee0
4d38272
da5655c
6f0614b
7c2b83b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,8 @@ const StoryPageTimeline = (props) => { | |
|
||
const [isOpen, setIsOpen] = useState(false) | ||
|
||
const [showLog, setShowLog] = useState(false) | ||
|
||
const [previousStatuses, setPreviousStatuses] = useState([]) | ||
|
||
const togglePopup = () => { | ||
|
@@ -88,11 +90,15 @@ const StoryPageTimeline = (props) => { | |
> | ||
<div | ||
data-cy='story-vote-btn' | ||
className={`story-vote-button ${ | ||
userId ? 'story-vote-button-clickable' : '' | ||
}`} | ||
className={`story-vote-button story-vote-button-clickable`} | ||
onClick={() => { | ||
if (userId && !voteClicked) updateVote(story) | ||
if (userId && !voteClicked) { | ||
updateVote(story) | ||
console.log('even after being logged') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid leaving console logs in production. They don't add value to users |
||
} else if (!userId) { | ||
console.log('Not loged In') | ||
setShowLog(!showLog) | ||
} | ||
}} | ||
> | ||
<EOS_THUMB_UP className='eos-icons' color='white' size='l' /> | ||
|
@@ -104,6 +110,30 @@ const StoryPageTimeline = (props) => { | |
> | ||
{votes} Votes | ||
</div> | ||
{showLog && ( | ||
<> | ||
<Modal | ||
content={ | ||
<> | ||
<div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. try not to use too many empty divs that don't even have classes. Titles are display block elements, they don't need to be encapsulated in divs |
||
<h1>Oops! You're not signed In</h1> | ||
<div> | ||
<h2> | ||
<Link className='btn' data-cy='btn-signin' to='/login'> | ||
Sign-In to UpVote :) | ||
</Link> | ||
</h2> | ||
</div> | ||
</div> | ||
</> | ||
} | ||
handleClose={() => { | ||
setShowLog(!showLog) | ||
}} | ||
active={showLog} | ||
/> | ||
</> | ||
)} | ||
{isOpen && ( | ||
<Modal | ||
content={ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,9 +73,13 @@ const Vote = (props) => { | |
{votes} | ||
</div> | ||
<div | ||
className={`vote-button ${userId ? 'vote-button-clickable' : ''}`} | ||
className={`vote-button`} | ||
onClick={() => { | ||
if (userId && !voteClicked) updateVote(story) | ||
if (userId && !voteClicked) { | ||
updateVote(story) | ||
} else if (!userId) { | ||
console.log('Not loged In') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid leaving console logs in production. They don't add value to users |
||
} | ||
}} | ||
> | ||
<EOS_THUMB_UP className='eos-icons' color='white' /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this issue seems to already have been addressed in #162
Please remove these changes from this PR so that the other one can be merged