Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

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 ? (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{!quote.approved && pippi ? (
{!quote.approved ? (

?

<Dropdown.ListItem>
<button onClick={() => dispatch(approve(quote.id))}>
{'Godkjenn'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{'Godkjenn'}
Godkjenn

</button>
</Dropdown.ListItem>
) : (
<div></div>
Copy link
Member

Choose a reason for hiding this comment

The 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>
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to this PR

Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@

.settingsIcon {
transition: transform var(--easing-medium);
}

.settingsButton {
&:hover {
transform: rotate(90deg);
.settingsIcon {
transform: rotate(90deg);
}
}
}

Expand Down
23 changes: 11 additions & 12 deletions app/routes/users/components/UserProfile/index.tsx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, not relevant to this PR hehe

Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,17 @@ const UserProfile = () => {
title={user.fullName}
actionButtons={
showSettings && (
<Icon
iconNode={<SettingsIcon />}
size={22}
className={styles.settingsIcon}
to={`/users/${user.username}/settings/profile`}
/>
<LinkButton
className={styles.settingsButton}
href={`/users/${user.username}/settings/profile`}
>
<Icon
iconNode={<SettingsIcon />}
size={22}
className={styles.settingsIcon}
/>{' '}
Innstillinger
</LinkButton>
)
}
>
Expand Down Expand Up @@ -195,12 +200,6 @@ const UserProfile = () => {
</Modal>
</DialogTrigger>
)}
{showSettings && (
<LinkButton href={`/users/${user.username}/settings/profile`}>
<Icon iconNode={<SettingsIcon />} size={19} />
Innstillinger
</LinkButton>
)}
</Flex>
<Flex
alignItems="center"
Expand Down
Loading