Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion front/src/components/boxs/device-in-room/DeviceCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const DeviceCard = ({ children, ...props }) => {
<div>
<div class="loader py-3" />
<div class="table-responsive">
<table class="table card-table table-vcenter">
<table class={`table card-table table-vcenter ${style.deviceFeaturesTable}`}>
<tbody>
{loading
? placeholderRows.map((_, index) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Text } from 'preact-i18n';

import style from '../style.css';

// A text state is displayed raw, except when the feature declares supported_options
// (a read-only dynamic select): the matching option's label replaces the technical
// identifier the device reports ('Netflix' instead of 'com.netflix.app')
Expand All @@ -10,7 +12,7 @@ const displayValue = deviceFeature => {
};

const RawDeviceValue = ({ deviceFeature }) => (
<div>
<div class={style.textValue}>
Comment thread
cursor[bot] marked this conversation as resolved.
{deviceFeature.last_value_string === null && <Text id="dashboard.boxes.devicesInRoom.noValue" />}
{deviceFeature.last_value_string !== null && <span>{displayValue(deviceFeature)}</span>}
</div>
Expand Down
13 changes: 13 additions & 0 deletions front/src/components/boxs/device-in-room/device-features/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,16 @@ input[type='range'][class~='light-temperature']::-ms-fill-lower {
.rangeInput {
flex: 1;
}

/* A text feature holds free-form content the device decides: a Zigbee integration can
publish a comma-separated list of device names, which offers no space to break on.
The card table is laid out automatically, so such a value keeps its column at its
full one-line width, the table grows past the card and the other feature values are
pushed out of the visible area — the narrower the card, the sooner it happens (a
3-column dashboard layout is enough). `anywhere` is the value that also lowers the
cell's min-content width, which is what lets the column shrink back into the card;
`break-word` wraps but leaves the intrinsic width untouched, so the table would
still overflow. Same idiom as the external integration texts and the chart tooltips. */
.textValue {
overflow-wrap: anywhere;
Comment thread
cursor[bot] marked this conversation as resolved.
}
22 changes: 22 additions & 0 deletions front/src/components/boxs/device-in-room/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,25 @@
background-position-x: -200%;
}
}

/* The card lays its features out in an automatically sized `table.card-table` inside a
`.table-responsive` wrapper. An auto table can never be narrower than the sum of its
columns' min-content widths: as soon as that sum exceeds the card, the wrapper starts
scrolling horizontally and the values on the right drop out of sight — which is the
#2917 symptom (the narrower the card, the sooner it happens). Wrapping a single value
is not enough; every column has to stay able to shrink.

The name cell is the main offender: a label such as
"Compteur électrique index - Consommation 30 minutes" holds its column open. `anywhere`
is deliberate rather than `break-word` — only `anywhere` also lowers the cell's
min-content width, which is what actually lets the column shrink back into the card. */
.deviceFeaturesTable td:nth-child(2) {
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
overflow-wrap: anywhere;
}

/* Tabler renders every sensor value badge with `white-space: nowrap`, so a label like
"Pas de valeur récente" counts as one unbreakable word and sets a floor of its full
width on the value column. Letting it wrap drops that floor to its longest word. */
.deviceFeaturesTable :global(.badge) {
white-space: normal;
}
Loading