fix: use compact datetime rows with edit affordance for date range#592
fix: use compact datetime rows with edit affordance for date range#592tykeal wants to merge 6 commits intoFutureTense:mainfrom
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #592 +/- ##
==========================================
+ Coverage 84.14% 89.91% +5.76%
==========================================
Files 10 36 +26
Lines 801 3629 +2828
Branches 0 56 +56
==========================================
+ Hits 674 3263 +2589
- Misses 127 366 +239
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot /review |
57b1ab7 to
5f2c1c2
Compare
Replace the default datetime entity rows for date range start/end with a lightweight custom Lovelace row component that displays the datetime value as text with a pencil icon indicating editability. Tapping opens HA's native more-info dialog which correctly handles timezone conversion, 12/24h locale formatting, and date/time editing across all platforms including the companion app. The custom row delegates layout to hui-generic-entity-row for perfect alignment with standard entity rows. Parent-view (child locks following a parent) datetime rows use simple-entity with no edit affordance since values are controlled by the parent. Closes FutureTense#591 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
5f2c1c2 to
3b11cb4
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a compact, custom Lovelace entity-row for Keymaster date-range start/end datetime entities to prevent the default datetime row UI from overflowing, while still allowing editing via Home Assistant’s native more-info dialog.
Changes:
- Added a
keymaster-datetime-rowcustom entity row (with pencil affordance) and registered it in the Lovelace strategy bundle. - Updated Lovelace view generation so date-range start/end use
custom:keymaster-datetime-rowwithtap_action: more-info(non-parent) andsimple-entitywithtap_action: none(parent/read-only). - Updated Python and TypeScript tests to validate the new row type and element registrations.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
lovelace_strategy/datetime-row.ts |
New Lit-based custom datetime entity row (text display + pencil icon). |
lovelace_strategy/datetime-row.test.ts |
Unit tests for the new custom row component. |
lovelace_strategy/main.ts |
Registers the new keymaster-datetime-row custom element. |
lovelace_strategy/main.test.ts |
Updates element registration tests to include the new custom row. |
custom_components/keymaster/lovelace.py |
Switches date-range entities to the new row (editable) vs simple-entity (read-only) and threads tap_action through config generators. |
tests/test_lovelace.py |
Updates assertions for new row types and tap actions in generated Lovelace config. |
custom_components/keymaster/www/generated/keymaster.js |
Rebuilt frontend bundle including the new custom row. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use Intl.DateTimeFormat with HA locale settings for 12/24h and date format preferences instead of hard-coded YYYY-MM-DD HH:mm - Add HALocaleData interface to type stubs for locale support - Use explicit 'is not None' check for tap_action parameter - Rename misleading test to match actual assertion intent - Tighten parent datetime rows assertion from >= 2 to == 2 - Add tests for 12-hour and 24-hour locale formatting Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add locale change detection to shouldUpdate so 12/24h preference changes trigger a re-render - Fix docstring to accurately describe Intl.DateTimeFormat usage - Update main.test.ts comments from 'six' to 'seven' elements Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Honor HA's locale.date_format (DMY/MDY/YMD) preference when formatting datetime display - Add explicit hass-more-info event dispatch on tap for robust action handling - Include date_format in shouldUpdate locale change detection - Remove ICU-dependent AM/PM regex assertions in favor of exact match with expectedFormat helper - Add tests for DMY/MDY/YMD formatting and action dispatching Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Only render pencil icon when tap_action is more-info (editable) - Remove unused hold_action and double_tap_action from config interface - Add tests for pencil visibility based on editability Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
acc1567 to
70d311d
Compare
Use Intl.DateTimeFormat.formatToParts() to extract locale-formatted year/month/day values before reordering, ensuring non-Latin numeral systems are handled correctly when date_format is overridden. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
70d311d to
628a608
Compare
Summary
Replace the default datetime entity rows for date range start/end with a lightweight custom Lovelace row component that displays the datetime value as text with a pencil icon (✏️) indicating editability. Tapping opens HA's native more-info dialog which correctly handles timezone conversion, 12/24h locale formatting, and date/time editing across all platforms including the companion app.
Changes
New files
lovelace_strategy/datetime-row.ts— Customkeymaster-datetime-rowLit element that wrapshui-generic-entity-rowfor layout, displays formatted local-time state text, and shows a pencil icon edit affordancelovelace_strategy/datetime-row.test.ts— Tests for the custom row componentModified files
custom_components/keymaster/lovelace.py— Date range datetime entities usecustom:keymaster-datetime-rowtype withtap_action: more-infofor non-parent views; parent views usesimple-entitywithtap_action: none(read-only). Addedtap_actionparameter to entity config generators.lovelace_strategy/main.ts— Register the new custom elementtests/test_lovelace.py— Updated assertions for new entity row types and tap actionscustom_components/keymaster/www/generated/keymaster.js— Rebuilt frontend bundleHow it works
custom:keymaster-datetime-rowshows icon + name + datetime text + ✏️ pencil. Tap → more-info dialog for editing.simple-entityshows read-only text, no pencil, no edit tap action.Testing
Closes #591