From a745539c3345ffa8473d90b04103a26f08ad75a2 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 25 Oct 2023 11:46:28 +0200 Subject: [PATCH] fix height issue calendar, make default on mobile list (#18394) --- src/panels/calendar/ha-full-calendar.ts | 3 ++- src/panels/calendar/ha-panel-calendar.ts | 1 + src/panels/lovelace/cards/hui-calendar-card.ts | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/panels/calendar/ha-full-calendar.ts b/src/panels/calendar/ha-full-calendar.ts index 14645c548605..51ebdffb32ee 100644 --- a/src/panels/calendar/ha-full-calendar.ts +++ b/src/panels/calendar/ha-full-calendar.ts @@ -259,6 +259,7 @@ export class HAFullCalendar extends LitElement { protected firstUpdated(): void { this._loadCalendar(this.initialView); + this._activeView = this.initialView; } private async _loadCalendar(initialView: FullCalendarView) { @@ -512,7 +513,7 @@ export class HAFullCalendar extends LitElement { --ha-card-background, var(--card-background-color, white) ); - min-height: 400px; + height: var(--calendar-height); --fc-neutral-bg-color: var( --ha-card-background, var(--card-background-color, white) diff --git a/src/panels/calendar/ha-panel-calendar.ts b/src/panels/calendar/ha-panel-calendar.ts index c182d3484c28..040576c3e984 100644 --- a/src/panels/calendar/ha-panel-calendar.ts +++ b/src/panels/calendar/ha-panel-calendar.ts @@ -178,6 +178,7 @@ class PanelCalendar extends LitElement { .events=${this._events} .calendars=${this._calendars} .narrow=${this.narrow} + .initialView=${this.narrow ? "listWeek" : "dayGridMonth"} .hass=${this.hass} .error=${this._error} @view-changed=${this._handleViewChanged} diff --git a/src/panels/lovelace/cards/hui-calendar-card.ts b/src/panels/lovelace/cards/hui-calendar-card.ts index 0dce19da9784..363324470590 100644 --- a/src/panels/lovelace/cards/hui-calendar-card.ts +++ b/src/panels/lovelace/cards/hui-calendar-card.ts @@ -242,6 +242,10 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard { padding-inline-start: 8px; direction: var(--direction); } + + ha-full-calendar { + --calendar-height: 400px; + } `; } }