Skip to content

Calendar default visibility #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: dev
Choose a base branch
from

Conversation

halwehrenberg
Copy link

Overview

This PR introduces a new feature that allows users to configure calendars to be toggled off by default. This enhancement impacts both the visual editor and the runtime behavior of the Week Planner Card.

Changes

  • Runtime Behavior:

    • Added a new configuration property toggledOffByDefault to specify which calendar entities should be toggled off (i.e., hidden) by default when the card loads.
    • Updated the card's initialization logic in src/card.js so that the _hideCalendars array is populated using the toggledOffByDefault property.
    • The toggle functionality now works as follows:
      • If the user enables the legend toggling feature (legendToggle is true), clicking a calendar in the legend will add or remove that calendar's entity from the _hideCalendars array.
      • On initial load, calendars specified in toggledOffByDefault are already hidden, meaning they won't be displayed until toggled by the user.
  • Visual Editor Enhancements:

    • Updated src/editor.js so that the "Calendars toggled off by default" multi-select field is conditionally rendered only when the "Toggle calendars by clicking on the legend" option is enabled.
    • Added helper methods to support a multi-select interface, allowing users to easily choose which calendars should start toggled off.

Testing

  • Runtime Testing:

    • Verified that when the toggledOffByDefault property includes specific calendar entities, those calendars are hidden on card load.
    • Confirmed that clicking on a calendar in the legend toggles its visibility (adding it to or removing it from the _hideCalendars list).
  • Editor Testing:

    • Confirmed that the "Calendars toggled off by default" field is visible only when legendToggle is enabled.
    • Verified that the multi-select field correctly saves and displays the selected calendar entities.

Notes

This new section is designed to improve user experience by providing finer control over calendar visibility on initial load. Feedback is welcome!

FamousWolf and others added 24 commits June 27, 2024 16:31
[TASK] Increase version number to 1.5.0
This adds `data-date`, `data-weekday`, `data-month`, `data-year` and `data-week` attributes to the day container tag. It can be used for custom styling.

Resolves: FamousWolf#116
This adds an option `filter` to filter out any event that matches a regular expression

Resolves: FamousWolf#67
This can be used to for example show last week by setting `startingDayOffset: -7`.

Resolves: FamousWolf#111
This adds a `showLegend` option to show a calendar legend at the top of the card. It is turned off by default.

Resolves: FamousWolf#107
…calendar

This prevents events with the same start time from jumping around when calendars are (re)loaded

Resolves: FamousWolf#74
[TASK] Increase version to 1.7.1
[MERGE] Changes for version 1.8.0
[MERGE] Changes for version 1.9.0
[MERGE] Add missing documentation for `showLegend`
[MERGE] Changes for release 1.10.1
[MERGE] Changes for version 1.11.0
[MERGE] Changes for version 1.11.1
[MERGE] Remove custom hacs repository instructions
[MERGE] Merge files for version 1.12.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants