-
Notifications
You must be signed in to change notification settings - Fork 50
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
Make qoute approving intuitive #5163
base: master
Are you sure you want to change the base?
Changes from all commits
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 | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||||
import { useState } from 'react'; | ||||||
import { Link } from 'react-router-dom'; | ||||||
import { approve, deleteQuote, unapprove } from 'app/actions/QuoteActions'; | ||||||
import { approve, deleteQuote } from 'app/actions/QuoteActions'; | ||||||
import Dropdown from 'app/components/Dropdown'; | ||||||
import Reactions from 'app/components/Reactions'; | ||||||
import Reaction from 'app/components/Reactions/Reaction'; | ||||||
|
@@ -30,6 +30,7 @@ const Quote = ({ | |||||
const fetchingEmojis = useAppSelector((state) => state.emojis.fetching); | ||||||
|
||||||
const [deleting, setDeleting] = useState(false); | ||||||
const [pippi, setPippi] = useState(true); | ||||||
const dispatch = useAppDispatch(); | ||||||
|
||||||
let mappedEmojis: (Emoji & { hasReacted: boolean; reactionId: EntityId })[] = | ||||||
|
@@ -93,17 +94,15 @@ const Quote = ({ | |||||
iconName="ellipsis-horizontal" | ||||||
> | ||||||
<Dropdown.List> | ||||||
<Dropdown.ListItem> | ||||||
<button | ||||||
onClick={() => | ||||||
quote.approved | ||||||
? dispatch(unapprove(quote.id)) | ||||||
: dispatch(approve(quote.id)) | ||||||
} | ||||||
> | ||||||
{quote.approved ? 'Fjern godkjenning' : 'Godkjenn'} | ||||||
</button> | ||||||
</Dropdown.ListItem> | ||||||
{!quote.approved && pippi ? ( | ||||||
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.
Suggested change
? |
||||||
<Dropdown.ListItem> | ||||||
<button onClick={() => dispatch(approve(quote.id))}> | ||||||
{'Godkjenn'} | ||||||
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.
Suggested change
|
||||||
</button> | ||||||
</Dropdown.ListItem> | ||||||
) : ( | ||||||
<div></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. Instead of using a ternary, just use && so that we don't need empty divs like this in the dom |
||||||
)} | ||||||
|
||||||
{!deleting ? ( | ||||||
<Dropdown.ListItem danger> | ||||||
|
@@ -113,8 +112,8 @@ const Quote = ({ | |||||
e.preventDefault(); | ||||||
e.stopPropagation(); | ||||||
} | ||||||
|
||||||
setDeleting(!deleting); | ||||||
setPippi(false); | ||||||
}} | ||||||
> | ||||||
Slett | ||||||
|
@@ -123,7 +122,7 @@ const Quote = ({ | |||||
) : ( | ||||||
<Dropdown.ListItem> | ||||||
<button onClick={() => dispatch(deleteQuote(quote.id))}> | ||||||
Er du sikker? | ||||||
Jeg er sikker, slett den! Fyfy | ||||||
</button> | ||||||
</Dropdown.ListItem> | ||||||
)} | ||||||
|
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. not related to this PR |
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. Again, not relevant to this PR hehe |
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.
🤔