Skip to content

Commit

Permalink
Dashboard: Display device values only on one line (#928)
Browse files Browse the repository at this point in the history
Fixes #925

Co-authored-by: Pierre-Gilles Leymarie <pierregilles.leymarie@gmail.com>
  • Loading branch information
atrovato and Pierre-Gilles authored Nov 11, 2020
1 parent e837997 commit 765461e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Text } from 'preact-i18n';
import get from 'get-value';
import cx from 'classnames';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';

Expand All @@ -23,7 +24,7 @@ const SensorDeviceType = ({ children, ...props }) => (
</td>
<td>{props.deviceFeature.name}</td>
{SPECIAL_SENSORS.indexOf(props.deviceFeature.category) === -1 && (
<td class="text-right">
<td class={cx('text-right', { 'text-nowrap': props.deviceFeature.last_value !== null })}>
{props.deviceFeature.last_value !== null && props.deviceFeature.last_value}
{props.deviceFeature.last_value === null && <Text id="dashboard.boxes.devicesInRoom.noValue" />}
{props.deviceFeature.last_value !== null && (
Expand Down Expand Up @@ -51,7 +52,7 @@ const SensorDeviceType = ({ children, ...props }) => (
</td>
)}
{props.deviceFeature.category === DEVICE_FEATURE_CATEGORIES.MOTION_SENSOR && (
<td class="text-right">
<td class={cx('text-right', { 'text-nowrap': props.deviceFeature.last_value_changed })}>
{!props.deviceFeature.last_value_changed && <Text id="dashboard.boxes.devicesInRoom.noValue" />}
{props.deviceFeature.last_value_changed &&
dayjs(props.deviceFeature.last_value_changed)
Expand Down

0 comments on commit 765461e

Please sign in to comment.