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 nextjs example #4871

Merged
merged 2 commits into from
Dec 4, 2024
Merged

add nextjs example #4871

merged 2 commits into from
Dec 4, 2024

Conversation

vio
Copy link
Member

@vio vio commented Dec 4, 2024

  • test(ui) Add TransMascFutures - add fixtures
  • test(ui): Add OSS doc meta

Summary by CodeRabbit

  • New Features

    • Introduced a new Storybook configuration for the TransMascFutures application, allowing for enhanced visualization and testing of the App component.
  • Improvements

    • Updated type declarations for Story in multiple Storybook configurations to align more closely with the App component.
    • Added documentation comments across various story files, providing metadata about the development stack and links to relevant resources.

These changes enhance the clarity and usability of the Storybook setup for developers and contributors.

Copy link

coderabbitai bot commented Dec 4, 2024

Walkthrough

The changes in this pull request involve updates to several Storybook configuration files for different components within the UI package. Each file has been modified to change the type declaration for the Story object from StoryObj<typeof meta> to StoryObj<typeof App>, aligning the type references more closely with the App component. Additionally, new documentation comments have been added to provide metadata about the technology stack used and links to relevant repositories. A new Storybook configuration has also been introduced for the TransMascFutures application.

Changes

File Path Change Summary
packages/ui/src/app/app-gladys.stories.tsx - Updated Story type from StoryObj<typeof meta> to StoryObj<typeof App>.
- Added documentation comment with stack and repository links.
packages/ui/src/app/app-home-assistant.stories.tsx - Updated Story type from StoryObj<typeof meta> to StoryObj<typeof App>.
- Added documentation comment with stack and repository links.
packages/ui/src/app/app-outline.stories.tsx - Updated Story type from StoryObj<typeof meta> to StoryObj<typeof App>.
- Added documentation comment with stack and repository links.
packages/ui/src/app/app-trans-masc-futures.stories.tsx - Added new Storybook metadata and exported a new story for the App component.
- Introduced job data creation from JSON sources.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant Storybook

    User->>Storybook: Request to view App story
    Storybook->>App: Render App component with JOBS data
    App->>Storybook: Return rendered component
    Storybook->>User: Display App story
Loading

🐰 "In the land of code and stories bright,
Our components dance in pure delight.
With types aligned and links to share,
The rabbit hops with joyful flair!
New tales of apps, both fun and grand,
In Storybook's world, we take a stand!" 🐇✨


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

@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 (4)
packages/ui/src/app/app-home-assistant.stories.tsx (1)

37-44: Consider moving documentation comment above the type definition.

While the content is good, consider moving the documentation comment above the type definition to maintain consistency with other story files. This would improve readability and maintain a consistent documentation pattern across the codebase.

Here's the suggested order:

+/**
+ * stack: Vite, yarn
+ *
+ * - GitHub: https://github.com/home-assistant/frontend
+ * - RelativeCI project: https://app.relative-ci.com/projects/ZyS69RCzSjYaQA6vUq06
+ */
 type Story = StoryObj<typeof App>;

-/**
- * stack: Vite, yarn
- *
- * - GitHub: https://github.com/home-assistant/frontend
- * - RelativeCI project: https://app.relative-ci.com/projects/ZyS69RCzSjYaQA6vUq06
- */
packages/ui/src/app/app-trans-masc-futures.stories.tsx (3)

5-9: Consider using path aliases for deep imports

The deep relative imports (../../../../fixtures) could be hard to maintain. Consider setting up path aliases in your TypeScript/webpack configuration for better maintainability.

Example configuration in tsconfig.json:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
+     "@fixtures/*": ["fixtures/*"]
    }
  }
}

Then imports could be simplified to:

-import currentData from '../../../../fixtures/trans-masc-futures/current.json';
+import currentData from '@fixtures/trans-masc-futures/current.json';

24-29: Consider enhancing documentation with additional metadata

The documentation provides good basic information, but could be enhanced with:

  • Project description
  • Development status
  • Required Node.js version

36-38: Consider making version dynamic

The hardcoded version in args might become outdated. Consider:

  1. Importing version from package.json
  2. Using environment variables
  3. Using build-time constants

Example implementation:

+import { version } from '../../../package.json';

 args: {
-  version: '1.0',
+  version,
 },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 74ef42d and 4386d86.

📒 Files selected for processing (4)
  • packages/ui/src/app/app-gladys.stories.tsx (2 hunks)
  • packages/ui/src/app/app-home-assistant.stories.tsx (1 hunks)
  • packages/ui/src/app/app-outline.stories.tsx (2 hunks)
  • packages/ui/src/app/app-trans-masc-futures.stories.tsx (1 hunks)
🔇 Additional comments (7)
packages/ui/src/app/app-outline.stories.tsx (2)

24-29: LGTM! Well-documented metadata.

The added documentation comment provides valuable context about the tech stack and relevant links.


43-43: LGTM! Improved type precision.

The type change from StoryObj<typeof meta> to StoryObj<typeof App> provides more precise typing by directly referencing the component being rendered.

packages/ui/src/app/app-gladys.stories.tsx (2)

24-29: LGTM! Consistent documentation format.

The documentation follows the established pattern while correctly identifying the unique tech stack for this project.


43-43: LGTM! Consistent type definition.

The type change maintains consistency with other story files while improving type precision.

packages/ui/src/app/app-trans-masc-futures.stories.tsx (3)

12-22: LGTM! Clear and well-structured data configuration

The source data configuration is clean and follows a consistent pattern.


43-47: LGTM! Well-structured story implementation

The story implementation follows Storybook best practices and properly handles component props.


6-8: Verify the existence of fixture files

Let's ensure the referenced fixture files exist in the correct location.

✅ Verification successful

Let me verify the existence of the meta fixtures since they are also imported in the code.


Let me check the content of the meta.js file since it's not a JSON file.


All required fixture files are present and properly structured

  • fixtures/trans-masc-futures/baseline.json and fixtures/trans-masc-futures/current.json exist with valid JSON structure containing assets, chunks, hash, and modules
  • fixtures/meta.js exists and exports the required metaBaseline and metaCurrent objects
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the required fixture files exist

# Check for fixture files
fd --type f --extension json "current.json|baseline.json" fixtures/trans-masc-futures/

# Verify JSON structure in fixture files
for file in $(fd --type f --extension json "current.json|baseline.json" fixtures/trans-masc-futures/); do
  echo "Checking $file structure:"
  jq 'keys' "$file"
done

Length of output: 936


Script:

#!/bin/bash
# Check for meta fixture files
fd --type f "meta" fixtures/

# If found, verify JSON structure
for file in $(fd --type f "meta" fixtures/); do
  echo "Checking $file structure:"
  jq 'keys' "$file"
done

Length of output: 288


Script:

#!/bin/bash
# Check the content of meta.js
cat fixtures/meta.js

Length of output: 511

Copy link

relativeci bot commented Dec 4, 2024

#11733 Bundle Size — 380.84KiB (0%).

4386d86(current) vs 74ef42d master#11731(baseline)

Warning

Bundle contains 2 duplicate packages – View duplicate packages

Bundle metrics  no changes
                 Current
#11733
     Baseline
#11731
No change  Initial JS 333.95KiB 333.95KiB
No change  Initial CSS 46.89KiB 46.89KiB
Change  Cache Invalidation 0% 59.14%
No change  Chunks 3 3
No change  Assets 4 4
No change  Modules 700 700
No change  Duplicate Modules 0 0
No change  Duplicate Code 0% 0%
No change  Packages 39 39
No change  Duplicate Packages 1 1
Bundle size by type  no changes
                 Current
#11733
     Baseline
#11731
No change  JS 333.95KiB 333.95KiB
No change  CSS 46.89KiB 46.89KiB

Bundle analysis reportBranch add-nextjs-exampleProject dashboard


Generated by RelativeCIDocumentationReport issue

@vio vio merged commit a27a513 into master Dec 4, 2024
28 checks passed
@vio vio deleted the add-nextjs-example branch December 4, 2024 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant