Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Jun 12, 2025

closes #10976

Summary by CodeRabbit

  • New Features

    • Introduced a new layout component providing a responsive navigation panel, adaptive headers, and role-aware UI elements.
    • Added a dedicated stylesheet for enhanced layout responsiveness and visual consistency.
    • Implemented a new message for closing the navigation panel.
  • Refactor

    • Simplified layout structure by consolidating navigation and header logic into the new layout component.
    • Streamlined parameter passing and cascading value handling for improved maintainability.
    • Updated components to use default cascading parameter binding for theme and user information.
  • Style

    • Enhanced layout responsiveness and appearance through new SCSS styles.

@msynk msynk requested a review from ysmoradi June 12, 2025 08:57
@coderabbitai
Copy link

coderabbitai bot commented Jun 12, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update refactors the layout system in the Boilerplate project template. It extracts a new AppShell component for layout logic, removes redundant cascading parameter names, and updates related components and styles. Several component parameters and constants are simplified or removed, and navigation panel state handling is improved with new pub-sub messages.

Changes

File(s) Change Summary
.../Components/Layout/AppShell.razor, .../Components/Layout/AppShell.razor.cs, .../Components/Layout/AppShell.razor.scss Introduced new AppShell layout component and its stylesheet; manages navigation panel, headers, and responsive layout.
.../Components/Layout/MainLayout.razor, .../Components/Layout/MainLayout.razor.cs Refactored to use AppShell; removed explicit layout structure and redundant logic; simplified cascading values.
.../Components/Parameters.cs Removed constants for redundant cascading parameter names; only IsOnline remains.
.../Components/Common/ProductImage.razor, .../Components/Common/ProductImage.razor.cs Moved parameters and cascading parameter declarations from markup to code-behind partial class.
.../Components/Layout/Header/AppMenu.razor.cs, .../Components/Layout/Header/IdentityHeader.razor.cs, .../Components/Layout/AppAiChatPanel.razor.cs, .../Components/Pages/Settings/Account/AccountSection.razor.cs, .../Components/Pages/Settings/ProfileSection.razor.cs Removed explicit Name attributes from [CascadingParameter] properties; now rely on default matching.
.../Components/Layout/AppAiChatPanel.razor Improved null handling for IconUrl; minor formatting fix.
.../Services/ClientPubSubMessages.cs Added new constant CLOSE_NAV_PANEL for pub-sub messaging.

Sequence Diagram(s)

sequenceDiagram
    participant MainLayout
    participant AppShell
    participant BitNavPanel
    participant PubSub
    participant User

    MainLayout->>AppShell: Render with navPanelItems, isIdentityPage, ChildContent
    AppShell->>BitNavPanel: Conditionally render based on isIdentityPage
    User->>AppShell: Interact (e.g., open/close nav panel, sign-in, update app)
    AppShell->>PubSub: Subscribe to OPEN_NAV_PANEL and CLOSE_NAV_PANEL
    PubSub-->>AppShell: Notify to open/close nav panel
    AppShell->>AppShell: Update nav panel state and UI
Loading

Assessment against linked issues

Objective (Issue) Addressed Explanation
Extract new components from MainLayout (#10976)
Remove redundant names of CascadingValues (#10976)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation

Poem

In the warren where layouts grow,
The shell emerged with a tidy flow.
Redundant names now hop away,
While panels open, close, and play.
With cleaner code, the rabbit grins—
Refactored bliss, let spring begin!
🐇✨

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch 10976-templates-boilerplate-mainlayout-improvements
  • Post Copyable Unit Tests in Comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests 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.

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

🧹 Nitpick comments (9)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/ClientPubSubMessages.cs (1)

16-18: Add XML-doc & keep alphabetical order for new constant

CLOSE_NAV_PANEL is a welcome addition, but:

  1. Constants are currently alphabetically grouped; inserting after OPEN_NAV_PANEL breaks that ordering.
  2. Other message constants have an XML-doc where additional context is useful for tooling (OPEN_NAV_PANEL lacks it as well, but we shouldn’t amplify the pattern).
-    public const string OPEN_NAV_PANEL = nameof(OPEN_NAV_PANEL);
-    public const string CLOSE_NAV_PANEL = nameof(CLOSE_NAV_PANEL);
+    /// <summary>Publish to request opening the navigation panel.</summary>
+    public const string OPEN_NAV_PANEL = nameof(OPEN_NAV_PANEL);
+    /// <summary>Publish to request closing the navigation panel.</summary>
+    public const string CLOSE_NAV_PANEL = nameof(CLOSE_NAV_PANEL);
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Header/IdentityHeader.razor.cs (1)

31-34: Avoid needless async keyword

HandleGoHomeLink is declared async Task but performs no await. Drop async and return void, or add await Task.CompletedTask; to silence analyzers.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Common/ProductImage.razor (1)

1-4: Guard against empty Width producing invalid style

When Width is null/empty the inline style becomes width:;, which is invalid CSS and may break layout.
Consider emitting the width rule only when a value is supplied:

<div style="@(!string.IsNullOrWhiteSpace(Width) ? $"width:{Width};overflow:hidden;position:relative;" : "overflow:hidden;position:relative;")" class="@Class">
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor (1)

8-13: Deep cascade chain is hard to maintain

Five nested <CascadingValue> wrappers add noise and risk mismatched names. Now that AppShell encapsulates most layout concerns, consider moving these CascadingValues inside AppShell (or a dedicated provider component) to flatten MainLayout and improve readability.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Common/ProductImage.razor.cs (1)

5-10: Add minimal validation or XML docs

Parameters like Width expect CSS units; adding summary comments or simple validation (e.g., ensure units present) would make the component more self-documenting and safer for consumers.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppShell.razor (2)

9-15: Remove redundant IsNavPanelOpen parameter

@bind-IsOpen="isNavPanelOpen" operates on the private field, while the public IsNavPanelOpen parameter declared in the code-behind is never used.
Delete the unused parameter or switch the binding to it to avoid two sources of truth.


65-67: Add alt text for accessibility

BitImage renders decorative content without any Alt attribute.
Provide meaningful alt text (or explicit empty alt when decorative) to satisfy WCAG 2.1 AA.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppShell.razor.cs (1)

10-12: Delete or wire up IsNavPanelOpen parameter

This parameter is declared but never used, which is misleading.
Either bind the panel to it or remove it to keep the public surface minimal.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.cs (1)

29-33: Update XML doc or remove dead reference

The summary still refers to Parameters.IsOnline, which no longer exists.
Trim or update the comment to match the current code.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 2651572 and 266b6d7.

📒 Files selected for processing (15)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Common/ProductImage.razor (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Common/ProductImage.razor.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppAiChatPanel.razor (2 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppAiChatPanel.razor.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppShell.razor (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppShell.razor.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppShell.razor.scss (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Header/AppMenu.razor.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Header/IdentityHeader.razor.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.cs (6 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Settings/Account/AccountSection.razor.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Settings/ProfileSection.razor.cs (2 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Parameters.cs (0 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/ClientPubSubMessages.cs (1 hunks)
💤 Files with no reviewable changes (1)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Parameters.cs
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build and test
🔇 Additional comments (7)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppAiChatPanel.razor (1)

42-43: LGTM – whitespace correction only

The AutoScroll attribute trim is purely cosmetic and correct.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppAiChatPanel.razor.cs (1)

13-14: Verify cascading parameter binding after name removal

Dropping the explicit Name = … relies on default matching by type or property name.
If another AppThemeType? is cascaded higher in the tree, the binding may become ambiguous.
Please double-check that there is exactly one such cascade source; otherwise re-introduce an explicit name.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Settings/ProfileSection.razor.cs (1)

10-11: Potential ambiguity in CurrentUser cascade after explicit name removal

Same concern as for AppAiChatPanel: ensure only a single UserDto cascade exists; otherwise keep the name to avoid accidental mismatch (especially in unit tests & prerender).

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Settings/Account/AccountSection.razor.cs (1)

7-8: Confirm single‐source cascade for UserDto

CurrentUser now binds by type/name. If both anonymous and typed cascades exist (e.g., one for auth, one for impersonation), Blazor will pick the closest, which might not be intended. Please audit upstream providers.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Header/IdentityHeader.razor.cs (1)

5-8: Verify cascade ambiguity after dropping Name attribute

Removing Name = Parameters.CurrentTheme makes the parameter match by type only. If multiple AppThemeType values are provided higher up (e.g., theme override for dialogs), resolution will be ambiguous at runtime. Double-check that only one unnamed AppThemeType is cascaded through the component tree.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor (1)

20-21: Confirm ModalParameters constant rename

BitModalContainer now expects ModalParameters. Make sure the backing field in MainLayout.razor.cs is public or at least accessible; otherwise binding will fail at runtime.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Header/AppMenu.razor.cs (1)

11-13: Verify cascade source after removing Name attributes

The parameters will now match solely by type.
Please double-check that every ancestor cascading UserDto / AppThemeType has also dropped the custom Name or these values will arrive as null at runtime.

msynk and others added 11 commits June 12, 2025 12:30
Signed-off-by: Yaser Moradi <ysmoradi@outlook.com>
Signed-off-by: Yaser Moradi <ysmoradi@outlook.com>
Signed-off-by: Yaser Moradi <ysmoradi@outlook.com>
@ysmoradi ysmoradi merged commit a7089ab into bitfoundation:develop Jun 12, 2025
3 checks passed
@msynk msynk deleted the 10976-templates-boilerplate-mainlayout-improvements branch June 12, 2025 14:11
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.

The MainLayout component needs some improvements in the Boilerplate project template

2 participants