Skip to content

feat(layout/observer): Add user preference for dark theme in LayoutObserver component. - #21255

Merged
ramonlsouza merged 4 commits into
bigbluebutton:v3.0.x-releasefrom
Scroody:i-21228
Sep 30, 2024
Merged

ramonlsouza merged 4 commits into
bigbluebutton:v3.0.x-releasefrom
Scroody:i-21228

Conversation

@Scroody

@Scroody Scroody commented Sep 25, 2024 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR implements a feature request to add a new parameter, userdata-bbb_prefer_dark_theme=true, which allows frontends to specify whether a user prefers to join a BigBlueButton (BBB) session in dark mode or normal mode.

Closes Issue(s)

Closes #21228 and #21260 (partial)

Motivation

This was requested during the Community Call on September 17.

How to test

Create a session with the following custom parameter: userdata-bbb_prefer_dark_theme=true

@coderabbitai

coderabbitai Bot commented Sep 25, 2024 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes introduce functionality in the LayoutObserver component to accommodate user preferences for dark theme settings. A new constant, showDarkThemeDefault, retrieves the user's dark theme preference from user settings, defaulting to the application's standard setting if none is found. The Settings singleton is updated to reflect this preference, allowing the application to better align with user customization regarding the dark theme. Additionally, the API documentation has been updated to reflect new endpoints and parameters related to meeting and recording management.

Changes

File Change Summary
bigbluebutton-html5/imports/ui/components/layout/observer.tsx Added functionality to handle user preferences for dark theme settings, including a new constant showDarkThemeDefault to retrieve and set the user's dark theme preference.
bigbluebutton-html5/imports/ui/services/settings/index.js Introduced import for getFromUserSettings to determine the default value for dark theme settings in the Settings class constructor.
docs/docs/administration/customize.md Updated documentation on customizing the BigBlueButton server, including configuration options and scripts for preserving changes during upgrades.
docs/docs/development/api.md Comprehensive updates to the BigBlueButton API reference, detailing changes across various API endpoints, including new parameters and functionalities.

Assessment against linked issues

Objective Addressed Explanation
Implement parameter to pre-set dark theme / dark mode (#[21228]) ✅

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 98c6931 and 4acfc57.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/components/layout/observer.tsx (1 hunks)
🔇 Additional comments not posted (1)
bigbluebutton-html5/imports/ui/components/layout/observer.tsx (1)

Line range hint 1-283: Overall implementation looks good with minor clarification needed.

The changes to implement the dark theme preference are well-integrated into the existing LayoutObserver component. The implementation follows the general structure and practices of the codebase.

However, as mentioned in the previous comment, there's a slight discrepancy between the PR objectives and the actual implementation regarding the parameter name. Once this is clarified or addressed, the implementation appears to be ready for merging.

@Scroody Scroody added this to the Release 3.0 milestone Sep 25, 2024

@ramonlsouza ramonlsouza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dark mode remains enabled after a refresh if bbb_prefer_dark_theme=true and the user selects dark mode = off in the settings modal

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (8)
docs/docs/development/api.md (4)

115-115: Approved: New parameter for dark theme preference added.

The addition of userdata-bbb_prefer_dark_theme to the join endpoint is correctly documented and aligns with the PR objectives. This change enhances user experience by allowing frontends to specify dark mode preferences.

Consider adding a brief explanation of the parameter's functionality, e.g., "Allows frontends to specify if a user prefers to join the session in dark mode."


Line range hint 1055-1055: Approved: Join endpoint parameters updated.

The join endpoint documentation has been correctly updated with new parameters, including userdata-bbb_prefer_dark_theme. The removal of deprecated parameters and replacement of others indicate a positive evolution of the API.

For clarity, consider adding a brief note explaining why defaultLayout was removed and replaced by userdata-bbb_default_layout. This would help developers understand the transition between API versions.


Line range hint 1784-1827: Excellent addition: Supported Document Types section.

The new "Supported Document Types" section is a valuable addition to the documentation. It provides a clear and comprehensive list of supported file formats, which is crucial information for developers integrating with BigBlueButton.

To further enhance this section, consider adding links to the mentioned backend and frontend lists for developers who might need more detailed information. For example:

For more detailed information, see the [backend list](https://github.com/bigbluebutton/bigbluebutton/blob/v2.7.10/bbb-common-web/src/main/java/org/bigbluebutton/presentation/MimeTypeUtils.java#L28-L47) and [frontend list](https://github.com/bigbluebutton/bigbluebutton/blob/v2.7.10/bigbluebutton-html5/private/config/settings.yml#L824-L862).

Line range hint 1-1827: Comprehensive and valuable API documentation update.

This update to the API documentation is thorough and aligns well with the PR objectives. Key improvements include:

  1. Addition of the userdata-bbb_prefer_dark_theme parameter to support dark mode preferences.
  2. Updated join endpoint documentation reflecting new and replaced parameters.
  3. New "Supported Document Types" section providing clear information on file format support.

These changes significantly enhance the documentation's value for developers integrating with BigBlueButton.

To further improve the documentation:

  1. Consider adding a "Changes Log" section at the beginning of the document to highlight recent updates. This would help returning developers quickly identify new features or changes.
  2. Ensure that all new parameters and features are consistently documented across relevant sections of the API documentation.
docs/docs/administration/customize.md (4)

1455-1455: Consider adding more details about the dark theme feature

While the new parameter is correctly documented, it might be helpful to provide more context about the dark theme feature. For example, you could mention when it was introduced, any limitations, or how it interacts with other theme-related settings.


1455-1455: Enhance the gladia.io configuration section

The new section on configuring gladia.io is a valuable addition. However, consider the following improvements:

  1. Add a brief explanation of what gladia.io is and its benefits for BigBlueButton users.
  2. Clarify if there are any costs associated with using gladia.io, especially after the free trial.
  3. Mention any performance implications or requirements for using this feature.
  4. Consider adding a troubleshooting subsection for common issues users might encounter.

These additions would make the documentation more comprehensive and user-friendly.


1455-1455: Enhance the meeting configuration table

The table of meeting configuration parameters is a useful addition. Consider the following improvements:

  1. Add a brief introduction explaining where and how these configurations can be applied.
  2. For boolean options, consistently use "true/false" instead of mixing with "Integer (0=disable)" for clarity.
  3. Consider grouping related parameters (e.g., all timeout-related settings) for better organization.
  4. Add links to relevant sections of the documentation for parameters that might need more detailed explanation.
  5. Include information about which BigBlueButton version introduced each parameter, if applicable.

These changes would make the table more user-friendly and informative.


Line range hint 1-1455: Consider overall document structure and navigation improvements

The document has been significantly expanded with valuable information. To improve its usability, consider the following suggestions:

  1. Add a table of contents at the beginning of the document for easier navigation.
  2. Use consistent heading levels throughout the document for better structure.
  3. Consider breaking this large document into smaller, more focused pages if it becomes too long.
  4. Add cross-references between related sections to help users find relevant information.
  5. Include a "What's New" or "Recently Added" section to highlight recent changes or additions to the customization options.

These improvements would make the document more navigable and user-friendly, especially as it continues to grow with new customization options.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4acfc57 and cad1b0d.

📒 Files selected for processing (2)
  • docs/docs/administration/customize.md (1 hunks)
  • docs/docs/development/api.md (1 hunks)
🔇 Additional comments (1)
docs/docs/administration/customize.md (1)

1455-1455: New parameter added for dark theme preference

The addition of the userdata-bbb_prefer_dark_theme parameter is a good enhancement for user customization. It allows setting the dark theme as the default option.

@Scroody
Scroody requested a review from ramonlsouza September 30, 2024 13:08
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (2)
bigbluebutton-html5/imports/ui/services/settings/index.js (2)

36-39: LGTM: Correct implementation of dark theme preference.

The implementation correctly retrieves the user's dark theme preference, falling back to the default setting if not specified. This aligns well with the PR objectives.

Consider adding a brief comment explaining the purpose of this code block for improved readability:

+// Retrieve user's dark theme preference, falling back to default if not specified
 const showDarkThemeDefault = getFromUserSettings(
   'bbb_prefer_dark_theme',
   window.meetingClientSettings.public.app.defaultSettings.application.darkTheme,
 );

Line range hint 6-41: Overall: Well-implemented feature for user dark theme preference.

The changes successfully implement the user preference for dark theme as requested. The code is clean, concise, and integrates well with the existing Settings class. Great job!

To complete this feature:

  1. Update the documentation as suggested in the PR comments:

    • Add a line to the customization documentation at https://github.com/bigbluebutton/bigbluebutton/blob/v3.0.x-release/docs/docs/administration/customize.md?plain=1#L1455
    • Mention the new parameter in the API documentation at https://github.com/bigbluebutton/bigbluebutton/blob/v3.0.x-release/docs/docs/development/api.md?plain=1#L115
  2. Consider adding unit tests to verify the behavior of the new dark theme preference setting.

  3. Ensure that the LayoutObserver component (mentioned in the PR title but not present in this file) correctly uses this new setting.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between cad1b0d and 5fa6b56.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/services/settings/index.js (2 hunks)
🔇 Additional comments (2)
bigbluebutton-html5/imports/ui/services/settings/index.js (2)

6-6: LGTM: New import for user settings.

The new import for getFromUserSettings is correctly placed and aligns with the PR objectives to implement user preferences for the dark theme.


41-41: LGTM: Correct assignment of dark theme preference.

The dark theme preference is correctly assigned to the writable default values.

To ensure this change doesn't introduce any unintended side effects, please verify that:

  1. The dark theme is correctly applied when the user preference is set.
  2. The system default is used when no user preference is specified.
  3. The user can still override this setting within the application.

You can test this by:

  1. Creating a session with userdata-bbb_prefer_dark_theme=true
  2. Creating a session without specifying the parameter
  3. Changing the theme within the application after joining with each of the above scenarios

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

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.

Implement parameter to pre-set dark theme / dark mode

3 participants