Skip to content

Commit

Permalink
Make approving of qoutes intuitive
Browse files Browse the repository at this point in the history
  • Loading branch information
jennymul committed Nov 6, 2024
1 parent 4a45f63 commit a889d7f
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions app/routes/quotes/components/Quote.tsx
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';
Expand Down Expand Up @@ -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 })[] =
Expand Down Expand Up @@ -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 ? (
<Dropdown.ListItem>
<button onClick={() => dispatch(approve(quote.id))}>
{'Godkjenn'}
</button>
</Dropdown.ListItem>
) : (
<div></div>
)}

{!deleting ? (
<Dropdown.ListItem danger>
Expand All @@ -113,8 +112,8 @@ const Quote = ({
e.preventDefault();
e.stopPropagation();
}

setDeleting(!deleting);
setPippi(false);
}}
>
Slett
Expand All @@ -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>
)}
Expand Down

0 comments on commit a889d7f

Please sign in to comment.