Compare commits

...
Author SHA1 Message Date
Bram KragtenandClaude Opus 5.5 fc760b9325 Move PageNavigation type to its own data module
PageNavigation is used far beyond the tabs subpage layout, so it now lives in
src/data/page_navigation.ts. No behavior change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-09 12:37:38 +02:00
24 changed files with 43 additions and 41 deletions

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
import type { PageNavigation } from "../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../data/page_navigation";
import type { HomeAssistant, HomeAssistantConfig } from "../../types";
import { ensureArray } from "../array/ensure-array";
import { isComponentLoaded } from "./is_component_loaded";
+1 -1
View File
@@ -1,4 +1,4 @@
import type { PageNavigation } from "../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../data/page_navigation";
import type { HomeAssistant } from "../../types";
import { canShowPage } from "./can_show_page";
+1 -1
View File
@@ -5,7 +5,7 @@ import "./ha-icon-next";
import "./ha-svg-icon";
import "./item/ha-list-item-button";
import "./list/ha-list-nav";
import type { PageNavigation } from "../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../data/page_navigation";
import type { HomeAssistant } from "../types";
@customElement("ha-config-navigation-list")
+20
View File
@@ -0,0 +1,20 @@
import type { HomeAssistant } from "../types";
export interface PageNavigation {
path: string;
translationKey?: string;
component?: string | string[];
name?: string;
core?: boolean;
/** Hide from non-admin users in filtered navigation and quick bar. */
adminOnly?: boolean;
iconPath?: string;
iconSecondaryPath?: string;
iconViewBox?: string;
description?: string;
iconColor?: string;
// Shown next to the name of the tab
badge?: string;
info?: any;
filter?: (hass: Pick<HomeAssistant, "entities">) => boolean;
}
+1 -1
View File
@@ -9,7 +9,7 @@ import {
mdiPlayBoxMultiple,
} from "@mdi/js";
import type { LocalizeKeys } from "../common/translations/localize";
import type { PageNavigation } from "../layouts/hass-tabs-subpage";
import type { PageNavigation } from "./page_navigation";
import type { HomeAssistant, PanelInfo } from "../types";
export const APP_PANEL = "app";
+1 -1
View File
@@ -12,7 +12,7 @@ import {
} from "../common/config/filter_navigation_pages";
import { isComponentLoaded } from "../common/config/is_component_loaded";
import type { PickerComboBoxItem } from "../components/ha-picker-combo-box";
import type { PageNavigation } from "../layouts/hass-tabs-subpage";
import type { PageNavigation } from "./page_navigation";
import { configSections } from "../panels/config/config-sections";
import type { FuseWeightedKey } from "../resources/fuseMultiTerm";
import type { HomeAssistant } from "../types";
+1 -1
View File
@@ -46,10 +46,10 @@ import {
entitiesContext,
internationalizationContext,
} from "../data/context";
import type { PageNavigation } from "../data/page_navigation";
import { KeyboardShortcutMixin } from "../mixins/keyboard-shortcut-mixin";
import type { HomeAssistant, Route } from "../types";
import "./hass-tabs-subpage";
import type { PageNavigation } from "./hass-tabs-subpage";
@customElement("hass-tabs-subpage-data-table")
export class HaTabsSubpageDataTable extends KeyboardShortcutMixin(LitElement) {
+1 -19
View File
@@ -29,6 +29,7 @@ import {
internationalizationContext,
narrowViewportContext,
} from "../data/context";
import type { PageNavigation } from "../data/page_navigation";
import { haStyleScrollbar } from "../resources/styles";
import type { HomeAssistant, Route } from "../types";
@@ -37,25 +38,6 @@ const normalizePathname = (pathname: string): string =>
? pathname.slice(0, -1)
: pathname;
export interface PageNavigation {
path: string;
translationKey?: string;
component?: string | string[];
name?: string;
core?: boolean;
/** Hide from non-admin users in filtered navigation and quick bar. */
adminOnly?: boolean;
iconPath?: string;
iconSecondaryPath?: string;
iconViewBox?: string;
description?: string;
iconColor?: string;
// Shown next to the name of the tab
badge?: string;
info?: any;
filter?: (hass: Pick<HomeAssistant, "entities">) => boolean;
}
@customElement("hass-tabs-subpage")
export class HassTabsSubpage extends LitElement {
// Unread, kept for callers that still pass it until they move to contexts
@@ -22,7 +22,7 @@ import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box
import "../../../layouts/hass-error-screen";
import "../../../layouts/hass-loading-screen";
import "../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../data/page_navigation";
import { haStyle } from "../../../resources/styles";
import type { HomeAssistant, Route } from "../../../types";
+1 -1
View File
@@ -41,7 +41,7 @@ import {
mdiZWave,
} from "@mdi/js";
import memoizeOne from "memoize-one";
import type { PageNavigation } from "../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../data/page_navigation";
import type { HomeAssistant } from "../../types";
import { mdiMqttLogo } from "../../resources/mqtt-logo-svg";
@@ -36,7 +36,7 @@ import {
import { showQuickBar } from "../../../dialogs/quick-bar/show-dialog-quick-bar";
import { showRestartDialog } from "../../../dialogs/restart/show-dialog-restart";
import { showShortcutsDialog } from "../../../dialogs/shortcuts/show-shortcuts-dialog";
import type { PageNavigation } from "../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../data/page_navigation";
import { ChildPanelReady } from "../../../layouts/panel-ready";
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
import { haStyle } from "../../../resources/styles";
@@ -8,7 +8,7 @@ import "../../../components/ha-card";
import "../../../components/ha-icon-next";
import type { CloudStatus } from "../../../data/cloud";
import { getConfigEntries } from "../../../data/config_entries";
import type { PageNavigation } from "../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../data/page_navigation";
import {
childPanelReadyContext,
type RegisterChildPanelReady,
+1 -1
View File
@@ -38,7 +38,7 @@ import "./components/ha-energy-gas-settings";
import "./components/ha-energy-water-settings";
import { fileDownload } from "../../../util/file_download";
import { showToast } from "../../../util/toast";
import type { PageNavigation } from "../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../data/page_navigation";
import { showEnergyCustomiseDialog } from "./dialogs/show-dialog-energy-customise";
const INITIAL_CONFIG: EnergyPreferences = {
@@ -3,7 +3,7 @@ import { customElement, property } from "lit/decorators";
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
import type { RouterOptions } from "../../../layouts/hass-router-page";
import { HassRouterPage } from "../../../layouts/hass-router-page";
import type { PageNavigation } from "../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../data/page_navigation";
import type { HomeAssistant } from "../../../types";
export const hardwareTabs = (hass: HomeAssistant): PageNavigation[] => {
@@ -24,7 +24,7 @@ import {
} from "../../../../../data/bluetooth";
import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry";
import "../../../../../layouts/hass-tabs-subpage-data-table";
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../../../data/page_navigation";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
import { showBluetoothDeviceInfoDialog } from "./show-dialog-bluetooth-device-info";
@@ -21,7 +21,7 @@ import {
} from "../../../../../data/bluetooth";
import type { DeviceRegistryEntry } from "../../../../../data/device/device_registry";
import "../../../../../layouts/hass-tabs-subpage-data-table";
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../../../data/page_navigation";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
@@ -13,7 +13,7 @@ import "../../../../../components/ha-icon-button";
import "../../../../../components/ha-relative-time";
import type { InfraredDevice } from "../../../../../data/infrared";
import "../../../../../layouts/hass-tabs-subpage-data-table";
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../../../data/page_navigation";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
@@ -17,7 +17,7 @@ import {
type RadioFrequencyTransmitter,
} from "../../../../../data/radio_frequency";
import "../../../../../layouts/hass-tabs-subpage-data-table";
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../../../data/page_navigation";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
@@ -19,7 +19,7 @@ import { fetchZHADevice } from "../../../../../data/zha";
import "../../../../../layouts/hass-error-screen";
import "../../../../../layouts/hass-subpage";
import "../../../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../../../data/page_navigation";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
import "./device-page/zha-device-bindings-pane";
@@ -14,7 +14,7 @@ import "../../../../../components/ha-button";
import "../../../../../components/ha-icon-button";
import type { ZHAGroup } from "../../../../../data/zha";
import { fetchGroups } from "../../../../../data/zha";
import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../../../data/page_navigation";
import "../../../../../layouts/hass-tabs-subpage-data-table";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
@@ -44,7 +44,7 @@ import type { HaIconButton } from "../../../components/ha-icon-button";
import type { LocalizeFunc } from "../../../common/translations/localize";
import "../../../components/ha-svg-icon";
import type { PageNavigation } from "../../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../data/page_navigation";
import type { HomeAssistantUI, Route } from "../../../types";
import { showMarketplaceAddFromLink } from "../tools/add-from-link";
import "../components/ha-marketplace-discover";
+1 -1
View File
@@ -12,7 +12,7 @@ import "./ha-pick-theme-row";
import { isExternal } from "../../data/external";
import { showConfirmationDialog } from "../../dialogs/generic/show-dialog-box";
import "../../layouts/hass-subpage";
import type { PageNavigation } from "../../layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../data/page_navigation";
import { haStyle } from "../../resources/styles";
import type { HomeAssistant, Route } from "../../types";
import { showEditProfileDialog } from "./show-dialog-edit-profile";
+1 -1
View File
@@ -4,7 +4,7 @@ import {
isLoadedIntegration,
isCore,
} from "../../../src/common/config/can_show_page";
import type { PageNavigation } from "../../../src/layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../../src/data/page_navigation";
import type { HomeAssistant } from "../../../src/types";
describe("canShowPage", () => {
+1 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { getConfigSubpageTitle } from "../../src/data/panel";
import type { PageNavigation } from "../../src/layouts/hass-tabs-subpage";
import type { PageNavigation } from "../../src/data/page_navigation";
import type { HomeAssistant } from "../../src/types";
const translations: Record<string, string> = {