Skip to content

Commit 86b6464

Browse files
committed
Solving issue #150
1 parent 1ccb8a6 commit 86b6464

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

src/components/StoryPageTimeline.js

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const StoryPageTimeline = (props) => {
2424

2525
const [isOpen, setIsOpen] = useState(false)
2626

27+
const [showLog, setShowLog] = useState(false)
28+
2729
const [previousStatuses, setPreviousStatuses] = useState([])
2830

2931
const togglePopup = () => {
@@ -88,11 +90,15 @@ const StoryPageTimeline = (props) => {
8890
>
8991
<div
9092
data-cy='story-vote-btn'
91-
className={`story-vote-button ${
92-
userId ? 'story-vote-button-clickable' : ''
93-
}`}
93+
className={`story-vote-button story-vote-button-clickable`}
9494
onClick={() => {
95-
if (userId && !voteClicked) updateVote(story)
95+
if (userId && !voteClicked) {
96+
updateVote(story)
97+
console.log('even after being logged')
98+
} else if (!userId) {
99+
console.log('Not loged In')
100+
setShowLog(!showLog)
101+
}
96102
}}
97103
>
98104
<EOS_THUMB_UP className='eos-icons' color='white' size='l' />
@@ -104,6 +110,30 @@ const StoryPageTimeline = (props) => {
104110
>
105111
{votes} Votes
106112
</div>
113+
{showLog && (
114+
<>
115+
<Modal
116+
content={
117+
<>
118+
<div>
119+
<h1>Oops! You're not signed In</h1>
120+
<div>
121+
<h2>
122+
<Link className='btn' data-cy='btn-signin' to='/login'>
123+
Sign-In to UpVote :)
124+
</Link>
125+
</h2>
126+
</div>
127+
</div>
128+
</>
129+
}
130+
handleClose={() => {
131+
setShowLog(!showLog)
132+
}}
133+
active={showLog}
134+
/>
135+
</>
136+
)}
107137
{isOpen && (
108138
<Modal
109139
content={

src/components/Vote.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,13 @@ const Vote = (props) => {
7373
{votes}
7474
</div>
7575
<div
76-
className={`vote-button ${userId ? 'vote-button-clickable' : ''}`}
76+
className={`vote-button`}
7777
onClick={() => {
78-
if (userId && !voteClicked) updateVote(story)
78+
if (userId && !voteClicked) {
79+
updateVote(story)
80+
} else if (!userId) {
81+
console.log('Not loged In')
82+
}
7983
}}
8084
>
8185
<EOS_THUMB_UP className='eos-icons' color='white' />

0 commit comments

Comments
 (0)