-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 last updated property to tile card state content #21191
Conversation
WalkthroughWalkthroughThe update introduces a new feature to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Editor as HuiTileCardEditor
participant Card as HuiTileCard
participant RelativeTime as ha-relative-time
User->>Editor: Open Tile Card Editor
Editor->>User: Display content options
User->>Editor: Select "Last updated"
Editor->>Card: Pass "last-updated" value
Card->>RelativeTime: Render ha-relative-time with last_updated
This diagram illustrates the interactions for selecting the "last-updated" state content option in the tile card editor. Once selected, the card renders the Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (3)
Additional context usedBiome
Gitleaks
Additional comments not posted (5)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range comments (4)
src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts (2)
Line range hint
215-215
: Replace non-null assertions with optional chaining for safer code.Non-null assertions can lead to runtime errors. Optional chaining is safer as it includes runtime checks.
- this.hass! + this.hass? - stateObj! + stateObj? - this._config! + this._config? - this._subElementEditorConfig! + this._subElementEditorConfig?Also applies to: 270-270, 306-306, 368-368, 369-369, 373-373, 376-376, 379-379, 382-382, 407-407, 412-412
Line range hint
327-327
: Optimize performance by replacing delete operations with undefined assignments.Using
delete
can lead to performance issues in JavaScript. It's recommended to useundefined
assignments instead.- delete config.state_content; + config.state_content = undefined; - delete config.features; + config.features = undefined;Also applies to: 332-332, 354-354
src/panels/lovelace/cards/hui-tile-card.ts (2)
Line range hint
139-139
: Replace non-null assertions with optional chaining for safer code.Non-null assertions can lead to runtime errors. Optional chaining is safer as it includes runtime checks.
- this.hass! + this.hass? - this._config! + this._config? - ev.detail.action! + ev.detail.action?Also applies to: 145-145, 146-146, 148-148, 158-158, 231-231, 260-260, 265-265, 388-388, 389-389
Line range hint
332-332
: Consider refactoring to reduce complexity.The function has a high complexity score, which can make it difficult to understand and maintain. Consider breaking it down into smaller, more manageable functions.
Proposed change
Add last updated property to tile card state content
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
Summary by CodeRabbit
New Features
Localization