feat(UniverSheet): add auto switch darkmode function#7391
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRemoves the hard-coded IsDarkMode flag from the UniverSheet sample so the component can use its built-in automatic dark mode behavior. Sequence diagram for automatic dark mode switching in UniverSheetsequenceDiagram
actor User
participant Browser
participant AppLayout
participant ThemeService
participant UniverSheet
User->>Browser: Load_UniverSheet_sample_page
Browser->>AppLayout: Initialize_page
AppLayout->>ThemeService: Get_current_theme
ThemeService-->>AppLayout: theme_state
AppLayout->>UniverSheet: Render_without_IsDarkMode_parameter
User->>AppLayout: Toggle_dark_mode
AppLayout->>ThemeService: Set_theme(dark)
ThemeService-->>AppLayout: theme_updated
AppLayout->>Browser: Apply_dark_theme_styles
Browser->>UniverSheet: Propagate_theme_change
UniverSheet-->>Browser: Re_render_in_dark_mode
User->>AppLayout: Toggle_light_mode
AppLayout->>ThemeService: Set_theme(light)
ThemeService-->>AppLayout: theme_updated
AppLayout->>Browser: Apply_light_theme_styles
Browser->>UniverSheet: Propagate_theme_change
UniverSheet-->>Browser: Re_render_in_light_mode
Class diagram for UniverSheets sample usage after removing IsDarkModeclassDiagram
class UniverSheetsPage {
- _sheetExcel UniverSheet
- _jsonData string
OnReadyAsync()
OnSaveExcelData()
}
class UniverSheet {
+ RibbonType UniverSheetRibbonType
+ OnReadyAsync()
+ AutoDetectDarkMode()
}
class UniverSheetRibbonType {
}
UniverSheetsPage --> UniverSheet : uses
UniverSheet --> UniverSheetRibbonType : configures
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull request overview
This pull request adds auto-switching dark mode functionality to the UniverSheet component by upgrading to version 10.0.5 of the BootstrapBlazor.UniverSheet package and removing the explicit IsDarkMode="false" parameter from the demo component.
Key Changes:
- Removed hardcoded dark mode setting to enable automatic dark mode detection
- Updated BootstrapBlazor.UniverSheet package from version 10.0.4 to 10.0.5
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor | Removed the IsDarkMode="false" parameter from the UniverSheet component to enable auto-switching of dark mode |
| src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj | Updated BootstrapBlazor.UniverSheet package version from 10.0.4 to 10.0.5 to support the new auto dark mode feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| </section> | ||
| <div class="bb-sheet-demo"> | ||
| <UniverSheet @ref="_sheetExcel" OnReadyAsync="OnReadyAsync" RibbonType="UniverSheetRibbonType.Default" IsDarkMode="false"></UniverSheet> | ||
| <UniverSheet @ref="_sheetExcel" OnReadyAsync="OnReadyAsync" RibbonType="UniverSheetRibbonType.Default"></UniverSheet> |
There was a problem hiding this comment.
The IsDarkMode parameter has been removed from this component instance to enable auto-switching of dark mode. However, the localization files (en-US.json and zh-CN.json) at line 7015 still reference the IsDarkMode parameter in the NormalDescDarkMode key, stating it controls whether the component uses dark mode. This documentation should be updated to reflect the new auto-switching behavior instead of mentioning a parameter that is no longer being used in the demo.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7391 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 748 748
Lines 32793 32793
Branches 4551 4551
=========================================
Hits 32793 32793
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #7390
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
New Features: