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

⚡️ Add loading screens #1553

Merged
merged 1 commit into from
Feb 8, 2025
Merged

⚡️ Add loading screens #1553

merged 1 commit into from
Feb 8, 2025

Conversation

lukevella
Copy link
Owner

@lukevella lukevella commented Feb 8, 2025

Summary by CodeRabbit

  • New Features
    • Introduced a visual loading indicator that displays a spinner during asynchronous operations.
    • Enhanced the user interface across multiple admin sections by replacing inactive loading states with dynamic spinners.

Copy link

vercel bot commented Feb 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 8, 2025 2:51pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
landing ⬜️ Skipped (Inspect) Feb 8, 2025 2:51pm

Copy link
Contributor

coderabbitai bot commented Feb 8, 2025

Walkthrough

Several admin-related components have been updated to provide a consistent loading indicator. New asynchronous Loading functions have been added in multiple directories, each returning a Spinner component from the shared component library. In addition, existing synchronous Loading functions that previously returned null have been transformed into asynchronous functions which now render the Spinner. These adjustments affect pages in events, polls, and various settings (billing, preferences, profile) to standardize the asynchronous loading UI.

Changes

File Path(s) Change Summary
apps/web/src/app/[locale]/(admin)/{events, loading, polls}/loading.tsx, apps/web/src/app/[locale]/(admin)/settings/loading.tsx New asynchronous Loading functions added that return a JSX element rendering a Spinner component from "@/components/spinner".
apps/web/src/app/[locale]/(admin)/settings/{billing,preferences,profile}/loading.tsx Modified Loading functions: updated from synchronous (returning null) to asynchronous, now importing and returning a Spinner component.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant A as Admin Page
  participant L as Loading Component
  participant S as Spinner

  U->>A: Navigates to admin section
  A->>L: Invokes Loading function
  L->>S: Imports and calls Spinner
  S-->>L: Returns Spinner JSX
  L-->>A: Renders Spinner in UI
Loading

Poem

In my burrow of code, I’ve hopped with glee,
Spinners now twirl for all the world to see.
Async magic dances in each new Loading call,
No more empty waits—now we animate them all!
A bunny’s cheer for changes that elegantly shine,
Hop, skip, and code on in this delightful design!


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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
Contributor

@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 (2)
apps/web/src/app/[locale]/(admin)/settings/billing/loading.tsx (1)

1-5: Well-structured loading component implementation!

Good use of Next.js 13+ loading component patterns with the async keyword and shared Spinner component for consistent loading UX across the admin interface.

apps/web/src/app/[locale]/(admin)/loading.tsx (1)

1-5: LGTM - Consider future UX enhancements!

Implementation follows the standardized loading pattern. Since this is the root admin loading component, consider adding delayed loading states or progress indicators in the future for better UX during longer loading periods.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 24558c2 and e6f2c9b.

📒 Files selected for processing (7)
  • apps/web/src/app/[locale]/(admin)/events/loading.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/loading.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/polls/loading.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/settings/billing/loading.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/settings/loading.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/settings/preferences/loading.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/settings/profile/loading.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Unit tests
  • GitHub Check: Type check
  • GitHub Check: Linting
  • GitHub Check: Integration tests
🔇 Additional comments (5)
apps/web/src/app/[locale]/(admin)/settings/profile/loading.tsx (1)

1-5: LGTM - Consistent with other loading components!

Implementation matches the standardized loading pattern used across the admin interface.

apps/web/src/app/[locale]/(admin)/settings/preferences/loading.tsx (1)

1-5: LGTM - Maintains loading component consistency!

Implementation follows the standardized loading pattern used throughout the admin interface.

apps/web/src/app/[locale]/(admin)/events/loading.tsx (1)

1-5: 🏁 Script executed:

#!/bin/bash
# Check Spinner component implementation
ast-grep --pattern 'export function Spinner() {
  $$$
}'

Length of output: 58

apps/web/src/app/[locale]/(admin)/settings/loading.tsx (1)

1-5: Implementation matches events route loading component.

The implementation is consistent with the events route loading component and follows Next.js conventions.

See the TypeScript return type suggestion in the events route loading component review.

apps/web/src/app/[locale]/(admin)/polls/loading.tsx (1)

1-5: Consider creating a shared loading component.

The implementation is consistent with other route loading components and follows Next.js conventions.

Since this loading UI is identical across multiple routes, consider creating a shared loading component to reduce code duplication:

// apps/web/src/components/loading.tsx
import { Spinner } from "@/components/spinner";

export default async function Loading(): Promise<JSX.Element> {
  return <Spinner />;
}

Then import and reuse it across routes:

export { default } from "@/components/loading";

See the TypeScript return type suggestion in the events route loading component review.

@lukevella lukevella merged commit 4e603d7 into main Feb 8, 2025
10 checks 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.

1 participant