frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Hide demo card when showing demo from frontpage

Open balloob opened this issue 1 year ago • 5 comments

Breaking change

Proposed change

When embedding the demo on the frontpage of HA, we add ?frontpage to the query param. We will now hide the demo card when that is passed in.

Need to test this in CI demo build because I was unable to get demo/script/develop_demo working locally. It keeps hanging on requesting index.html (running from dev container)

Type of change

  • [ ] 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:

Summary by CodeRabbit

  • New Features
    • "Welcome" card in Lovelace sections now conditionally renders based on URL query parameters, providing a more personalized and dynamic user experience.

balloob avatar Jul 01 '24 09:07 balloob

[!WARNING]

Rate limit exceeded

@balloob has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 31 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between b9048e0db7c890a3a3500393feb88347418a6ff6 and cda81884b96db6c86147f84a861d0c0e25768328.

Walkthrough

The recent update to the Home Assistant demo configuration revolves around dynamically rendering the "Welcome" section based on query parameters or a utility function. This change ensures the inclusion of the section when either a specific URL query parameter is present or the isFrontpageEmbed function from is_frontpage.ts returns true.

Changes

File Change Summary
demo/src/configs/sections/lovelace.ts Added conditional logic for "Welcome" section inclusion based on the isFrontpageEmbed utility or URL query parameter. Imported the isFrontpageEmbed function.
demo/src/entrypoint.ts Introduced import for "./util/is_frontpage" to utilize the isFrontpageEmbed functionality.
demo/src/util/is_frontpage.ts Created a new file with isFrontpageEmbed, a constant to check if the current page is the front page based on the URL query parameter.

[!TIP]

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

coderabbitai[bot] avatar Jul 01 '24 09:07 coderabbitai[bot]

I guess we now remove the query string because we navigate to a different url https://demo.home-assistant.io/#/lovelace/home also, should the string be kept when navigation to a different panel and back?

bramkragten avatar Jul 01 '24 10:07 bramkragten

Maybe store it in sessionStorage before we do any navigation?

bramkragten avatar Jul 01 '24 10:07 bramkragten

hmm is replacing the hash also replacing the query string?

balloob avatar Jul 01 '24 11:07 balloob

hmm is replacing the hash also replacing the query string?

yes

bramkragten avatar Jul 01 '24 12:07 bramkragten