Add has-fab to hass-tabs-subpage (#25536)

This commit is contained in:
Wendelin 2025-05-20 13:00:27 +02:00 committed by GitHub
parent 4de95f6710
commit 9ec689382b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 45 additions and 30 deletions

View File

@ -3,15 +3,15 @@ import { css, html, LitElement, nothing } from "lit";
import { customElement, eventOptions, property, state } from "lit/decorators"; import { customElement, eventOptions, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map"; import { classMap } from "lit/directives/class-map";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
import { canShowPage } from "../common/config/can_show_page";
import { restoreScroll } from "../common/decorators/restore-scroll"; import { restoreScroll } from "../common/decorators/restore-scroll";
import type { LocalizeFunc } from "../common/translations/localize"; import type { LocalizeFunc } from "../common/translations/localize";
import "../components/ha-icon-button-arrow-prev"; import "../components/ha-icon-button-arrow-prev";
import "../components/ha-menu-button"; import "../components/ha-menu-button";
import "../components/ha-svg-icon"; import "../components/ha-svg-icon";
import "../components/ha-tab"; import "../components/ha-tab";
import type { HomeAssistant, Route } from "../types";
import { haStyleScrollbar } from "../resources/styles"; import { haStyleScrollbar } from "../resources/styles";
import { canShowPage } from "../common/config/can_show_page"; import type { HomeAssistant, Route } from "../types";
export interface PageNavigation { export interface PageNavigation {
path: string; path: string;
@ -52,6 +52,12 @@ class HassTabsSubpage extends LitElement {
@property({ type: Boolean }) public pane = false; @property({ type: Boolean }) public pane = false;
/**
* Do we need to add padding for a fab.
* @type {Boolean}
*/
@property({ type: Boolean, attribute: "has-fab" }) public hasFab = false;
@state() private _activeTab?: PageNavigation; @state() private _activeTab?: PageNavigation;
// @ts-ignore // @ts-ignore
@ -178,6 +184,7 @@ class HassTabsSubpage extends LitElement {
@scroll=${this._saveScrollPos} @scroll=${this._saveScrollPos}
> >
<slot></slot> <slot></slot>
${this.hasFab ? html`<div class="fab-bottom-space"></div>` : nothing}
</div> </div>
</div> </div>
<div id="fab" class=${classMap({ tabs: showTabs })}> <div id="fab" class=${classMap({ tabs: showTabs })}>
@ -336,6 +343,14 @@ class HassTabsSubpage extends LitElement {
); );
} }
.content .fab-bottom-space {
height: calc(64px + env(safe-area-inset-bottom));
}
:host([narrow]) .content.tabs .fab-bottom-space {
height: calc(80px + env(safe-area-inset-bottom));
}
#fab { #fab {
position: fixed; position: fixed;
right: calc(16px + env(safe-area-inset-right)); right: calc(16px + env(safe-area-inset-right));

View File

@ -148,6 +148,7 @@ export class HaConfigAreasDashboard extends LitElement {
back-path="/config" back-path="/config"
.tabs=${configSections.areas} .tabs=${configSections.areas}
.route=${this.route} .route=${this.route}
has-fab
> >
<ha-icon-button <ha-icon-button
slot="toolbar-icon" slot="toolbar-icon"

View File

@ -447,6 +447,7 @@ class HaConfigIntegrationsDashboard extends KeyboardShortcutMixin(
back-path="/config" back-path="/config"
.route=${this.route} .route=${this.route}
.tabs=${configSections.devices} .tabs=${configSections.devices}
has-fab
> >
${this.narrow ${this.narrow
? html` ? html`
@ -984,9 +985,6 @@ class HaConfigIntegrationsDashboard extends KeyboardShortcutMixin(
grid-gap: 8px 8px; grid-gap: 8px 8px;
padding: 8px 16px 16px; padding: 8px 16px 16px;
} }
.container:last-of-type {
margin-bottom: 64px;
}
.empty-message { .empty-message {
margin: auto; margin: auto;
text-align: center; text-align: center;

View File

@ -1,48 +1,48 @@
import "@material/mwc-button/mwc-button"; import "@material/mwc-button/mwc-button";
import { import {
mdiAlertCircle,
mdiCheckCircle,
mdiFolderMultipleOutline, mdiFolderMultipleOutline,
mdiLan, mdiLan,
mdiNetwork, mdiNetwork,
mdiPlus,
mdiPencil, mdiPencil,
mdiCheckCircle, mdiPlus,
mdiAlertCircle,
} from "@mdi/js"; } from "@mdi/js";
import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import type { ConfigEntry } from "../../../../../data/config_entries"; import "../../../../../components/buttons/ha-progress-button";
import { getConfigEntries } from "../../../../../data/config_entries"; import "../../../../../components/ha-alert";
import "../../../../../components/ha-card"; import "../../../../../components/ha-card";
import "../../../../../components/ha-fab"; import "../../../../../components/ha-fab";
import "../../../../../components/ha-icon-button";
import { fileDownload } from "../../../../../util/file_download";
import "../../../../../components/ha-icon-next";
import "../../../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
import "../../../ha-config-section";
import "../../../../../components/ha-form/ha-form"; import "../../../../../components/ha-form/ha-form";
import "../../../../../components/buttons/ha-progress-button"; import "../../../../../components/ha-icon-button";
import "../../../../../components/ha-icon-next";
import "../../../../../components/ha-settings-row"; import "../../../../../components/ha-settings-row";
import "../../../../../components/ha-svg-icon"; import "../../../../../components/ha-svg-icon";
import "../../../../../components/ha-alert"; import type { ConfigEntry } from "../../../../../data/config_entries";
import { showZHAChangeChannelDialog } from "./show-dialog-zha-change-channel"; import { getConfigEntries } from "../../../../../data/config_entries";
import type { import type {
ZHAConfiguration, ZHAConfiguration,
ZHANetworkSettings,
ZHANetworkBackupAndMetadata, ZHANetworkBackupAndMetadata,
ZHANetworkSettings,
} from "../../../../../data/zha"; } from "../../../../../data/zha";
import { import {
fetchZHAConfiguration,
updateZHAConfiguration,
fetchZHANetworkSettings,
createZHANetworkBackup, createZHANetworkBackup,
fetchDevices, fetchDevices,
fetchZHAConfiguration,
fetchZHANetworkSettings,
updateZHAConfiguration,
} from "../../../../../data/zha"; } from "../../../../../data/zha";
import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow";
import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"; import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box";
import "../../../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
import { fileDownload } from "../../../../../util/file_download";
import "../../../ha-config-section";
import { showZHAChangeChannelDialog } from "./show-dialog-zha-change-channel";
const MULTIPROTOCOL_ADDON_URL = "socket://core-silabs-multiprotocol:9999"; const MULTIPROTOCOL_ADDON_URL = "socket://core-silabs-multiprotocol:9999";
@ -108,6 +108,7 @@ class ZHAConfigDashboard extends LitElement {
.route=${this.route} .route=${this.route}
.tabs=${zhaTabs} .tabs=${zhaTabs}
back-path="/config/integrations" back-path="/config/integrations"
has-fab
> >
<ha-card class="content network-status"> <ha-card class="content network-status">
${this._error ${this._error

View File

@ -43,6 +43,7 @@ import {
subscribeZwaveControllerStatistics, subscribeZwaveControllerStatistics,
subscribeZwaveNVMBackup, subscribeZwaveNVMBackup,
} from "../../../../../data/zwave_js"; } from "../../../../../data/zwave_js";
import { showConfigFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-config-flow";
import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"; import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box";
import "../../../../../layouts/hass-tabs-subpage"; import "../../../../../layouts/hass-tabs-subpage";
import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin";
@ -53,7 +54,6 @@ import { showZWaveJSAddNodeDialog } from "./add-node/show-dialog-zwave_js-add-no
import { showZWaveJSRebuildNetworkRoutesDialog } from "./show-dialog-zwave_js-rebuild-network-routes"; import { showZWaveJSRebuildNetworkRoutesDialog } from "./show-dialog-zwave_js-rebuild-network-routes";
import { showZWaveJSRemoveNodeDialog } from "./show-dialog-zwave_js-remove-node"; import { showZWaveJSRemoveNodeDialog } from "./show-dialog-zwave_js-remove-node";
import { configTabs } from "./zwave_js-config-router"; import { configTabs } from "./zwave_js-config-router";
import { showConfigFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-config-flow";
@customElement("zwave_js-config-dashboard") @customElement("zwave_js-config-dashboard")
class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) {
@ -142,6 +142,7 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) {
.narrow=${this.narrow} .narrow=${this.narrow}
.route=${this.route} .route=${this.route}
.tabs=${configTabs} .tabs=${configTabs}
has-fab
> >
<ha-icon-button <ha-icon-button
slot="toolbar-icon" slot="toolbar-icon"

View File

@ -65,6 +65,7 @@ export class HaConfigPerson extends LitElement {
.route=${this.route} .route=${this.route}
back-path="/config" back-path="/config"
.tabs=${configSections.persons} .tabs=${configSections.persons}
has-fab
> >
<ha-config-section .isWide=${this.isWide}> <ha-config-section .isWide=${this.isWide}>
<span slot="header" <span slot="header"

View File

@ -238,6 +238,7 @@ export class HaConfigZone extends SubscribeMixin(LitElement) {
? undefined ? undefined
: "/config"} : "/config"}
.tabs=${configSections.areas} .tabs=${configSections.areas}
has-fab
> >
${this.narrow ${this.narrow
? html` ? html`
@ -581,9 +582,6 @@ export class HaConfigZone extends SubscribeMixin(LitElement) {
min-height: 100%; min-height: 100%;
box-sizing: border-box; box-sizing: border-box;
} }
ha-card {
margin-bottom: 100px;
}
ha-tooltip { ha-tooltip {
display: block; display: block;
} }