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

Improve offline web app support across projects (#10200) #10201

Merged
merged 7 commits into from
Mar 8, 2025

Conversation

ysmoradi
Copy link
Member

@ysmoradi ysmoradi commented Mar 7, 2025

closes #10200

Summary by CodeRabbit

  • New Features

    • Added an "Offline support web app" link on the Demos page for convenient access.
    • Introduced caching on the About page to enhance performance.
  • Refactor

    • Updated navigation to dynamically display the offline edit profile option.
    • Enabled access to the Offline Edit Profile page without requiring prior authorization.
  • Chores

    • Refined build and template configurations to disable multilingual support by default and streamline project setup workflows.

@ysmoradi ysmoradi requested a review from msynk March 7, 2025 12:49
Copy link

coderabbitai bot commented Mar 7, 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 pull request updates various project configurations and components. The workflow now omits SignalR and disables multilingual support during builds. Template exclusion patterns have been refined, and navigation handling in the MainLayout component has been refactored. The offline edit profile page no longer requires authorization and features updated namespace and styling paths. Additionally, a caching attribute is added to the About page, an imports file gains a new using directive, and a new offline support link along with its URL constant has been introduced on the Demos page.

Changes

File(s) Change Summary
.github/workflows/todo-sample.cd.yml Removed --signalR option from dotnet new and added -p:MultilingualEnabled=false to build and publish commands.
src/.../template.json Updated exclusion pattern from "Authorized/Offline/**" to "OfflineEditProfile*" in the template configuration.
src/.../MainLayout.razor.cs
src/.../MainLayout.razor.items.cs
Removed old navigation item fields in the razor.cs file and introduced dynamic list initialization and population in the razor.items.cs file.
src/.../OfflineEditProfilePage.razor
src/.../OfflineEditProfilePage.razor.cs
src/.../compilerconfig.json
Removed [Authorize] attribute, updated namespace from Authorized.Offline to Pages, and simplified input/output paths for associated style files.
src/.../AboutPage.razor Added caching attribute [AppResponseCache(SharedMaxAge = 3600 * 24 * 7, MaxAge = 60 * 5)] to define cache durations.
src/.../_Imports.razor Added using directive for Boilerplate.Shared.Attributes.
src/Websites/Platform/.../DemosPage.razor
src/Websites/Platform/.../Urls.cs
Added a new offline support button on the Demos page linking to a URL defined by the new constant TodoOfflineWebApp.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant ML as MainLayout
    participant OEP as OfflineEditProfilePage
    Note over ML: Dynamic initialization of navigation items
    U->>ML: Open application
    ML-->>U: Display navigation options
    U->>ML: Click "Offline Edit Profile"
    ML->>OEP: Load page (no authorization)
    OEP-->>U: Render offline profile content
Loading
sequenceDiagram
    participant U as User
    participant DP as DemosPage
    participant Browser as Browser Tab
    U->>DP: Visit Demos page
    DP-->>U: Show "Offline support web app" link
    U->>Browser: Click link (opens new tab)
    Browser->>U: Display Offline Support Web App via TodoOfflineWebApp URL
Loading

Poem

I'm a coding rabbit, hopping with glee,
New paths and tweaks set our project free.
Signal dropped and styles realigned,
Auth removed so all can find.
With offline links and cache so bright,
I nibble on code through day and night! 🐇


🪧 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.

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

🧹 Nitpick comments (1)
.github/workflows/todo-sample.cd.yml (1)

211-211: Remove trailing whitespace.

There's a trailing whitespace at the end of this line that should be removed.

-      run: dotnet build TodoSample/src/Client/TodoSample.Client.Core/TodoSample.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -p:MultilingualEnabled=false --no-restore -c Release 
+      run: dotnet build TodoSample/src/Client/TodoSample.Client.Core/TodoSample.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -p:MultilingualEnabled=false --no-restore -c Release
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 211-211: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d549874 and b29215c.

📒 Files selected for processing (11)
  • .github/workflows/todo-sample.cd.yml (2 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.cs (0 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.items.cs (2 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/OfflineEditProfilePage.razor (0 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/OfflineEditProfilePage.razor.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/compilerconfig.json (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Components/Pages/AboutPage.razor (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/_Imports.razor (1 hunks)
  • src/Websites/Platform/src/Bit.Websites.Platform.Client/Pages/DemosPage.razor (1 hunks)
  • src/Websites/Platform/src/Bit.Websites.Platform.Client/Shared/Urls.cs (1 hunks)
💤 Files with no reviewable changes (2)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/OfflineEditProfilePage.razor
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.cs
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/todo-sample.cd.yml

[error] 211-211: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build and test
🔇 Additional comments (11)
src/Websites/Platform/src/Bit.Websites.Platform.Client/Shared/Urls.cs (1)

52-52: New URL constant for offline web app support looks good.

The addition of the TodoOfflineWebApp constant provides a clear reference to the offline edit profile feature. This supports the PR's goal of improving offline web app capabilities.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Components/Pages/AboutPage.razor (1)

3-3:

❓ Verification inconclusive

Appropriate caching strategy for static content.

Adding the AppResponseCache attribute with a 7-day shared cache and 5-minute individual cache is a good approach for this presumably static page. This will reduce server load and improve performance for returning visitors.


🏁 Script executed:

#!/bin/bash
# Check if AppResponseCache is used consistently across other static pages
rg -l "AppResponseCache" --type razor

Length of output: 67


Below is a revised response that highlights the caching attribute’s proven benefit while noting the need for a manual check of its consistent application across Razor files. In your local environment, please verify using a command like the one provided below:

#!/bin/bash
find . -type f -name "*.razor" -exec grep -l "AppResponseCache" {} \;

Caching Strategy Verified – Please Manually Confirm Across Razor Pages
• The use of AppResponseCache with a 7-day shared cache and 5-minute individual cache is appropriate for static content, as it reduces server load and improves performance.
• Since the original search command using --type razor failed, ensure that caching is applied consistently in other Razor pages by running the alternative command above.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/_Imports.razor (1)

20-20: Appropriate namespace import for attributes.

The addition of @using Boilerplate.Shared.Attributes is necessary to support the AppResponseCache attribute used in the AboutPage. This change is consistent with the PR's goal of enhancing offline capabilities.

src/Websites/Platform/src/Bit.Websites.Platform.Client/Pages/DemosPage.razor (1)

129-129: New offline support link integrates well with existing navigation options.

Adding the "Offline support web app" button provides users with clear access to the offline functionality. The placement within the Todo section is appropriate, and the styling matches other secondary buttons.

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

5-5: Good change to the namespace structure.

Moving the class from the Authorized.Offline namespace to the root Pages namespace aligns with removing the authorization requirement, making the profile page accessible for both authenticated and unauthenticated users in offline mode.

src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json (1)

472-472: Exclusion pattern correctly updated.

The exclusion pattern now targets specific files with the OfflineEditProfile prefix rather than everything in the Authorized/Offline directory, which is consistent with the namespace changes and provides more precise control over excluded files.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/compilerconfig.json (1)

201-202: Path structure correctly updated.

The SCSS/CSS file paths have been updated to reflect the new location of the OfflineEditProfilePage component, removing the Authorized/Offline subdirectory path segment to maintain consistency with the namespace changes.

.github/workflows/todo-sample.cd.yml (2)

192-192: SignalR dependency removed for offline support.

Removing the --signalR parameter from project creation is appropriate for enhancing offline support, as SignalR requires a persistent connection which isn't available in offline mode.


210-210: Disabling multilingual support for offline scenarios.

Adding -p:MultilingualEnabled=false to build and publish commands is a good optimization for offline applications, as it reduces bundle size and eliminates dependencies that may not work properly without network connectivity.

Also applies to: 213-213

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

5-7: Good restructuring of navigation items.

Moving to separate lists for authenticated and unauthenticated items makes the code more maintainable and clarifies the navigation structure.


74-87: Improved navigation accessibility for offline mode.

Adding the offline edit profile page to both authenticated and unauthenticated navigation menus is consistent with removing the authorization requirement, ensuring all users can access this functionality when offline.

@ysmoradi ysmoradi changed the title improve offline web app support across projects (#10200) Improve offline web app support across projects (#10200) Mar 7, 2025
@ysmoradi ysmoradi marked this pull request as draft March 7, 2025 19:36
@msynk msynk marked this pull request as ready for review March 8, 2025 09:32
@msynk msynk merged commit 001acb6 into bitfoundation:develop Mar 8, 2025
3 checks passed
@ysmoradi ysmoradi deleted the 10200 branch March 8, 2025 10:34
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.

Offline web app support needs improvements across projects
2 participants