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

Default to blocks not allowing wider content inside innerblocks #1408

Merged
merged 2 commits into from
Mar 13, 2025

Conversation

nygrenh
Copy link
Member

@nygrenh nygrenh commented Mar 13, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced layout customization: Content blocks now offer flexible width settings on course materials and exam pages, allowing displays to extend beyond container boundaries when appropriate.
  • Refactor

    • Streamlined the handling of component properties for improved readability and maintainability without altering existing functionality.

- Introduce dontAllowBlockToBeWiderThanContainerWidth prop to manage block width in Page and Exam components.
- Refactor ContentRenderer to destructure props for improved readability and maintainability.
- Update InnerBlocks and ConditionalBlock to support inner block width control.
- Ensure consistent handling of block width restrictions across components.
Copy link
Contributor

coderabbitai bot commented Mar 13, 2025

Walkthrough

The pull request refactors several components in the course material module by updating how props are handled and passed. Components now destructure properties directly in the parameter list, reducing reliance on the props object. New props related to block width control have been introduced and integrated, allowing flexibility in how content blocks are rendered across different pages. These changes improve code readability and maintainability without affecting the underlying functionality.

Changes

File(s) Change Summary
services/course-material/src/components/ContentRenderer/index.tsx Refactored to destructure props directly; updated parameters and error checks; default for dontAllowBlockToBeWiderThanContainerWidth now true.
services/course-material/src/components/ContentRenderer/moocfi/ConditionalBlock.tsx Modified JSX return structure; added dontAllowInnerBlocksToBeWiderThanParentBlock prop (set to false) for the InnerBlocks component.
services/course-material/src/components/ContentRenderer/util/InnerBlocks.tsx Added optional property dontAllowInnerBlocksToBeWiderThanParentBlock (default true) to the interface; updated component to pass this prop to ContentRenderer.
services/course-material/src/components/Page.tsx
services/course-material/src/pages/[organizationSlug]/exams/[id].tsx
services/course-material/src/pages/[organizationSlug]/exams/testexam/[id].tsx
Integrated new prop dontAllowBlockToBeWiderThanContainerWidth (set to false) into the ContentRenderer usage, enabling content blocks to exceed container width when applicable.
services/cms/tsconfig.json
services/course-material/tsconfig.json
services/example-exercise/tsconfig.json
services/main-frontend/tsconfig.json
services/quizzes/tsconfig.json
services/tmc/tsconfig.json
shared-module/packages/common/tsconfig.json
storybook/tsconfig.json
Updated "exclude" property to include "src/shared-module" in TypeScript configuration, changing compilation behavior.

Sequence Diagram(s)

sequenceDiagram
    participant Caller as Page/Exam Component
    participant CR as ContentRenderer
    participant IB as InnerBlocks

    Caller->>CR: Render with prop dontAllowBlockToBeWiderThanContainerWidth (false)
    Note right of CR: Destructure new props including width control
    CR->>IB: Forward dontAllowInnerBlocksToBeWiderThanParentBlock (dynamic/default)
    IB-->>CR: Render inner blocks with applied width rules
    CR-->>Caller: Output layout with updated rendering rules
Loading

Possibly related PRs

  • Table and footer fixes #1349: Addresses modifications similar to the new dontAllowBlockToBeWiderThanContainerWidth prop, affecting rendering logic in course material components.
  • More element of AI components #1333: Related to the ContentRenderer component modifications, specifically the introduction of a new import for AsideWithImageBlock.

Suggested labels

shared-module, system-tests

Poem

I'm a rabbit with a coding flair,
Hopping through changes with joyful air.
Props now spread like carrots in a row,
Layouts leap where flexible widths flow.
Tiny tweaks make this bunny glow!
Off we bound, through code we go!
🥕🐇

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2303ff2 and ef8cfad.

📒 Files selected for processing (8)
  • services/cms/tsconfig.json (1 hunks)
  • services/course-material/tsconfig.json (1 hunks)
  • services/example-exercise/tsconfig.json (1 hunks)
  • services/main-frontend/tsconfig.json (1 hunks)
  • services/quizzes/tsconfig.json (1 hunks)
  • services/tmc/tsconfig.json (1 hunks)
  • shared-module/packages/common/tsconfig.json (1 hunks)
  • storybook/tsconfig.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build
  • GitHub Check: build-and-deploy
  • GitHub Check: headless_lms
  • GitHub Check: code-style
🔇 Additional comments (8)
services/tmc/tsconfig.json (1)

29-29: Consistent Exclusion Update in TS Config.
Excluding "src/shared-module" along with "node_modules" ensures that shared module files are not inadvertently compiled in this service. This update aligns with the standardization across the project’s tsconfig settings.

shared-module/packages/common/tsconfig.json (1)

25-25: Standardizing Exclude List in Shared-Module.
Adding "src/shared-module" to the "exclude" array prevents pulling in unintended files during compilation and maintains consistency with other services’ tsconfig configurations.

services/cms/tsconfig.json (1)

24-24: CMS TypeScript Configuration Update.
The updated "exclude" property now ignores both "node_modules" and "src/shared-module", ensuring that only the intended files are processed. This is a good move for consistency across services.

services/main-frontend/tsconfig.json (1)

28-28: Main-Frontend TS Config Consistency.
Updating the exclusion to include "src/shared-module" standardizes the configuration and avoids potential compilation of shared code not meant for this service.

services/course-material/tsconfig.json (1)

29-29: Course Material TS Config Exclusion Refined.
Modifying the "exclude" field to add "src/shared-module" aligns the configuration with project-wide standards and helps ensure that only relevant files are compiled.

services/quizzes/tsconfig.json (1)

32-32: Ensure Consistent Exclusion of Shared Module Files

The exclusion list now includes "src/shared-module" alongside "node_modules", which is consistent with similar changes across the project. This update helps prevent unintended compilation of shared module files and can reduce build times.

services/example-exercise/tsconfig.json (1)

28-28: Update Exclude Configuration

The "exclude": ["node_modules", "src/shared-module"] update aligns this configuration with other project modules. This consistency will ensure that TypeScript skips compiling shared module content, streamlining the build process.

storybook/tsconfig.json (1)

28-28: Align Storybook TSConfig Exclusions

By adding "src/shared-module" to the exclude list, the configuration now mirrors the changes made in other tsconfig files. This change will prevent potential compilation conflicts or unexpected inclusion of shared module files during Storybook builds.


🪧 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 generate docstrings to generate docstrings for this 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.

@nygrenh nygrenh merged commit d383536 into master Mar 13, 2025
19 checks passed
@nygrenh nygrenh deleted the code-block-inside-aside branch March 13, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant