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 heading card #34978

Merged
merged 7 commits into from
Sep 30, 2024
Merged

Add heading card #34978

merged 7 commits into from
Sep 30, 2024

Conversation

piitaya
Copy link
Member

@piitaya piitaya commented Sep 30, 2024

Proposed change

Add documentation for heading card.
Section view documentation has also been updated to reflect the new way to edit title for sections.
Screenshots in section view needs to be updated as well but it's not part of this PR.

Type of change

  • Spelling, grammar or other readability improvements (current branch).
  • Adjusted missing or incorrect information in the current documentation (current branch).
  • Added documentation for a new integration I'm adding to Home Assistant (next branch).
  • Added documentation for a new feature I'm adding to Home Assistant (next branch).
  • Removed stale or deprecated documentation.

Additional information

  • Link to parent pull request in the codebase: Add Heading card  frontend#22008
  • Link to parent pull request in the Brands repository:
  • This PR fixes or closes issue: fixes #

Checklist

  • This PR uses the correct branch, based on one of the following:
    • I made a change to the existing documentation and used the current branch.
    • I made a change that is related to an upcoming version of Home Assistant and used the next branch.
  • The documentation follows the Home Assistant documentation standards.

Summary by CodeRabbit

  • New Features

    • Introduced a "Heading card" for dashboards, enhancing structure with titles, icons, and badges.
    • Added an experimental "Sections" view for organizing dashboard cards, allowing for flexible layouts and drag-and-drop functionality.
  • Documentation

    • Updated documentation to include configuration details for the Heading card and Sections view, along with usage instructions and related resources.

@home-assistant home-assistant bot added has-parent This PR has a parent PR in a other repo next This PR goes into the next branch labels Sep 30, 2024
Copy link

netlify bot commented Sep 30, 2024

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit 5e7e61c
🔍 Latest deploy log https://app.netlify.com/sites/home-assistant-docs/deploys/66faac9d7656c50008075a58
😎 Deploy Preview https://deploy-preview-34978--home-assistant-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@piitaya piitaya changed the title Heading card Add heading card Sep 30, 2024
@piitaya piitaya marked this pull request as ready for review September 30, 2024 13:25
Copy link
Contributor

coderabbitai bot commented Sep 30, 2024

Caution

Review failed

The pull request is closed.

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduce two new features for dashboards: a "Heading card" and a "Sections" view. The Heading card provides a structured way to display titles, icons, navigation, and badges, allowing for compact entity information. The Sections view enables users to organize cards in a grid layout, supporting dynamic visibility and drag-and-drop rearrangement of sections and cards. Documentation for both features outlines configuration requirements and usage instructions.

Changes

File Change Summary
source/_dashboards/heading.markdown Introduces a "Heading card" with configuration options for title, icon, navigation, and badges. New card types and configuration entities are defined.
source/_dashboards/sections.markdown Introduces a "Sections" view for organizing cards in a grid layout, including automatic heading cards for sections, visibility controls, and drag-and-drop functionality.

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (6)
source/_dashboards/heading.markdown (4)

20-31: Consider adding explanatory comments to the YAML example

The YAML example effectively demonstrates the Heading card configuration. To further enhance readability and understanding, consider adding inline comments explaining each key component of the configuration. For example:

type: heading  # Specifies this is a Heading card
heading: Living room  # The main text to be displayed
icon: mdi:sofa  # Icon to be shown alongside the heading
badges:  # List of badges to be displayed
  - type: entity  # Each badge represents an entity
    entity_id: sensor.living_room_sensor_temperature
    color: red  # Custom color for the temperature badge
  # ... (other badges)

This addition would help users quickly grasp the purpose of each configuration element.


43-46: Minor grammatical improvement suggested

In the heading_style description, consider rephrasing for better clarity:

- description: Style of the heading. Can be either  `title` or `subtitle`.
+ description: Style of the heading. It can be either `title` or `subtitle`.

This small change improves the sentence structure and removes the extra space before title.

🧰 Tools
🪛 LanguageTool

[style] ~44-~44: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...se description: Style of the heading. Can be either title or subtitle. typ...

(MISSING_IT_THERE)


61-69: Minor typo and suggested improvement for Heading badges section

The Heading badges section provides a good introduction to the feature. However, there's a small typo that should be corrected:

- These badges are similar to regular [badges](/dashboards/badges/) but they are smaller and without background. They can be used useful to display sensor information in a compact and minimal style.
+ These badges are similar to regular [badges](/dashboards/badges/) but they are smaller and without background. They can be useful to display sensor information in a compact and minimal style.

Additionally, consider expanding the YAML example to show multiple badges, as this would better illustrate the feature's capabilities:

type: heading
heading: Living room
badges:
  - type: entity
    entity: light.living_room
  - type: entity
    entity: sensor.living_room_temperature

This expanded example would give users a clearer picture of how multiple badges can be used together.


89-89: Minor style improvements suggested

To address the style issues mentioned in the static analysis hints:

  1. In the color option description (line 89), add a comma after "By default":

    - description: Set the color when the entity is active. By default it will not be colored. It can be set to the `state` special token to dynamically color the icon based on `state`, `domain`, and `device_class` of your entity. It also accepts [color token](/dashboards/tile/#available-colors) or hex color code.
    + description: Set the color when the entity is active. By default, it will not be colored. It can be set to the `state` special token to dynamically color the icon based on `state`, `domain`, and `device_class` of your entity. It also accepts [color token](/dashboards/tile/#available-colors) or hex color code.
  2. In the state_content option description (line 105), consider rephrasing to form complete sentences:

    - description: >
    -     Content to display for the state. Can be `state`, `name`, `last_changed`, `last_updated`, or any attribute of the entity. Can be either a string with a single item, or a list of string items. Default depends on the entity domain.
    + description: >
    +     Specifies the content to display for the state. It can be `state`, `name`, `last_changed`, `last_updated`, or any attribute of the entity. It can be either a string with a single item or a list of string items. The default depends on the entity domain.

These small changes improve the overall readability and grammatical correctness of the documentation.

Also applies to: 105-105

🧰 Tools
🪛 LanguageTool

[uncategorized] ~89-~89: Did you mean: “By default,”?
Context: ...et the color when the entity is active. By default it will not be colored. It can be set t...

(BY_DEFAULT_COMMA)

source/_dashboards/sections.markdown (2)

Line range hint 69-86: LGTM! Consider adding a note about saving changes.

The new section on rearranging sections and cards is well-written and includes helpful visual aids. The step-by-step instructions are clear and easy to follow.

Consider adding a note at the end of this section reminding users to save their changes after rearranging sections and cards. This could prevent users from accidentally losing their new layout.

Suggested addition:

4. After rearranging, don't forget to select the **Save** button to preserve your changes.
🧰 Tools
🪛 LanguageTool

[misspelling] ~55-~55: Use “A” instead of ‘An’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...elect the Create section button. 3. An heading card wil...

(EN_A_VS_AN)


Line range hint 88-92: LGTM! Consider adding an example for clarity.

The new section on conditional visibility for sections is concise and informative. It effectively references existing documentation for conditions and provides clear instructions for editing visibility.

To enhance user understanding, consider adding a simple example of a visibility condition. This could help users grasp the concept more quickly.

Suggested addition:

For example, you could set a condition to show a section only when a specific user is logged in or when a certain sensor value is above a threshold.
🧰 Tools
🪛 LanguageTool

[misspelling] ~55-~55: Use “A” instead of ‘An’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...elect the Create section button. 3. An heading card wil...

(EN_A_VS_AN)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 353bbf8 and 1fc0986.

⛔ Files ignored due to path filters (1)
  • source/images/dashboards/heading_card.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • source/_dashboards/heading.markdown (1 hunks)
  • source/_dashboards/sections.markdown (1 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_dashboards/heading.markdown

[style] ~44-~44: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...se description: Style of the heading. Can be either title or subtitle. typ...

(MISSING_IT_THERE)


[uncategorized] ~89-~89: Did you mean: “By default,”?
Context: ...et the color when the entity is active. By default it will not be colored. It can be set t...

(BY_DEFAULT_COMMA)


[style] ~105-~105: To form a complete sentence, be sure to include a subject.
Context: ...> Content to display for the state. Can be state, name, last_changed, `la...

(MISSING_IT_THERE)


[style] ~105-~105: To form a complete sentence, be sure to include a subject.
Context: ...dated`, or any attribute of the entity. Can be either a string with a single item, ...

(MISSING_IT_THERE)

source/_dashboards/sections.markdown

[misspelling] ~55-~55: Use “A” instead of ‘An’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...elect the Create section button. 3. An heading card wil...

(EN_A_VS_AN)

🔇 Additional comments (4)
source/_dashboards/heading.markdown (3)

1-18: LGTM: Well-structured frontmatter and introduction

The frontmatter and introduction are well-organized and provide clear, concise information about the Heading card feature. The inclusion of related documentation links and an illustrative image enhances the user's understanding.


33-59: LGTM: Comprehensive configuration documentation

The configuration section provides a thorough explanation of all available options for the Heading card. The use of the custom Liquid tag {% configuration entity %} appears to be consistent with the documentation standards, and each option is clearly described with its requirements and type.

🧰 Tools
🪛 LanguageTool

[style] ~44-~44: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...se description: Style of the heading. Can be either title or subtitle. typ...

(MISSING_IT_THERE)


70-111: LGTM: Detailed and comprehensive badge configuration documentation

The badge configuration section provides an excellent breakdown of all available options for customizing individual badges. The explanations are clear and thorough, particularly for complex options like color and state_content. This level of detail will be very helpful for users trying to customize their dashboard.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~89-~89: Did you mean: “By default,”?
Context: ...et the color when the entity is active. By default it will not be colored. It can be set t...

(BY_DEFAULT_COMMA)


[style] ~105-~105: To form a complete sentence, be sure to include a subject.
Context: ...> Content to display for the state. Can be state, name, last_changed, `la...

(MISSING_IT_THERE)


[style] ~105-~105: To form a complete sentence, be sure to include a subject.
Context: ...dated`, or any attribute of the entity. Can be either a string with a single item, ...

(MISSING_IT_THERE)

source/_dashboards/sections.markdown (1)

Line range hint 1-114: Excellent documentation for the new Sections view feature!

The additions to this documentation file effectively explain the new Sections view feature in Home Assistant dashboards. The content is well-structured, clear, and includes helpful visual aids. The step-by-step instructions and explanations of new functionality (such as drag-and-drop rearrangement) are particularly useful for users.

A few minor suggestions have been made to further improve the documentation:

  1. Correcting a grammatical error in the heading card explanation.
  2. Adding a reminder to save changes after rearranging sections and cards.
  3. Including a simple example for section visibility conditions.

These small enhancements will make the already high-quality documentation even more user-friendly and comprehensive.

🧰 Tools
🪛 LanguageTool

[misspelling] ~55-~55: Use “A” instead of ‘An’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...elect the Create section button. 3. An heading card wil...

(EN_A_VS_AN)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@c0ffeeca7 c0ffeeca7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny tweaks

Copy link
Contributor

@c0ffeeca7 c0ffeeca7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny tweaks

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 and nitpick comments (3)
source/_dashboards/heading.markdown (3)

20-31: LGTM: Clear YAML configuration example

The YAML example effectively demonstrates the structure and capabilities of the Heading card. It's particularly helpful in showing how to configure multiple badges with different properties.

Consider adding a brief comment above the YAML example to introduce it, such as:

# Example configuration for a Heading card with two badges

This would provide additional context for users new to the feature.


33-59: Comprehensive configuration documentation with minor improvements needed

The configuration documentation for the Heading card is well-structured and covers all main properties. However, there are a couple of points that could be improved:

  1. On line 44, there's a minor style issue in the heading_style description.

  2. The tap_action description on line 53 could be more specific about when the chevron appears.

  3. Consider rewording the heading_style description for better clarity:

-  description: Style of the heading. Can be either  `title` or `subtitle`.
+  description: Style of the heading. It can be either `title` or `subtitle`.
  1. For the tap_action description, consider adding more detail:
-  description: Action taken on card tap. See [action documentation](/dashboards/actions/#tap-action). By default, it will do nothing. If an action is configured, a chevron will appear next to the heading text.
+  description: Action taken on card tap. See [action documentation](/dashboards/actions/#tap-action). By default, it will do nothing. If any tap action is configured (even if it's set to "none"), a chevron will appear next to the heading text.
🧰 Tools
🪛 LanguageTool

[style] ~44-~44: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...se description: Style of the heading. Can be either title or subtitle. typ...

(MISSING_IT_THERE)


65-111: Comprehensive Heading badges configuration with suggested improvements

The Heading badges configuration documentation is thorough and well-structured. However, there are a few points that could be improved:

  1. The color description could be more detailed, as suggested in a previous review.

  2. There are minor style issues in some descriptions that could be addressed for better readability.

  3. Update the color description as previously suggested:

  description: Set the color when the entity is active. By default, it will not be colored. It can be set to the `state` special token to dynamically color the icon based on `state`, `domain`, and `device_class` of your entity. It also accepts [color token](/dashboards/tile/#available-colors) or hex color code.
  1. Address style issues in the following descriptions:
    • Line 81: Add "the" before "name token" for clarity.
    • Line 105: Rephrase for better sentence structure:
        description: >
          Specifies the content to display for the state. It can be `state`, `name`, `last_changed`, `last_updated`, or any attribute of the entity. This can be either a string with a single item or a list of string items. The default depends on the entity domain.
      

These changes will improve the overall clarity and readability of the documentation.

🧰 Tools
🪛 LanguageTool

[style] ~105-~105: To form a complete sentence, be sure to include a subject.
Context: ...> Content to display for the state. Can be state, name, last_changed, `la...

(MISSING_IT_THERE)


[style] ~105-~105: To form a complete sentence, be sure to include a subject.
Context: ...dated`, or any attribute of the entity. Can be either a string with a single item, ...

(MISSING_IT_THERE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1fc0986 and c4b1627.

📒 Files selected for processing (2)
  • source/_dashboards/heading.markdown (1 hunks)
  • source/_dashboards/sections.markdown (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • source/_dashboards/sections.markdown
🧰 Additional context used
🪛 LanguageTool
source/_dashboards/heading.markdown

[style] ~44-~44: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...se description: Style of the heading. Can be either title or subtitle. typ...

(MISSING_IT_THERE)


[style] ~105-~105: To form a complete sentence, be sure to include a subject.
Context: ...> Content to display for the state. Can be state, name, last_changed, `la...

(MISSING_IT_THERE)


[style] ~105-~105: To form a complete sentence, be sure to include a subject.
Context: ...dated`, or any attribute of the entity. Can be either a string with a single item, ...

(MISSING_IT_THERE)

🔇 Additional comments (2)
source/_dashboards/heading.markdown (2)

1-18: LGTM: Well-structured frontmatter and introduction

The frontmatter and introduction provide clear and concise information about the Heading card feature. The inclusion of related links and an illustrative image enhances the documentation's usefulness.


61-63: Approve with suggested improvement for Heading badges introduction

The introduction to Heading badges is concise, but it could benefit from additional context.

As suggested in a previous review, consider updating the description to provide more detail:

In addition to the heading text, each heading card can show small badges. They are smaller than regular [badges](/dashboards/badges/) and don't have a background. The heading badges can display sensor information in a compact and minimal style.

This change provides a clearer comparison to regular badges and emphasizes the compact nature of heading badges.

Copy link
Contributor

@c0ffeeca7 c0ffeeca7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 🎉 Thank you, @piitaya 👍

@c0ffeeca7 c0ffeeca7 merged commit bae2feb into next Sep 30, 2024
8 checks passed
@c0ffeeca7 c0ffeeca7 deleted the heading-card branch September 30, 2024 13:57
@frenck frenck added this to the 2024.10 milestone Sep 30, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2024
@frenck frenck added the cherry-picked This PR has been manually picked and merged into the current branch label Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cherry-picked This PR has been manually picked and merged into the current branch has-parent This PR has a parent PR in a other repo next This PR goes into the next branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants