Skip to content
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

Add timespans to history and energy #23362

Merged

Conversation

boern99
Copy link
Contributor

@boern99 boern99 commented Dec 20, 2024

Breaking change

Proposed change

Type of change

adds som additional Date-Selections: Last 24 hours, Last 30 days and Last 365 days to History, Logbook and Energy-Dashbaord
image

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@bramkragten bramkragten added the Needs UX Pull requests requiring a review from the Home Assistant design team label Dec 22, 2024
@kobuki
Copy link

kobuki commented Jan 12, 2025

Could you please also add back the "Yesterday", "Last week", "Last month" and "Last year" selectors as well as it used to be? Up to 2024.12 it was also present with the ones you to propose to add back. In 2024.12 and earlier all were there. Many times we're curious about full calendar units, not just the time span ending in the current point in time. My issue in the subject: #23671. Similar issues affecting the same UI component: #23685, #23685.

Reference:

image

@boern99
Copy link
Contributor Author

boern99 commented Jan 12, 2025

Could you please also add back the "Yesterday", "Last week", "Last month" and "Last year" selectors as well as it used to be? Up to 2024.12 it was also present with the ones you to propose to add back. In 2024.12 and earlier all were there. Many times we're curious about full calendar units, not just the time span ending in the current point in time. My issue in the subject: #23671. Similar issues affecting the same UI component:

The Idea was, that you simple can use Today and click the back button for yesterday: once more you would also have the day before yesterday and so forth. This works also for Week, Month, and Year. Removing "Yesterday", "Last week", "Last month" and "Last year" gives enough space for additional options: last 24h, last 30days, last 365days and keeps the list clear.

@kobuki
Copy link

kobuki commented Jan 12, 2025

The Idea was, that you simple can use Today and click the back button for yesterday: once more you would also have the day before yesterday and so forth. This works also for Week, Month, and Year.

Well, that makes sense. One more mouse click/tap, tho...

@marcinbauer85
Copy link
Contributor

Thanks, @boern99, for this contribution. It's a good idea, although this exposes a wider issue of this "dropdown" being too long for mobile currently, and the addition of more items - will make it worse:
CleanShot 2025-01-17 at 09 07 26
This kind of selector UI on mobile should be a sheet, one that we would like to tackle in the near future. In the attached gif I mockedup a fixed height only on mobile with overflow:auto to show the scrollbar. For desktop it would stay as it is. The new items should also be at the bottom of the list since they are categorised by a different time anchor.

@marcinbauer85
Copy link
Contributor

@boern99 based on the community research that I've did here we've concluded the presets that we would like to implement in both Logbook and History views. In reference to what you've submitted, the "Last 365 days" wasn't a popular choice, but the other two did make the cut.
Please tell me how we can proceed in implementing all of the presets mentioned in the study for the Logbook/History 🤔

@boern99
Copy link
Contributor Author

boern99 commented Feb 6, 2025

Last 365 days is more helpful for the energy dashboard anyway.
Added the missing timespans to Logbook and History: 1h, 12 h, 7d, removed 365d and
added 7d to energy.

@boern99
Copy link
Contributor Author

boern99 commented Feb 6, 2025

Had to remove 7d for energy, as calculation cannot handle it:
same cause as this Commit: #23458

@boern99
Copy link
Contributor Author

boern99 commented Feb 6, 2025

Changed energy to use whole days / month
image
History:
image

@marcinbauer85
Copy link
Contributor

@boern99 please apply mobile only changes so that the list isn't that long, since after adding those items it doesn't fit on the screen. Once we have that we can merge this. Thank you.

@boern99
Copy link
Contributor Author

boern99 commented Feb 12, 2025

@boern99 please apply mobile only changes so that the list isn't that long, since after adding those items it doesn't fit on the screen. Once we have that we can merge this. Thank you.

@marcinbauer85 : not sure what you mean: Can you please respond to my question in the review i opened and answer details about whats missing or wrong.

@marcinbauer85
Copy link
Contributor

@boern99 ah sorry, I saw the screen you posted and I didn't see that you have already added a rule for mobile 👍

@boern99 boern99 changed the title Add timespans to logbook, energy and history Add timespans to history and energy Feb 13, 2025
@silamon silamon merged commit f53ac41 into home-assistant:dev Feb 15, 2025
15 checks passed
boern99 added a commit to boern99/ha_frontend that referenced this pull request Feb 15, 2025
* add Last 24h, 30d, 1y and overflow

* added Energy-Dashboard

* mobile style css

* added yesterday and min-height; changed overflow; new timespans to end;

* conflict resolve trial

* changed energy timespan order

* min for logbook

* seperated overflow calc for energy and logbook / history

* rename to header-position

* prettier format

* date-fns types

* added 1h, 12 h, 7d and removed 365d for history, added 7d to energy

* remove 7d for energy

* use calcdate and for energy whole hours / days / months

* fix calc
@boern99 boern99 deleted the add-timespans-to-Logbook-and-History branch February 15, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Needs UX Pull requests requiring a review from the Home Assistant design team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants