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
pull/21253/head
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";
export const demoLovelaceSections: DemoConfig["lovelace"] = () => ({
@ -5,14 +6,18 @@ export const demoLovelaceSections: DemoConfig["lovelace"] = () => ({
views: [
{
type: "sections",
title: "Demo",
title: isFrontpageEmbed ? "Home Assistant" : "Demo",
path: "home",
icon: "mdi:home-assistant",
sections: [
{
title: "Welcome 👋",
cards: [{ type: "custom:ha-demo-card" }],
},
...(isFrontpageEmbed
? []
: [
{
title: "Welcome 👋",
cards: [{ type: "custom:ha-demo-card" }],
},
]),
{
cards: [
{

View File

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

View File

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