Skip to content

Commit

Permalink
Hide demo card when showing demo from frontpage (#21243)
Browse files Browse the repository at this point in the history
* Hide demo card when showing demo from frontpage

* Store in constant on load

* reverse

* Remove filter

* move constnat

* Make Home Assistant title
  • Loading branch information
balloob authored Jul 2, 2024
1 parent d01377d commit 76abfea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
15 changes: 10 additions & 5 deletions demo/src/configs/sections/lovelace.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import { isFrontpageEmbed } from "../../util/is_frontpage";
import { DemoConfig } from "../types";

export const demoLovelaceSections: DemoConfig["lovelace"] = () => ({
title: "Home Assistant Demo",
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: [
{
Expand Down
1 change: 1 addition & 0 deletions demo/src/entrypoint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "../../src/resources/safari-14-attachshadow-patch";
import "./util/is_frontpage";
import "./ha-demo";

import("../../src/resources/ha-style");
1 change: 1 addition & 0 deletions demo/src/util/is_frontpage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const isFrontpageEmbed = document.location.search === "?frontpage";

0 comments on commit 76abfea

Please sign in to comment.