Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Sep 19, 2025

closes #11426

Summary by CodeRabbit

  • New Features
    • BitMessage now supports automatic dismissal after a configurable duration via AutoDismissTime.
  • Documentation
    • Updated BitMessage demo to showcase auto-dismiss behavior with a 5-second example and reset flow.
    • Added parameter description for AutoDismissTime in the demo to clarify usage and timing with OnDismiss.

@coderabbitai
Copy link

coderabbitai bot commented Sep 19, 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

Adds AutoDismissTime to BitMessage for timed dismissal via OnAfterRenderAsync and updates demos to showcase auto-dismiss behavior with state toggling and parameter documentation.

Changes

Cohort / File(s) Summary
Core Component: BitMessage
src/BlazorUI/Bit.BlazorUI/Components/Notifications/Message/BitMessage.razor.cs
Adds public parameter TimeSpan? AutoDismissTime. Implements OnAfterRenderAsync(bool firstRender) to await the specified delay on first render and invoke OnDismiss, then refresh UI.
Demo: Message component pages
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Notifications/Message/BitMessageDemo.razor, .../BitMessageDemo.razor.cs, .../BitMessageDemo.razor.samples.cs
Introduces auto-dismiss example: new isAutoDismissed state, renders BitMessage with AutoDismissTime=TimeSpan.FromSeconds(5) and toggling logic; updates parameter list and sample code accordingly.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Page as Demo Page
  participant Msg as BitMessage
  participant Timer as Task.Delay
  participant App as App/Parent (OnDismiss)

  User->>Page: Navigate/Render demo
  Page->>Msg: Render BitMessage(AutoDismissTime=5s)
  activate Msg
  Note right of Msg: firstRender: true
  Msg->>Timer: await AutoDismissTime
  Timer-->>Msg: delay elapsed
  Msg->>App: OnDismiss.InvokeAsync()
  App-->>Msg: Complete
  Msg->>Msg: StateHasChanged()
  deactivate Msg
  Page-->>User: Message dismissed (UI updated)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A tick, a tock, a message blinks—
Five seconds pass, it softly winks.
I twitch my ears, “Dismiss!” I cheer,
The toast hops off and disappears.
Click to reset, I’ll watch the time—
Auto‑dismiss, a rhythmic chime. 🐇⏲️

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Add AutoDismissTime parameter to BitMessage (#11426)" succinctly and accurately captures the primary change — adding an AutoDismissTime parameter to the BitMessage component to enable auto-dismiss behavior — and matches the modifications reported in the BitMessage implementation and demos.
Linked Issues Check ✅ Passed The changes fulfill linked issue #11426: a nullable TimeSpan AutoDismissTime property was added to BitMessage and an OnAfterRenderAsync implementation triggers OnDismiss after the specified delay, and demo/sample updates demonstrate usage, so the coding objective to add AutoDismissTime is met.
Out of Scope Changes Check ✅ Passed The modified files are limited to the BitMessage component and its demo/sample pages per the raw_summary, and there are no unrelated or extraneous changes outside the scope of implementing and demonstrating AutoDismissTime.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (4)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Notifications/Message/BitMessageDemo.razor.cs (1)

24-30: Doc: mention OnDismiss requirement and non-negative duration

Nice addition. Suggest clarifying that auto-dismiss only activates when OnDismiss has a delegate, and that non-positive values are ignored.

Apply this diff to tweak the description:

-            Description = "Enables the auto-dismiss feature and sets the time to automatically call the OnDismiss callback.",
+            Description = "Enables auto-dismiss and sets the delay before calling OnDismiss. Requires OnDismiss to be set. Non-positive values disable auto-dismiss.",
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Notifications/Message/BitMessageDemo.razor (1)

155-166: Auto‑dismiss demo: works; minor a11y note

The example behaves as intended. Consider mentioning in the demo text that the message auto-dismisses after 5 seconds so users aren’t surprised. Also be mindful that timed content can affect some users; keep delays reasonable and ensure important info isn’t lost.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Notifications/Message/BitMessageDemo.razor.samples.cs (1)

109-120: Grammar nit: “alongside of” → “alongside”

Tiny copy edit for the sample text.

Apply this diff:

-    <BitMessage AutoDismissTime="TimeSpan.FromSeconds(5)" OnDismiss="() => isAutoDismissed = true">
-        Auto-Dismiss option enabled by adding <strong>AutoDismissTime</strong> parameter alongside of OnDismiss.
+    <BitMessage AutoDismissTime="TimeSpan.FromSeconds(5)" OnDismiss="() => isAutoDismissed = true">
+        Auto-Dismiss option enabled by adding <strong>AutoDismissTime</strong> parameter alongside OnDismiss.
src/BlazorUI/Bit.BlazorUI/Components/Notifications/Message/BitMessage.razor.cs (1)

23-27: Clarify parameter contract

Consider documenting that auto-dismiss triggers only once on first render, requires OnDismiss, and ignores non-positive durations to avoid exceptions from negative TimeSpan values.

Apply this doc tweak:

-    /// Enables the auto-dismiss feature and sets the time to automatically call the OnDismiss callback.
+    /// Enables auto-dismiss and sets the delay before invoking OnDismiss.
+    /// Triggers once on first render. Requires <see cref="OnDismiss"/> to be set.
+    /// Non-positive values disable auto-dismiss.
📜 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 1fce940 and 4412088.

📒 Files selected for processing (4)
  • src/BlazorUI/Bit.BlazorUI/Components/Notifications/Message/BitMessage.razor.cs (2 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Notifications/Message/BitMessageDemo.razor (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Notifications/Message/BitMessageDemo.razor.cs (2 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Notifications/Message/BitMessageDemo.razor.samples.cs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build and test
🔇 Additional comments (2)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Notifications/Message/BitMessageDemo.razor.cs (1)

484-485: State for demo behavior looks good

New isAutoDismissed flag aligns with the demo changes.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Notifications/Message/BitMessageDemo.razor.samples.cs (1)

122-123: Sample state addition LGTM

Fields mirror the demo and keep the snippet self-contained.

@msynk msynk merged commit 8b97e71 into bitfoundation:develop Sep 20, 2025
3 checks passed
@msynk msynk deleted the 11426-blazorui-message-auto-dismiss branch September 20, 2025 08:15
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.

Missing AutoDismiss feature from the BitMessage component

1 participant