1- import { useHistory } from "react-router-dom" ;
21import { useTheme , makeStyles } from "@material-ui/core/styles" ;
2+ import Security from "@material-ui/icons/Security" ;
33import WhatshotIcon from "@material-ui/icons/Whatshot" ;
44
55import useFirebaseRef from "../hooks/useFirebaseRef" ;
66import useStats from "../hooks/useStats" ;
77import { colors } from "../util" ;
88
99const useStyles = makeStyles ( ( theme ) => ( {
10- patronIcon : {
11- cursor : "pointer" ,
12- "&:hover" : {
13- filter : `drop-shadow(0.1rem 0rem 0.2rem)` ,
14- } ,
15- } ,
1610 rating : {
1711 display : "inline-block" ,
1812 width : "3em" ,
@@ -35,7 +29,6 @@ function User({
3529 ...other
3630} ) {
3731 const theme = useTheme ( ) ;
38- const history = useHistory ( ) ;
3932 const classes = useStyles ( ) ;
4033
4134 const [ user , loading ] = useFirebaseRef ( `users/${ id } ` ) ;
@@ -45,11 +38,6 @@ function User({
4538 return null ;
4639 }
4740
48- const handleClick = ( e ) => {
49- e . preventDefault ( ) ;
50- history . push ( "/donate" ) ;
51- } ;
52-
5341 const Component = component || "span" ;
5442 const userEl = (
5543 < Component
@@ -67,10 +55,8 @@ function User({
6755 { loadingStats ? "⋯" : Math . round ( stats [ showRating ] . rating ) }
6856 </ span >
6957 ) }
70- { ( user . patron || forcePatron ) && (
71- < WhatshotIcon
72- className = { classes . patronIcon }
73- onClick = { handleClick }
58+ { user . admin ? (
59+ < Security
7460 fontSize = "inherit"
7561 style = { {
7662 display : "inline" ,
@@ -80,6 +66,19 @@ function User({
8066 color : "inherit" ,
8167 } }
8268 />
69+ ) : (
70+ ( user . patron || forcePatron ) && (
71+ < WhatshotIcon
72+ fontSize = "inherit"
73+ style = { {
74+ display : "inline" ,
75+ position : "relative" ,
76+ left : "-0.1em" ,
77+ top : "0.15em" ,
78+ color : "inherit" ,
79+ } }
80+ />
81+ )
8382 ) }
8483 < span > { user . name } </ span >
8584 </ Component >
0 commit comments