1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-04-02 00:27:49 +01:00

Use view columns visibility condition in strategies (#51323)

This commit is contained in:
Paul Bottein
2026-04-01 14:05:52 +02:00
committed by GitHub
parent e06ea1047c
commit e36a2e1c70
5 changed files with 14 additions and 17 deletions

View File

@@ -11,7 +11,7 @@ import { shouldShowFloorsAndAreas } from "./show-floors-and-areas";
import {
LARGE_SCREEN_CONDITION,
SMALL_SCREEN_CONDITION,
} from "../../lovelace/strategies/helpers/screen-conditions";
} from "../../lovelace/strategies/helpers/view-columns-conditions";
@customElement("energy-view-strategy")
export class EnergyViewStrategy extends ReactiveElement {

View File

@@ -15,7 +15,7 @@ import { computeAreaTileCardConfig } from "../../lovelace/strategies/areas/helpe
import {
LARGE_SCREEN_CONDITION,
SMALL_SCREEN_CONDITION,
} from "../../lovelace/strategies/helpers/screen-conditions";
} from "../../lovelace/strategies/helpers/view-columns-conditions";
import type { ToggleGroupCardConfig } from "../../lovelace/cards/types";
import type { ButtonHeadingBadgeConfig } from "../../lovelace/heading-badges/types";

View File

@@ -1,14 +0,0 @@
import type {
Condition,
ScreenCondition,
} from "../../common/validate-condition";
export const LARGE_SCREEN_CONDITION: ScreenCondition = {
condition: "screen",
media_query: "(min-width: 871px)",
};
export const SMALL_SCREEN_CONDITION: Condition = {
condition: "not",
conditions: [LARGE_SCREEN_CONDITION],
};

View File

@@ -0,0 +1,11 @@
import type { ViewColumnsCondition } from "../../common/validate-condition";
export const LARGE_SCREEN_CONDITION: ViewColumnsCondition = {
condition: "view_columns",
min: 2,
};
export const SMALL_SCREEN_CONDITION: ViewColumnsCondition = {
condition: "view_columns",
max: 1,
};

View File

@@ -30,7 +30,7 @@ import type {
import {
LARGE_SCREEN_CONDITION,
SMALL_SCREEN_CONDITION,
} from "../helpers/screen-conditions";
} from "../helpers/view-columns-conditions";
import type { CommonControlSectionStrategyConfig } from "../usage_prediction/common-controls-section-strategy";
import { HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries";
import { OTHER_DEVICES_FILTERS } from "./helpers/other-devices-filters";