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

Make images consistent on home page #4287

Merged
merged 7 commits into from
Sep 30, 2024

Conversation

kbx81
Copy link
Member

@kbx81 kbx81 commented Sep 28, 2024

Description:

Fixes a bunch of SVGs on the home page so they're consistent.

Related issue (if applicable): fixes

Pull request in esphome with YAML changes (if applicable): esphome/esphome#

Checklist:

  • I am merging into next because this is new documentation that has a matching pull-request in esphome as linked above.
    or

  • I am merging into current because this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.

  • Link added in /index.rst when creating new documents for new components or cookbook.

Copy link
Contributor

coderabbitai bot commented Sep 28, 2024

Walkthrough

The changes involve updates to multiple files, including the changelog/2023.11.0.rst, which reflects a filename change for the MicroNova pellet stove graphic from pellet.svg to micronova.svg. The index.rst file has been modified to add the dark-invert parameter to image entries across various components for improved visual representation in dark mode. Additionally, documentation for several components has been updated to change image references from pin.svg to gpio.svg, while the github.py file has been enhanced to improve the functionality of roles and directives related to GitHub references.

Changes

File(s) Change Summary
changelog/2023.11.0.rst Updated filename for MicroNova pellet stove graphic from pellet.svg to micronova.svg.
index.rst Added dark-invert parameter to multiple image entries across various components for dark mode.
components/binary_sensor/gpio.rst Changed image reference from pin.svg to gpio.svg for GPIO Binary Sensor documentation.
components/output/gpio.rst Changed image reference from pin.svg to gpio.svg for GPIO output documentation.
components/switch/gpio.rst Changed image reference from pin.svg to gpio.svg for GPIO switch documentation.
github.py Enhanced ImageTableDirective and PinTableDirective classes for better handling of GitHub references and documentation tables.

Possibly related PRs

  • Add a section about custom component deprecation #4247: The changes in this PR involve updating documentation for various components to clarify the deprecation of custom components, which aligns with the main PR's focus on renaming a graphic asset related to the MicroNova pellet stove component.

Suggested reviewers

  • jesserockz

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 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

netlify bot commented Sep 28, 2024

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit ac63178
🔍 Latest deploy log https://app.netlify.com/sites/esphome/deploys/66fa1ba84ab66b0008516de3
😎 Deploy Preview https://deploy-preview-4287--esphome.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.

@kbx81 kbx81 requested a review from jesserockz September 28, 2024 10:53
index.rst Outdated Show resolved Hide resolved
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 (2)
github.py (2)

139-142: LGTM! Consider a minor readability improvement.

The changes improve the flexibility of handling category and dark_invert properties. The logic now correctly handles cases with 4 or 5 columns in the input.

For improved readability, consider extracting the column count check into a separate variable:

-            if len(row) == 4:
+            column_count = len(row)
+            if column_count == 4:
                 if row[3].strip() == "dark-invert":
                     dark_invert = True
                 else:
                     category = row[3].strip()
-            if len(row) == 5 and row[4].strip() == "dark-invert":
+            if column_count == 5 and row[4].strip() == "dark-invert":
                 category = row[3].strip()
                 dark_invert = True

This change would make the logic more explicit and easier to maintain if additional columns need to be handled in the future.


Line range hint 228-273: LGTM! Consider adding flexibility for column headers.

The rewrite of the PinTableDirective class significantly improves the table generation process. The new implementation is more structured and handles different input formats effectively.

To increase flexibility, consider allowing custom column headers:

+    option_spec = {
+        'headers': directives.unchanged,
+    }

     def run(self):
         items = []
+        headers = self.options.get('headers', 'Pin,Function').split(',')

         data = list(csv.reader(self.content))
         for row in data:
             if not row:
                 continue
             if len(row) == 3:
                 items.append((row[0], row[1], True))
             else:
                 items.append((row[0], row[1], False))

-        col_widths = self.get_column_widths(2)
+        col_widths = self.get_column_widths(len(headers))
         title, messages = self.make_title()
         table = nodes.table()

         # Set up column specifications based on widths
-        tgroup = nodes.tgroup(cols=2)
+        tgroup = nodes.tgroup(cols=len(headers))
         table += tgroup
         tgroup.extend(nodes.colspec(colwidth=col_width) for col_width in col_widths)

         thead = nodes.thead()
         tgroup += thead
         trow = nodes.row()
         thead += trow
-        trow.extend(
-            nodes.entry(h, nodes.paragraph(text=h)) for h in ("Pin", "Function")
-        )
+        trow.extend(
+            nodes.entry(h, nodes.paragraph(text=h)) for h in headers
+        )

This change allows users to specify custom headers when using the directive, making it more versatile for different use cases.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d63a7ea and ac63178.

⛔ Files ignored due to path filters (2)
  • images/gpio.svg is excluded by !**/*.svg
  • images/pin.svg is excluded by !**/*.svg
📒 Files selected for processing (5)
  • components/binary_sensor/gpio.rst (1 hunks)
  • components/output/gpio.rst (1 hunks)
  • components/switch/gpio.rst (1 hunks)
  • github.py (1 hunks)
  • index.rst (18 hunks)
✅ Files skipped from review due to trivial changes (2)
  • components/binary_sensor/gpio.rst
  • components/output/gpio.rst
🚧 Files skipped from review as they are similar to previous changes (1)
  • index.rst
🧰 Additional context used
📓 Path-based instructions (2)
components/switch/gpio.rst (1)

Pattern **: - Do not generate or add any sequence diagrams

github.py (1)

Pattern **: - Do not generate or add any sequence diagrams

🔇 Additional comments (1)
components/switch/gpio.rst (1)

6-6: LGTM! Verify the new image file exists.

The change from pin.svg to gpio.svg improves the specificity of the image reference for the GPIO switch documentation. This is a good improvement.

Let's verify that the new image file exists in the correct location:

If the script doesn't find the file, please ensure that gpio.svg has been added to the repository in the correct location.

✅ Verification successful

✅ Verification Successful: images/gpio.svg exists.

The new image file images/gpio.svg has been successfully found in the repository, confirming the documentation update.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the gpio.svg file exists in the expected location

# Test: Search for gpio.svg file
fd -t f "gpio.svg"

# If the above command doesn't find the file, it might be in a different directory.
# Let's search for any SVG files with "gpio" in the name:
fd -t f -e svg "gpio"

Length of output: 150

@jesserockz jesserockz merged commit 7181a11 into esphome:current Sep 30, 2024
2 checks passed
@jesserockz jesserockz mentioned this pull request Oct 1, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants