From 6760c39e29561ef82d6a0d06496432938e9cac9b Mon Sep 17 00:00:00 2001 From: csrapr <26280794+csrapr@users.noreply.github.com> Date: Thu, 18 Feb 2021 14:57:42 +0000 Subject: [PATCH] Chore: change variable names and use classnames --- .../NotificationCenter/NotificationCenter.js | 8 +++----- .../NotificationCenter/NotificationCenter.styles.js | 8 ++++---- .../NotificationCenter/NotificationRow.js | 13 ++++++++----- new-lamassu-admin/src/components/layout/Header.js | 6 ++---- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/new-lamassu-admin/src/components/NotificationCenter/NotificationCenter.js b/new-lamassu-admin/src/components/NotificationCenter/NotificationCenter.js index bf7788a0..38aa41c0 100644 --- a/new-lamassu-admin/src/components/NotificationCenter/NotificationCenter.js +++ b/new-lamassu-admin/src/components/NotificationCenter/NotificationCenter.js @@ -55,10 +55,9 @@ const CLEAR_ALL_NOTIFICATIONS = gql` const NotificationCenter = ({ close, hasUnreadProp, - notifButtonCoords, + buttonCoords, popperRef, - refetchHasUnreadHeader, - setHeaderHasUnread + refetchHasUnreadHeader }) => { const { data, loading } = useQuery(GET_NOTIFICATIONS, { pollInterval: 60000 @@ -68,12 +67,11 @@ const NotificationCenter = ({ const [showingUnread, setShowingUnread] = useState(false) - const classes = useStyles({ notifButtonCoords, xOffset }) + const classes = useStyles({ buttonCoords, xOffset }) const machines = R.compose( R.map(R.prop('name')), R.indexBy(R.prop('deviceId')) )(data?.machines ?? []) - const notifications = R.path(['notifications'])(data) ?? [] const [hasUnread, setHasUnread] = useState( hasUnreadProp || (data?.hasUnreadNotifications ?? false) diff --git a/new-lamassu-admin/src/components/NotificationCenter/NotificationCenter.styles.js b/new-lamassu-admin/src/components/NotificationCenter/NotificationCenter.styles.js index 7263ba52..150ce6d6 100644 --- a/new-lamassu-admin/src/components/NotificationCenter/NotificationCenter.styles.js +++ b/new-lamassu-admin/src/components/NotificationCenter/NotificationCenter.styles.js @@ -37,10 +37,10 @@ const styles = { marginLeft: spacer * 2, height: 0 }, - notificationIcon: ({ notifButtonCoords, xOffset }) => ({ + notificationIcon: ({ buttonCoords, xOffset }) => ({ position: 'absolute', - top: notifButtonCoords ? notifButtonCoords.y - 1 : 0, - left: notifButtonCoords ? notifButtonCoords.x - xOffset : 0, + top: buttonCoords ? buttonCoords.y - 1 : 0, + left: buttonCoords ? buttonCoords.x - xOffset : 0, cursor: 'pointer', background: 'transparent', boxShadow: '0px 0px 0px transparent', @@ -94,7 +94,7 @@ const styles = { marginTop: 5, width: '12px', height: '12px', - border: `1px solid ${comet}`, + border: [[1, 'solid', comet]], borderRadius: '50%', cursor: 'pointer', zIndex: 1 diff --git a/new-lamassu-admin/src/components/NotificationCenter/NotificationRow.js b/new-lamassu-admin/src/components/NotificationCenter/NotificationRow.js index 3aa850b6..6451d191 100644 --- a/new-lamassu-admin/src/components/NotificationCenter/NotificationRow.js +++ b/new-lamassu-admin/src/components/NotificationCenter/NotificationRow.js @@ -49,6 +49,10 @@ const NotificationRow = ({ ? `${deviceName}` : `${typeDisplay}` + const iconClass = { + [classes.readIcon]: read, + [classes.unreadIcon]: !read + } return ( - {read ? ( -
toggleClear(id)} className={classes.readIcon} /> - ) : ( -
toggleClear(id)} className={classes.unreadIcon} /> - )} +
toggleClear(id)} + className={classnames(iconClass)} + /> {!valid && } diff --git a/new-lamassu-admin/src/components/layout/Header.js b/new-lamassu-admin/src/components/layout/Header.js index 5d7733e0..e6546156 100644 --- a/new-lamassu-admin/src/components/layout/Header.js +++ b/new-lamassu-admin/src/components/layout/Header.js @@ -170,12 +170,10 @@ const Header = memo(({ tree }) => { }}> { - setHasUnread(unread) - }} />