From c434422a9216fd0793d896c7ac271206262c4e38 Mon Sep 17 00:00:00 2001 From: Luiz Kill Date: Sat, 30 Jul 2022 11:38:38 -0300 Subject: Adds a draggable status card to the modern interface --- modern/src/main/StatusCard.js | 161 +++++++++++++++++++++++------------------- 1 file changed, 87 insertions(+), 74 deletions(-) (limited to 'modern/src/main') diff --git a/modern/src/main/StatusCard.js b/modern/src/main/StatusCard.js index 373b02ab..852b7cc6 100644 --- a/modern/src/main/StatusCard.js +++ b/modern/src/main/StatusCard.js @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useNavigate } from 'react-router-dom'; +import Draggable from 'react-draggable'; import { Card, CardContent, @@ -155,82 +156,94 @@ const StatusCard = ({ deviceId, onClose }) => { return ( <> {device && ( - - {deviceImage ? ( - - - + + + {deviceImage ? ( + + + + + + ) : ( +
+ + {device.name} + + + + +
+ )} + {position && ( + + + + {positionItems.filter((key) => position.hasOwnProperty(key) || position.attributes.hasOwnProperty(key)).map((key) => ( + + )} + /> + ))} + +
+
+ )} + + setAnchorEl(e.currentTarget)} + disabled={!position} + > + -
- ) : ( -
- - {device.name} - - - + navigate('/replay')} + disabled={!position} + > + -
- )} - {position && ( - - - - {positionItems.filter((key) => position.hasOwnProperty(key) || position.attributes.hasOwnProperty(key)).map((key) => ( - - )} - /> - ))} - -
-
- )} - - setAnchorEl(e.currentTarget)} - disabled={!position} - > - - - navigate('/replay')} - disabled={!position} - > - - - navigate(`/settings/command-send/${deviceId}`)} - disabled={readonly} - > - - - navigate(`/settings/device/${deviceId}`)} - disabled={deviceReadonly} - > - - - setRemoving(true)} - disabled={deviceReadonly} - className={classes.negative} - > - - - -
+ navigate(`/settings/command-send/${deviceId}`)} + disabled={readonly} + > + + + navigate(`/settings/device/${deviceId}`)} + disabled={deviceReadonly} + > + + + setRemoving(true)} + disabled={deviceReadonly} + className={classes.negative} + > + + + + + )} {position && ( setAnchorEl(null)}> -- cgit v1.2.3