Skip to content

Commit a450757

Browse files
authored
Merge pull request #3288 from bobleer/bob/device-status-layout
fix(web-ui): keep device status content visible across platforms
2 parents deeac13 + a71e4f7 commit a450757

3 files changed

Lines changed: 48 additions & 50 deletions

File tree

‎src/web-ui/src/app/components/NavPanel/NavPanel.scss‎

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,6 @@ $_section-header-height: 22px;
16231623
position: fixed;
16241624
z-index: var(--openbitfun-layer-popover);
16251625
width: min(340px, calc(100vw - 16px));
1626-
aspect-ratio: 1.41 / 1;
16271626
min-height: 0;
16281627
max-height: calc(100vh - 16px);
16291628
display: flex;
@@ -1633,7 +1632,8 @@ $_section-header-height: 22px;
16331632
}
16341633

16351634
.openbitfun-device-overview__scroll {
1636-
display: grid;
1635+
// Natural content height in both WebKit and Chromium; shrink only at the viewport limit.
1636+
display: block;
16371637
min-height: 0;
16381638
flex: 1 1 auto;
16391639
}
@@ -1768,8 +1768,8 @@ $_section-header-height: 22px;
17681768
}
17691769

17701770
.openbitfun-device-overview__notice {
1771-
width: calc(100% - var(--openbitfun-space-5) * 2);
1772-
margin: 0 var(--openbitfun-space-5) var(--openbitfun-space-4);
1771+
width: calc(100% - var(--openbitfun-space-4) * 2);
1772+
margin: var(--openbitfun-space-3) var(--openbitfun-space-4) 0;
17731773
height: auto;
17741774
min-height: var(--openbitfun-control-height-sm);
17751775
justify-content: flex-start;
@@ -1782,7 +1782,7 @@ $_section-header-height: 22px;
17821782
flex-direction: column;
17831783
flex-shrink: 0;
17841784
gap: var(--openbitfun-space-2);
1785-
padding: var(--openbitfun-space-2) var(--openbitfun-space-4) var(--openbitfun-space-3);
1785+
padding: var(--openbitfun-space-3) var(--openbitfun-space-4) var(--openbitfun-space-4);
17861786
}
17871787

17881788
.openbitfun-device-overview__action {
@@ -1797,7 +1797,7 @@ $_section-header-height: 22px;
17971797

17981798
.openbitfun-device-overview__header {
17991799
flex-shrink: 0;
1800-
padding: var(--openbitfun-space-3) var(--openbitfun-space-4) var(--openbitfun-space-1);
1800+
padding: var(--openbitfun-space-4) var(--openbitfun-space-4) var(--openbitfun-space-3);
18011801

18021802
.openbitfun-device-overview__title {
18031803
color: var(--openbitfun-color-content-primary);
@@ -1812,20 +1812,20 @@ $_section-header-height: 22px;
18121812

18131813
.openbitfun-device-overview__body {
18141814
min-width: 0;
1815-
// Fill the scroll viewport and balance spare height above and below the
1816-
// device, rather than leaving all of it between the status and the footer.
1817-
justify-content: center;
1815+
// Keep every section in normal flow so additional controllers cannot squeeze
1816+
// the carousel and clip its name/status inside the horizontal viewport.
1817+
display: block;
18181818
}
18191819

18201820
.openbitfun-device-overview__summary {
18211821
position: relative;
18221822
display: grid;
18231823
min-width: 0;
1824+
row-gap: var(--openbitfun-space-2);
18241825
text-align: center;
18251826
}
18261827

18271828
.openbitfun-device-overview__carousel-viewport {
1828-
grid-area: 1 / 1;
18291829
min-width: 0;
18301830
overflow: hidden;
18311831
width: 100%;
@@ -1842,6 +1842,7 @@ $_section-header-height: 22px;
18421842
display: flex;
18431843
flex-direction: column;
18441844
align-items: center;
1845+
gap: var(--openbitfun-space-2);
18451846
}
18461847

18471848
.openbitfun-device-overview__device-switcher {
@@ -1853,6 +1854,8 @@ $_section-header-height: 22px;
18531854
.openbitfun-device-overview__carousel-controls {
18541855
position: absolute;
18551856
inset: 0 0 auto;
1857+
width: 100%;
1858+
box-sizing: border-box;
18561859
aspect-ratio: 3.25 / 1;
18571860
display: flex;
18581861
align-items: center;
@@ -1867,17 +1870,26 @@ $_section-header-height: 22px;
18671870
.openbitfun-device-overview__carousel-track { transition: none; }
18681871
}
18691872

1870-
// A preview's activity line is empty, so the connection action shares that slot
1871-
// below the device name. Reserve its height in the activity line to keep browsing
1872-
// stable without adding an empty action row to the compact card.
1873+
// Status and connection action share a dedicated row below the carousel.
1874+
// Its natural height accommodates wrapped activity and compatibility messages.
18731875
.openbitfun-device-overview__connect-action {
1874-
grid-area: 1 / 1;
1875-
align-self: end;
18761876
min-width: 0;
1877-
display: flex;
1878-
align-items: center;
1879-
justify-content: center;
1877+
display: grid;
1878+
place-items: center;
18801879
padding-inline: var(--openbitfun-space-4);
1880+
1881+
> button,
1882+
> .openbitfun-device-overview__activity {
1883+
grid-area: 1 / 1;
1884+
max-width: 100%;
1885+
}
1886+
1887+
> button {
1888+
height: auto;
1889+
min-height: var(--openbitfun-control-height-sm);
1890+
white-space: normal;
1891+
overflow-wrap: anywhere;
1892+
}
18811893
}
18821894

18831895
.openbitfun-device-overview__connect-reserved {
@@ -1942,33 +1954,26 @@ $_section-header-height: 22px;
19421954
}
19431955

19441956
.openbitfun-device-overview__device-name {
1945-
max-width: 100%;
1957+
width: 100%;
1958+
min-width: 0;
19461959
box-sizing: border-box;
1947-
padding-inline: var(--openbitfun-space-5);
1960+
padding-inline: var(--openbitfun-space-4);
19481961
color: var(--openbitfun-color-content-secondary);
19491962
font-family: var(--openbitfun-type-label-md-font-family);
19501963
font-size: var(--openbitfun-type-meta-font-size);
19511964
line-height: var(--openbitfun-type-body-sm-line-height);
1952-
overflow: hidden;
1953-
text-overflow: ellipsis;
1954-
white-space: nowrap;
19551965
}
19561966

19571967
.openbitfun-device-overview__activity {
1958-
min-height: var(--openbitfun-control-height-sm);
1959-
max-width: 100%;
19601968
box-sizing: border-box;
1961-
padding: var(--openbitfun-space-1) var(--openbitfun-space-5) 0;
19621969
color: var(--openbitfun-color-content-muted);
19631970
font-size: var(--openbitfun-type-meta-font-size);
19641971
line-height: var(--openbitfun-type-body-sm-line-height);
1965-
overflow: hidden;
1966-
text-overflow: ellipsis;
1967-
white-space: nowrap;
1972+
overflow-wrap: anywhere;
19681973
}
19691974

19701975
.openbitfun-device-overview__device-group {
1971-
margin: 0 var(--openbitfun-space-5) var(--openbitfun-space-4);
1976+
margin: 0 var(--openbitfun-space-4) var(--openbitfun-space-3);
19721977

19731978
h3 {
19741979
margin: 0 6px 7px;
@@ -1982,7 +1987,7 @@ $_section-header-height: 22px;
19821987
.openbitfun-device-overview__device-rows {
19831988
display: flex;
19841989
flex-direction: column;
1985-
gap: 4px;
1990+
gap: var(--openbitfun-space-2);
19861991
}
19871992

19881993
.openbitfun-device-overview__device-row {
@@ -1992,7 +1997,7 @@ $_section-header-height: 22px;
19921997
column-gap: var(--openbitfun-space-2);
19931998
row-gap: var(--openbitfun-space-1);
19941999
min-height: 42px;
1995-
padding: 4px 6px;
2000+
padding: var(--openbitfun-space-1) 0;
19962001
border-radius: var(--openbitfun-radius-sm);
19972002

19982003
&[data-openbitfun-device-kind='message-app'] .openbitfun-device-overview__device-icon {

‎src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ describe('device status card', () => {
330330
state.overview = overview({ localDeviceName: name });
331331
render();
332332
expect(element('nav-device-status-summary').querySelector('.openbitfun-device-overview__device-name')?.textContent).toBe(name);
333-
expect(element('nav-device-status-summary').querySelector('[title]')?.getAttribute('title')).toBe(name);
333+
expect(element('nav-device-status-summary').querySelector('.openbitfun-device-overview__device-name')?.getAttribute('data-overflow-text')).toBe(name);
334334
expect(element('nav-footer-device-status').getAttribute('aria-label')).toContain(name);
335335
});
336336

‎src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.tsx‎

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -499,31 +499,24 @@ const DeviceStatusControl: React.FC<DeviceStatusControlProps> = ({
499499
<div className="openbitfun-device-overview__device-switcher">
500500
<DeviceArtwork device={device} />
501501
</div>
502-
<span className="openbitfun-device-overview__device-name" title={device.name}>
502+
<OverflowText className="openbitfun-device-overview__device-name" title={device.name}>
503503
{device.name}
504-
</span>
505-
<span className="openbitfun-device-overview__activity">
506-
{index === previewIndex && !isPreviewing
507-
? (previewIncompatible ? previewIncompatibleNotice : deviceActivity(overview.primaryDevice))
508-
: '\u00a0'}
509-
</span>
504+
</OverflowText>
510505
</div>
511506
);
512507
})}
513508
</div>
514509
</div>
515-
{/* One control in every state, not one control per state: this
516-
machine, a connectable peer, and a rejected peer all render
517-
the same button, so the card keeps one height and cannot
518-
resize while the user browses devices. Only the label text
519-
and the interaction attributes differ, which also keeps the
520-
row equal at any density, theme, or font size.
521-
Below the artwork rather than on top of it: the system mark is
522-
centred on the screen, so an action centred there hides exactly
523-
the part that says which system this device runs. Outside the
524-
track it also stops sliding with the carousel. */}
510+
{/* Reserve one action row when showing current-device status so
511+
browsing peers keeps the artwork and name in place. */}
525512
<div className="openbitfun-device-overview__connect-action">
513+
{!isPreviewing && (
514+
<span className="openbitfun-device-overview__activity">
515+
{previewIncompatible ? previewIncompatibleNotice : deviceActivity(overview.primaryDevice)}
516+
</span>
517+
)}
526518
<Button
519+
labelBehavior="static"
527520
variant="outline"
528521
size="sm"
529522
// A device cannot connect to itself, so this machine's button

0 commit comments

Comments
 (0)