-
Notifications
You must be signed in to change notification settings - Fork 3
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
Anonymous warning modal #458
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
bf7bb6f
anonymous modal works when logged in
qiandrewj a8e7de8
the anonymous modal only shows up for new users
qiandrewj 0bf521e
anonymous modal displays correctly
qiandrewj 38ef646
review gets submitted from profile page after being redirected by ano…
qiandrewj 4361073
reviews now all redirect to profile page
qiandrewj 6502c60
admin management modal can no longer duplicate users
qiandrewj ef3e1d5
now works when logged out, yet to test when logged in
qiandrewj 81b339a
hook change to correctly update state
qiandrewj 8259ed2
got rid of redundant useEffect
qiandrewj 1f976dd
deleting redundant code from course
qiandrewj 64789f1
deleting unused user code
qiandrewj af97a6a
resolving pr comments
qiandrewj 496e214
updated out of date routes
qiandrewj 3799e76
fixing endpoint names
qiandrewj 20575c3
Merge branch 'main' into aq/anonymous
qiandrewj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react' | ||
|
||
import styles from '../Styles/AnonymousWarning.module.css' | ||
|
||
import Anonymous from '../../../assets/img/anonymous.png' | ||
import { useAuthOptionalLogin } from '../../../auth/auth_utils' | ||
import { useHistory } from 'react-router-dom' | ||
|
||
type Props = { | ||
open: boolean | ||
} | ||
|
||
const AnonymousWarning = ({ open }: Props) => { | ||
const {isLoggedIn, signIn} = useAuthOptionalLogin() | ||
const history = useHistory() | ||
|
||
if (!open) { | ||
return <></> | ||
} | ||
|
||
if (isLoggedIn) { | ||
return ( | ||
<div className={styles.warningContainer}> | ||
<div className={styles.anonymousLogo}> | ||
<img src={Anonymous} className="anonymous-logo" alt="anonymous logo" /> | ||
</div> | ||
<div className={styles.message}> | ||
<span className="line1">Don't worry - all your reviews are<br /></span> <span className={styles.line2}> anonymous!</span> | ||
</div> | ||
<button | ||
className={`${styles.button}`} | ||
onClick={() => history.push('/profile')} | ||
> | ||
Submit Review | ||
</button> | ||
<div className={styles.pastReviewsMessage}> | ||
You will be redirected to your past reviews page | ||
</div> | ||
</div> | ||
) | ||
} | ||
/** | ||
* Anonymous warning modal that is rendered when the user is not signed in | ||
*/ | ||
else { | ||
return ( | ||
<div className={styles.warningContainer}> | ||
<div className={styles.anonymousLogo}> | ||
<img src={Anonymous} className="anonymous-logo" alt="anonymous logo" /> | ||
</div> | ||
<div className={styles.message}> | ||
<span className="line1">Login to submit - all your reviews are<br /></span> <span className={styles.line2}> anonymous!</span> | ||
</div> | ||
<button | ||
className={`${styles.button}`} | ||
onClick={() => signIn('profile')} | ||
> | ||
Login | ||
</button> | ||
<div className={styles.pastReviewsMessage}> | ||
You will be redirected to your past reviews page | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default AnonymousWarning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
client/src/modules/Course/Styles/AnonymousWarning.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
.warningContainer { | ||
|
||
|
||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
text-align: center; | ||
background: white; | ||
padding: 50px; | ||
border-radius: 8px; | ||
} | ||
|
||
.anonymousLogo { | ||
max-width: 25%; | ||
max-height: 25%; | ||
margin: auto; | ||
} | ||
|
||
.message { | ||
text-align: center; | ||
margin-top: 30px; | ||
|
||
font-family: Source Sans Pro; | ||
font-style: normal; | ||
font-size: 24px; | ||
font-weight: 300; | ||
line-height: normal; | ||
text-align: center; | ||
|
||
color: #000000; | ||
} | ||
|
||
.line2 { | ||
font-weight: 600; | ||
} | ||
|
||
.button { | ||
background-color: #0076ff; | ||
color: #ffffff; | ||
width: 50%; | ||
border-radius: 10px; | ||
margin-top: 20px; | ||
padding: 11px 10px; | ||
text-align: center; | ||
font-family: Source Sans Pro; | ||
font-size: 18px; | ||
font-style: normal; | ||
line-height: normal; | ||
cursor: pointer; | ||
} | ||
|
||
.pastReviewsMessage { | ||
margin-top: 10px; | ||
margin-left: 15px; | ||
font-family: 'Source Sans Pro', sans-serif; | ||
font-size: 12px; | ||
color: #A1A1A1; | ||
font-weight: var(--regular-weight); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure if this is a bug on my end, but after redirecting to the profile, the submitted reviews don't show up in the main panel (but the number is updated on the left side):