Skip to content

Commit 3714773

Browse files
authored
Update DeviceRow.jsx
This commit add highlight to the selected device in devices list
1 parent a986573 commit 3714773

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/DeviceRow.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ const useStyles = makeStyles()((theme) => ({
4848
neutral: {
4949
color: theme.palette.neutral.main,
5050
},
51+
selected: {
52+
backgroundColor: theme.palette.action.selected,
53+
},
5154
}));
5255

5356
const DeviceRow = ({ data, index, style }) => {
@@ -56,6 +59,7 @@ const DeviceRow = ({ data, index, style }) => {
5659
const t = useTranslation();
5760

5861
const admin = useAdministrator();
62+
const selectedDeviceId = useSelector((state) => state.devices.selectedId);
5963

6064
const item = data[index];
6165
const position = useSelector((state) => state.session.positions[item.id]);
@@ -84,6 +88,8 @@ const DeviceRow = ({ data, index, style }) => {
8488
key={item.id}
8589
onClick={() => dispatch(devicesActions.selectId(item.id))}
8690
disabled={!admin && item.disabled}
91+
selected={selectedDeviceId === item.id}
92+
className={selectedDeviceId === item.id ? classes.selected : undefined}
8793
>
8894
<ListItemAvatar>
8995
<Avatar>

0 commit comments

Comments
 (0)