Skip to content

Commit 3ab6e38

Browse files
authored
Fixes dahsboard tab bar on mobile (home-assistant#26690)
* Don't show toolbar in desktop * Fix tab bar height * Fix tab bar height * rename to Add person * Fix title * Fix key
1 parent 9cc85bc commit 3ab6e38

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

src/panels/lovelace/hui-root.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class HUIRoot extends LitElement {
230230
},
231231
{
232232
icon: mdiAccount,
233-
key: "ui.panel.lovelace.menu.invite_person",
233+
key: "ui.panel.lovelace.menu.add_person",
234234
visible: true,
235235
action: this._handleInvitePerson,
236236
},
@@ -458,7 +458,8 @@ class HUIRoot extends LitElement {
458458

459459
const isSubview = curViewConfig?.subview;
460460
const hasTabViews = views.filter((view) => !view.subview).length > 1;
461-
const showTabBar = this._editMode || (!isSubview && hasTabViews);
461+
const showTabBar =
462+
this._editMode || (!isSubview && hasTabViews && this.narrow);
462463

463464
return html`
464465
<div
@@ -514,7 +515,7 @@ class HUIRoot extends LitElement {
514515
`}
515516
</div>
516517
${showTabBar
517-
? html`<div class="edit-tab-bar">
518+
? html`<div class="tab-bar">
518519
${tabs}
519520
${this._editMode
520521
? html`<ha-icon-button
@@ -1277,7 +1278,7 @@ class HUIRoot extends LitElement {
12771278
.edit-mode div[main-title] {
12781279
pointer-events: auto;
12791280
}
1280-
.edit-tab-bar {
1281+
.tab-bar {
12811282
display: flex;
12821283
}
12831284
.edit-mode sl-tab-group {
@@ -1287,7 +1288,8 @@ class HUIRoot extends LitElement {
12871288
--ha-tab-indicator-color: var(--app-header-edit-text-color, #fff);
12881289
}
12891290
sl-tab {
1290-
height: calc(var(--header-height, 56px) - 2px);
1291+
--sl-tab-height: var(--header-height, 56px);
1292+
height: calc(var(--sl-tab-height) - 2px);
12911293
}
12921294
sl-tab[aria-selected="true"] .edit-icon {
12931295
display: inline-flex;
@@ -1303,15 +1305,19 @@ class HUIRoot extends LitElement {
13031305
);
13041306
}
13051307
sl-tab::part(base) {
1306-
padding-top: calc((var(--header-height) - 20px) / 2);
1307-
padding-bottom: calc((var(--header-height) - 20px) / 2 - 2px);
1308+
padding-top: calc((var(--sl-tab-height) - 20px) / 2);
1309+
padding-bottom: calc((var(--sl-tab-height) - 20px) / 2 - 2px);
13081310
}
13091311
sl-tab.icon::part(base) {
1310-
padding-top: calc((var(--header-height) - 20px) / 2 - 2px);
1311-
padding-bottom: calc((var(--header-height) - 20px) / 2 - 4px);
1312+
padding-top: calc((var(--sl-tab-height) - 20px) / 2 - 2px);
1313+
padding-bottom: calc((var(--sl-tab-height) - 20px) / 2 - 4px);
1314+
}
1315+
.tab-bar sl-tab {
1316+
--sl-tab-height: var(--tab-bar-height, 56px);
13121317
}
13131318
.edit-mode sl-tab[aria-selected="true"]::part(base) {
1314-
padding: 4px 0 2px 0;
1319+
padding: 0;
1320+
margin-top: calc((var(--tab-bar-height, 56px) - 48px) / 2);
13151321
}
13161322
.edit-icon {
13171323
color: var(--accent-color);
@@ -1359,7 +1365,8 @@ class HUIRoot extends LitElement {
13591365
*/
13601366
hui-view-container.has-tab-bar {
13611367
padding-top: calc(
1362-
var(--header-height) + calc(var(--header-height, 56px) - 2px) +
1368+
var(--header-height, 56px) +
1369+
calc(var(--tab-bar-height, 56px) - 2px) +
13631370
var(--safe-area-inset-top)
13641371
);
13651372
}

src/translations/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6990,7 +6990,7 @@
69906990
"add_area_action": "View area",
69916991
"add_person_success": "Person added",
69926992
"add_person_action": "View persons",
6993-
"invite_person": "Invite person"
6993+
"add_person": "Add person"
69946994
},
69956995
"reload_resources": {
69966996
"refresh_header": "Do you want to refresh?",

0 commit comments

Comments
 (0)