Hide demo card when showing demo from frontpage (#21243)

* Hide demo card when showing demo from frontpage

* Store in constant on load

* reverse

* Remove filter

* move constnat

* Make Home Assistant title
This commit is contained in:
Paulus Schoutsen 2024-07-02 14:59:52 +02:00 committed by GitHub
parent d01377da3c
commit 76abfea6ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,4 @@
import { isFrontpageEmbed } from "../../util/is_frontpage";
import { DemoConfig } from "../types"; import { DemoConfig } from "../types";
export const demoLovelaceSections: DemoConfig["lovelace"] = () => ({ export const demoLovelaceSections: DemoConfig["lovelace"] = () => ({
@ -5,14 +6,18 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = () => ({
views: [ views: [
{ {
type: "sections", type: "sections",
title: "Demo", title: isFrontpageEmbed ? "Home Assistant" : "Demo",
path: "home", path: "home",
icon: "mdi:home-assistant", icon: "mdi:home-assistant",
sections: [ sections: [
{ ...(isFrontpageEmbed
title: "Welcome 👋", ? []
cards: [{ type: "custom:ha-demo-card" }], : [
}, {
title: "Welcome 👋",
cards: [{ type: "custom:ha-demo-card" }],
},
]),
{ {
cards: [ cards: [
{ {

View File

@ -1,4 +1,5 @@
import "../../src/resources/safari-14-attachshadow-patch"; import "../../src/resources/safari-14-attachshadow-patch";
import "./util/is_frontpage";
import "./ha-demo"; import "./ha-demo";
import("../../src/resources/ha-style"); import("../../src/resources/ha-style");

View File

@ -0,0 +1 @@
export const isFrontpageEmbed = document.location.search === "?frontpage";