Skip to content

Commit

Permalink
Fix naviagation path
Browse files Browse the repository at this point in the history
  • Loading branch information
Lebe1ge committed Dec 2, 2024
1 parent e5ccd78 commit 47eeae5
Show file tree
Hide file tree
Showing 25 changed files with 20 additions and 56 deletions.
36 changes: 9 additions & 27 deletions custom_components/linus_dashboard/www/linus-strategy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ class Helper {
}),
);

console.log('this.#areas', this.#areas, this.#magicAreasDevices)
// console.log('this.#areas', this.#areas, this.#magicAreasDevices)

this.#initialized = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/chips/FanChip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FanChip extends AbstractChip {
content: Helper.getCountTemplate("fan", "eq", "on"),
tap_action: {
action: "navigate",
navigation_path: "fans",
navigation_path: "fan",
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/chips/LightChip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LightChip extends AbstractChip {
content: "",
tap_action: {
action: "navigate",
navigation_path: "lights",
navigation_path: "light",
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/chips/MediaPlayerChip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MediaPlayerChip extends AbstractChip {
content: "",
tap_action: {
action: "navigate",
navigation_path: "media_players",
navigation_path: "media_player",
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/chips/SwitchChip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SwitchChip extends AbstractChip {
content: "",
tap_action: {
action: "navigate",
navigation_path: "switches",
navigation_path: "switch",
},
};

Expand Down
11 changes: 5 additions & 6 deletions src/linus-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { generic } from "./types/strategy/generic";
import { LovelaceConfig, LovelaceViewConfig } from "./types/homeassistant/data/lovelace";
import { CUSTOM_VIEWS, DEVICE_CLASSES, DOMAINS_VIEWS, VIEWS_ICONS } from "./variables";
import { AreaView } from "./views/AreaView";
import { getAreaName, getFloorName } from "./utils";
import { getAreaName, getDomainTranslationKey, getFloorName } from "./utils";
import { FloorView } from "./views/FloorView";
import { ResourceKeys } from "./types/homeassistant/data/frontend";

Expand Down Expand Up @@ -32,7 +32,7 @@ class LinusStrategy extends HTMLTemplateElement {
static async generateDashboard(info: generic.DashBoardInfo): Promise<LovelaceConfig> {
if (!Helper.isInitialized()) await Helper.initialize(info);

console.log('info', info);
// console.log('info', info);

const views: LovelaceViewConfig[] = info.config?.views ?? [];

Expand Down Expand Up @@ -71,11 +71,10 @@ class LinusStrategy extends HTMLTemplateElement {
}

views.push({
title: viewId,
icon: (VIEWS_ICONS as Record<string, string>)[viewId] ?? Helper.icons[domain as ResourceKeys]?.[device_class]?.default,
title: Helper.localize(getDomainTranslationKey(domain, device_class)),
icon: (VIEWS_ICONS as Record<string, string>)[viewId] ?? Helper.icons[device_class === "battery" ? "binary_sensor" : domain as ResourceKeys]?.[device_class]?.default,
path: viewId,
// subview: !Object.keys(ResourceKeys).includes(viewId),
subview: false,
subview: !Object.keys(VIEWS_ICONS).includes(viewId),
strategy: {
type: "custom:linus-strategy",
options: { viewId },
Expand Down
1 change: 0 additions & 1 deletion src/views/AggregateView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class AggregateView extends AbstractView {
*/
#defaultConfig: views.ViewConfig = {
title: "Aggregates",
path: "aggregates",
icon: "mdi:fan",
subview: true,
};
Expand Down
1 change: 0 additions & 1 deletion src/views/AreaView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class AreaView {
config: views.ViewConfig = {
icon: "mdi:home-assistant",
type: "sections",
path: "home",
subview: true,
};

Expand Down
1 change: 0 additions & 1 deletion src/views/CameraView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class CameraView extends AbstractView {
*/
#defaultConfig: views.ViewConfig = {
title: "Cameras",
path: "cameras",
icon: "mdi:cctv",
subview: false,
};
Expand Down
1 change: 0 additions & 1 deletion src/views/ClimateView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class ClimateView extends AbstractView {
*/
#defaultConfig: views.ViewConfig = {
title: "Climates",
path: "climates",
icon: "mdi:thermostat",
subview: false,
};
Expand Down
1 change: 0 additions & 1 deletion src/views/CoverView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class CoverView extends AbstractView {
*/
#defaultConfig: views.ViewConfig = {
title: "Covers",
path: "cover",
icon: "mdi:window-open",
subview: false,
};
Expand Down
1 change: 0 additions & 1 deletion src/views/FanView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class FanView extends AbstractView {
*/
#defaultConfig: views.ViewConfig = {
title: "Fans",
path: "fans",
icon: "mdi:fan",
subview: false,
};
Expand Down
1 change: 0 additions & 1 deletion src/views/FloorView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class FloorView {
config: views.ViewConfig = {
icon: "mdi:home-assistant",
type: "sections",
path: "home",
subview: true,
};

Expand Down
1 change: 0 additions & 1 deletion src/views/HomeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class HomeView {
title: "Home",
icon: "mdi:home-assistant",
type: "sections",
path: "home",
subview: false,
};

Expand Down
1 change: 0 additions & 1 deletion src/views/LightView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class LightView extends AbstractView {
* @private
*/
#defaultConfig: views.ViewConfig = {
path: "lights",
icon: "mdi:lightbulb-group",
subview: false,
};
Expand Down
1 change: 0 additions & 1 deletion src/views/MediaPlayerView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class MediaPlayerView extends AbstractView {
*/
#defaultConfig: views.ViewConfig = {
title: "MediaPlayers",
path: "media_players",
icon: "mdi:cast",
subview: false,
};
Expand Down
1 change: 0 additions & 1 deletion src/views/SceneView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class SceneView extends AbstractView {
*/
#defaultConfig: views.ViewConfig = {
title: "Scenes",
path: "scenes",
icon: "mdi:palette",
subview: false,
};
Expand Down
1 change: 0 additions & 1 deletion src/views/SecurityDetailsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ abstract class SecurityDetailsView {
*/
config: LovelaceViewConfig = {
title: Helper.localize("component.binary_sensor.entity_component.safety.name"),
path: "security-details",
icon: "mdi:security",
subview: true,
};
Expand Down
1 change: 0 additions & 1 deletion src/views/SecurityView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class SecurityView {
* @private
*/
config: views.ViewConfig = {
path: "security",
title: Helper.localize("component.binary_sensor.entity_component.safety.name"),
icon: "mdi:security",
type: "sections",
Expand Down
1 change: 0 additions & 1 deletion src/views/SensorView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class SensorView extends AbstractView {
*/
#defaultConfig: views.ViewConfig = {
title: "Sensors",
path: "scenes",
icon: "mdi:palette",
subview: false,
};
Expand Down
Loading

0 comments on commit 47eeae5

Please sign in to comment.