Skip to content

Commit

Permalink
Add an icon next to moderator names (#42)
Browse files Browse the repository at this point in the history
Fixes #40
  • Loading branch information
eltoder authored Nov 28, 2024
1 parent 0c6931a commit 0990a6e
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions src/components/User.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import { useHistory } from "react-router-dom";
import { useTheme, makeStyles } from "@material-ui/core/styles";
import Security from "@material-ui/icons/Security";
import WhatshotIcon from "@material-ui/icons/Whatshot";

import useFirebaseRef from "../hooks/useFirebaseRef";
import useStats from "../hooks/useStats";
import { colors } from "../util";

const useStyles = makeStyles((theme) => ({
patronIcon: {
cursor: "pointer",
"&:hover": {
filter: `drop-shadow(0.1rem 0rem 0.2rem)`,
},
},
rating: {
display: "inline-block",
width: "3em",
Expand All @@ -35,7 +29,6 @@ function User({
...other
}) {
const theme = useTheme();
const history = useHistory();
const classes = useStyles();

const [user, loading] = useFirebaseRef(`users/${id}`);
Expand All @@ -45,11 +38,6 @@ function User({
return null;
}

const handleClick = (e) => {
e.preventDefault();
history.push("/donate");
};

const Component = component || "span";
const userEl = (
<Component
Expand All @@ -67,10 +55,8 @@ function User({
{loadingStats ? "⋯" : Math.round(stats[showRating].rating)}
</span>
)}
{(user.patron || forcePatron) && (
<WhatshotIcon
className={classes.patronIcon}
onClick={handleClick}
{user.admin ? (
<Security
fontSize="inherit"
style={{
display: "inline",
Expand All @@ -80,6 +66,19 @@ function User({
color: "inherit",
}}
/>
) : (
(user.patron || forcePatron) && (
<WhatshotIcon
fontSize="inherit"
style={{
display: "inline",
position: "relative",
left: "-0.1em",
top: "0.15em",
color: "inherit",
}}
/>
)
)}
<span>{user.name}</span>
</Component>
Expand Down

0 comments on commit 0990a6e

Please sign in to comment.