mirror of
https://github.com/home-assistant/frontend.git
synced 2026-04-02 00:27:49 +01:00
Remove quick links, focus on summary enable/disable only
https://claude.ai/code/session_01AqgbQULH5vfETibiba5RXH
This commit is contained in:
@@ -17,17 +17,10 @@ export interface CoreFrontendSystemData {
|
||||
onboarded_date?: string;
|
||||
}
|
||||
|
||||
export interface HomeQuickLink {
|
||||
name: string;
|
||||
icon?: string;
|
||||
navigation_path: string;
|
||||
}
|
||||
|
||||
export interface HomeFrontendSystemData {
|
||||
favorite_entities?: string[];
|
||||
welcome_banner_dismissed?: boolean;
|
||||
hidden_summaries?: string[];
|
||||
quick_links?: HomeQuickLink[];
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
||||
@@ -1,23 +1,13 @@
|
||||
import { mdiClose, mdiPlus } from "@mdi/js";
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { repeat } from "lit/directives/repeat";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import "../../../components/entity/ha-entities-picker";
|
||||
import "../../../components/ha-alert";
|
||||
import "../../../components/ha-button";
|
||||
import "../../../components/ha-dialog-footer";
|
||||
import "../../../components/ha-dialog";
|
||||
import "../../../components/ha-icon-button";
|
||||
import "../../../components/ha-icon-picker";
|
||||
import "../../../components/ha-navigation-picker";
|
||||
import "../../../components/ha-svg-icon";
|
||||
import "../../../components/ha-switch";
|
||||
import "../../../components/ha-textfield";
|
||||
import type {
|
||||
HomeFrontendSystemData,
|
||||
HomeQuickLink,
|
||||
} from "../../../data/frontend";
|
||||
import type { HomeFrontendSystemData } from "../../../data/frontend";
|
||||
import type { HassDialog } from "../../../dialogs/make-dialog-manager";
|
||||
import {
|
||||
HOME_SUMMARIES,
|
||||
@@ -69,7 +59,6 @@ export class DialogEditHome
|
||||
}
|
||||
|
||||
const hiddenSummaries = new Set(this._config?.hidden_summaries || []);
|
||||
const quickLinks = this._config?.quick_links || [];
|
||||
|
||||
return html`
|
||||
<ha-dialog
|
||||
@@ -122,66 +111,6 @@ export class DialogEditHome
|
||||
})}
|
||||
</div>
|
||||
|
||||
<h3 class="section-header">
|
||||
${this.hass.localize("ui.panel.home.editor.quick_links")}
|
||||
</h3>
|
||||
<p class="section-description">
|
||||
${this.hass.localize("ui.panel.home.editor.quick_links_description")}
|
||||
</p>
|
||||
<div class="quick-links">
|
||||
${repeat(
|
||||
quickLinks,
|
||||
(_link, index) => index,
|
||||
(link, index) => html`
|
||||
<div class="quick-link-row">
|
||||
<ha-icon-picker
|
||||
.hass=${this.hass}
|
||||
.value=${link.icon || ""}
|
||||
.label=${this.hass.localize(
|
||||
"ui.panel.home.editor.quick_link_icon"
|
||||
)}
|
||||
@value-changed=${(ev: CustomEvent) =>
|
||||
this._quickLinkChanged(index, "icon", ev.detail.value)}
|
||||
></ha-icon-picker>
|
||||
<ha-textfield
|
||||
.value=${link.name}
|
||||
.label=${this.hass.localize(
|
||||
"ui.panel.home.editor.quick_link_name"
|
||||
)}
|
||||
@input=${(ev: InputEvent) =>
|
||||
this._quickLinkChanged(
|
||||
index,
|
||||
"name",
|
||||
(ev.target as HTMLInputElement).value
|
||||
)}
|
||||
></ha-textfield>
|
||||
<ha-navigation-picker
|
||||
.hass=${this.hass}
|
||||
.value=${link.navigation_path}
|
||||
.label=${this.hass.localize(
|
||||
"ui.panel.home.editor.quick_link_path"
|
||||
)}
|
||||
@value-changed=${(ev: CustomEvent) =>
|
||||
this._quickLinkChanged(
|
||||
index,
|
||||
"navigation_path",
|
||||
ev.detail.value
|
||||
)}
|
||||
></ha-navigation-picker>
|
||||
<ha-icon-button
|
||||
.path=${mdiClose}
|
||||
.label=${this.hass.localize("ui.common.remove")}
|
||||
@click=${() => this._removeQuickLink(index)}
|
||||
></ha-icon-button>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
<ha-button @click=${this._addQuickLink}>
|
||||
<ha-svg-icon .path=${mdiPlus} slot="icon"></ha-svg-icon>
|
||||
${this.hass.localize("ui.panel.home.editor.add_quick_link")}
|
||||
</ha-button>
|
||||
</div>
|
||||
|
||||
<ha-alert alert-type="info">
|
||||
${this.hass.localize("ui.panel.home.editor.areas_hint", {
|
||||
areas_page: html`<a
|
||||
@@ -245,37 +174,6 @@ export class DialogEditHome
|
||||
};
|
||||
}
|
||||
|
||||
private _quickLinkChanged(
|
||||
index: number,
|
||||
field: keyof HomeQuickLink,
|
||||
value: string
|
||||
): void {
|
||||
const quickLinks = [...(this._config?.quick_links || [])];
|
||||
quickLinks[index] = { ...quickLinks[index], [field]: value };
|
||||
this._config = {
|
||||
...this._config,
|
||||
quick_links: quickLinks,
|
||||
};
|
||||
}
|
||||
|
||||
private _removeQuickLink(index: number): void {
|
||||
const quickLinks = [...(this._config?.quick_links || [])];
|
||||
quickLinks.splice(index, 1);
|
||||
this._config = {
|
||||
...this._config,
|
||||
quick_links: quickLinks.length > 0 ? quickLinks : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
private _addQuickLink(): void {
|
||||
const quickLinks = [...(this._config?.quick_links || [])];
|
||||
quickLinks.push({ name: "", icon: "mdi:link", navigation_path: "" });
|
||||
this._config = {
|
||||
...this._config,
|
||||
quick_links: quickLinks,
|
||||
};
|
||||
}
|
||||
|
||||
private _favoriteEntitiesChanged(ev: CustomEvent): void {
|
||||
const entities = ev.detail.value as string[];
|
||||
this._config = {
|
||||
@@ -340,37 +238,6 @@ export class DialogEditHome
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.quick-links {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ha-space-3);
|
||||
}
|
||||
|
||||
.quick-link-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ha-space-2);
|
||||
}
|
||||
|
||||
.quick-link-row ha-icon-picker {
|
||||
width: 80px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.quick-link-row ha-textfield {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quick-link-row ha-navigation-picker {
|
||||
flex: 2;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quick-link-row ha-icon-button {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
ha-entities-picker {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,6 @@ class PanelHome extends LitElement {
|
||||
favorite_entities: this._config.favorite_entities,
|
||||
home_panel: true,
|
||||
hidden_summaries: this._config.hidden_summaries,
|
||||
quick_links: this._config.quick_links,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ export interface HomeDashboardStrategyConfig {
|
||||
favorite_entities?: string[];
|
||||
home_panel?: boolean;
|
||||
hidden_summaries?: string[];
|
||||
quick_links?: { name: string; icon?: string; navigation_path: string }[];
|
||||
}
|
||||
|
||||
@customElement("home-dashboard-strategy")
|
||||
@@ -97,7 +96,6 @@ export class HomeDashboardStrategy extends ReactiveElement {
|
||||
favorite_entities: config.favorite_entities,
|
||||
home_panel: config.home_panel,
|
||||
hidden_summaries: config.hidden_summaries,
|
||||
quick_links: config.quick_links,
|
||||
} satisfies HomeOverviewViewStrategyConfig,
|
||||
},
|
||||
...areaViews,
|
||||
|
||||
@@ -40,7 +40,6 @@ export interface HomeOverviewViewStrategyConfig {
|
||||
favorite_entities?: string[];
|
||||
home_panel?: boolean;
|
||||
hidden_summaries?: string[];
|
||||
quick_links?: { name: string; icon?: string; navigation_path: string }[];
|
||||
}
|
||||
|
||||
const computeAreaCard = (
|
||||
@@ -345,21 +344,6 @@ export class HomeOverviewViewStrategy extends ReactiveElement {
|
||||
: "/energy?historyBack=1",
|
||||
},
|
||||
} satisfies HomeSummaryCard),
|
||||
// Quick links (chip-like cards without summary line)
|
||||
...(config.quick_links || []).map(
|
||||
(link) =>
|
||||
({
|
||||
type: "tile",
|
||||
entity: "zone.home",
|
||||
name: link.name,
|
||||
icon: link.icon || "mdi:link",
|
||||
hide_state: true,
|
||||
tap_action: {
|
||||
action: "navigate",
|
||||
navigation_path: link.navigation_path,
|
||||
},
|
||||
}) satisfies TileCardConfig
|
||||
),
|
||||
].filter(Boolean) as LovelaceCardConfig[];
|
||||
|
||||
// Build summary cards for sidebar (full width: columns 12)
|
||||
|
||||
@@ -2446,13 +2446,7 @@
|
||||
"areas_hint": "You can rearrange your floors and areas in the order that best represents your house on the {areas_page}.",
|
||||
"areas_page": "areas page",
|
||||
"summaries": "Summaries",
|
||||
"summaries_description": "Choose which summaries to show on your overview page.",
|
||||
"quick_links": "Quick links",
|
||||
"quick_links_description": "Add links to dashboards, sidebar items, or other pages.",
|
||||
"add_quick_link": "Add quick link",
|
||||
"quick_link_name": "Name",
|
||||
"quick_link_icon": "Icon",
|
||||
"quick_link_path": "Navigation path"
|
||||
"summaries_description": "Choose which summaries to show on your overview page."
|
||||
},
|
||||
"new_overview_dialog": {
|
||||
"title": "Welcome to your new overview",
|
||||
|
||||
Reference in New Issue
Block a user