diff --git a/front/src/components/boxs/device-in-room/device-features/sensor-value/MotionSensorDeviceValue.jsx b/front/src/components/boxs/device-in-room/device-features/sensor-value/MotionSensorDeviceValue.jsx new file mode 100644 index 0000000000..0148a384dc --- /dev/null +++ b/front/src/components/boxs/device-in-room/device-features/sensor-value/MotionSensorDeviceValue.jsx @@ -0,0 +1,20 @@ +import { Text } from 'preact-i18n'; + +import RelativeTime from '../../../../device/RelativeTime'; + +const MotionSensorDeviceValue = ({ deviceFeature, user }) => { + const { last_value: lastValue, last_value_changed: lastValueChanged } = deviceFeature; + if (lastValue) { + return ( + + + + ); + } else if (lastValueChanged) { + return ; + } + + return ; +}; + +export default MotionSensorDeviceValue; diff --git a/front/src/components/boxs/device-in-room/device-features/sensor-value/SensorDeviceFeature.jsx b/front/src/components/boxs/device-in-room/device-features/sensor-value/SensorDeviceFeature.jsx index c71c33f6d8..236ea98820 100644 --- a/front/src/components/boxs/device-in-room/device-features/sensor-value/SensorDeviceFeature.jsx +++ b/front/src/components/boxs/device-in-room/device-features/sensor-value/SensorDeviceFeature.jsx @@ -6,6 +6,7 @@ import { DeviceFeatureCategoriesIcon } from '../../../../../utils/consts'; import BinaryDeviceValue from './BinaryDeviceValue'; import LastSeenDeviceValue from './LastSeenDeviceValue'; +import MotionSensorDeviceValue from './MotionSensorDeviceValue'; import BadgeNumberDeviceValue from './BadgeNumberDeviceValue'; import IconBinaryDeviceValue from './IconBinaryDeviceValue'; import SignalQualityDeviceValue from './SignalQualityDeviceValue'; @@ -14,7 +15,7 @@ import TextDeviceValue from './TextDeviceValue'; import NoRecentValueBadge from './NoRecentValueBadge'; const DISPLAY_BY_FEATURE_CATEGORY = { - [DEVICE_FEATURE_CATEGORIES.MOTION_SENSOR]: LastSeenDeviceValue, + [DEVICE_FEATURE_CATEGORIES.MOTION_SENSOR]: MotionSensorDeviceValue, [DEVICE_FEATURE_CATEGORIES.PRESENCE_SENSOR]: LastSeenDeviceValue, [DEVICE_FEATURE_CATEGORIES.OPENING_SENSOR]: IconBinaryDeviceValue, [DEVICE_FEATURE_CATEGORIES.SIGNAL]: SignalQualityDeviceValue, diff --git a/front/src/config/i18n/de.json b/front/src/config/i18n/de.json index beef13dd4e..b7375ba46c 100644 --- a/front/src/config/i18n/de.json +++ b/front/src/config/i18n/de.json @@ -280,7 +280,8 @@ "noRecentValue": "Kein aktueller Wert", "deviceTitle": "{{name}} - {{type}}", "addButton": "+", - "substractButton": "-" + "substractButton": "-", + "motionDetected": "Bewegung erkannt" }, "devices": { "editDeviceFeaturesLabel": "Wähle die Geräte aus, die du anzeigen möchtest:", diff --git a/front/src/config/i18n/en.json b/front/src/config/i18n/en.json index 00576bbfbc..b3becee806 100644 --- a/front/src/config/i18n/en.json +++ b/front/src/config/i18n/en.json @@ -280,7 +280,8 @@ "noRecentValue": "No recent value", "deviceTitle": "{{name}} - {{type}}", "addButton": "+", - "substractButton": "-" + "substractButton": "-", + "motionDetected": "Motion detected" }, "devices": { "editDeviceFeaturesLabel": "Select the devices you want to display:", diff --git a/front/src/config/i18n/fr.json b/front/src/config/i18n/fr.json index 87c227e013..5310233f93 100644 --- a/front/src/config/i18n/fr.json +++ b/front/src/config/i18n/fr.json @@ -280,7 +280,8 @@ "noRecentValue": "Pas de valeur récente", "deviceTitle": "{{name}} - {{type}}", "addButton": "+", - "substractButton": "-" + "substractButton": "-", + "motionDetected": "Mouvement détecté" }, "devices": { "editDeviceFeaturesLabel": "Vous pouvez modifier le nom affiché ici :",