Skip to content

Fix types and add animated background - #12

Merged
bprosen merged 9 commits into
mainfrom
dev
Jan 18, 2026
Merged

bprosen merged 9 commits into
mainfrom
dev

Conversation

@bprosen

@bprosen bprosen commented Jan 18, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added VantaNet background effect component providing dynamic, interactive visual enhancements to pages.
    • Integrated color manipulation and parsing library.
    • External visual effect libraries (three.js and vanta.net) now loaded asynchronously at runtime.
  • Dependencies

    • Added culori library for advanced color handling.
    • Updated React type definitions and testing framework dependencies to latest compatible versions.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel

vercel Bot commented Jan 18, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
website Ready Ready Preview, Comment Jan 18, 2026 7:50pm

@coderabbitai

coderabbitai Bot commented Jan 18, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@bprosen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 33 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7bca12a and d908eca.

📒 Files selected for processing (2)
  • src/app/layout.tsx
  • src/ui/VantaNet.tsx
📝 Walkthrough

Walkthrough

The PR integrates Vanta.NET background effects into the application by adding the culori color-parsing dependency, loading external Vanta libraries via Script components in the root layout, defining TypeScript types for Vanta integration, creating a new VantaNet React component with configurable options and lifecycle management, and applying it to wrap the Home page content.

Changes

Cohort / File(s) Summary
Dependency Updates
package.json
Added culori (color parsing library); updated @types/react from ^19.1.13 to ^19.2.8; bumped @vitest/coverage-v8, @vitest/ui, and vitest from ^4.0.16 to ^4.0.17.
Type Definitions
src/types/Vanta.ts, src/types/index.ts, src/types/next-env.d.ts
New Vanta.ts file with exported VantaEffect interface and internal config types; global Window augmentation for optional VANTA property; index.ts re-exports Vanta module; next-env.d.ts adds Next.js TypeScript references.
UI Component & Exports
src/ui/VantaNet.tsx, src/ui/index.ts
New VantaNet component (134 lines) that mounts a Vanta.NET effect on a container with color resolution, library polling, and lifecycle cleanup; re-exported from ui/index.ts.
Layout & Script Loading
src/app/layout.tsx
Added Script components to load three.js and vanta.net libraries asynchronously in RootLayout.
Route Integration
src/routes/Home.tsx
Wrapped UnderConstruction component with VantaNet, passing configuration props (backgroundColor, className, maxDistance, spacing).
Configuration
components.json
Reordered JSON keys; aliases moved relative to iconLibrary with no value changes.

Sequence Diagram

sequenceDiagram
    participant Browser
    participant Script as Script Component
    participant Window as window.VANTA
    participant VantaNet as VantaNet Component
    participant Vanta as VANTA Library
    participant Container as DOM Container

    Browser->>Script: Load page
    Script->>Browser: Load three.js & vanta.net externally
    Browser->>Window: Libraries execute, window.VANTA available
    Browser->>VantaNet: Mount component
    VantaNet->>VantaNet: Poll window.VANTA availability
    VantaNet->>VantaNet: Resolve colors (CSS vars, culori parse)
    VantaNet->>Vanta: VANTA.NET(config)
    Vanta->>Container: Initialize effect on container
    Container->>Browser: Render background mesh
    VantaNet->>Browser: Render children above effect
    Browser->>VantaNet: Unmount component
    VantaNet->>Vanta: Destroy effect instance
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇✨ A mesh of dancing dots now twirls,
With colors swirling, backgrounds whirl!
The Vanta dream comes into view,
Three.js magic, fresh and new.
Our canvas blooms with cosmic spree! 🌌

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding Vanta.NET animated background component and establishing TypeScript type definitions for Vanta integration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@src/types/next-env.d.ts`:
- Around line 1-3: Delete the duplicate auto-generated file
src/types/next-env.d.ts (which contains the triple-slash references to "next",
"next/image-types/global", and the relative "./.next/types/routes.d.ts") so only
the repository-root next-env.d.ts remains; ensure no code references expect the
src/types copy and that the root next-env.d.ts exists and contains the necessary
triple-slash references.

In `@src/ui/VantaNet.tsx`:
- Around line 128-133: In the VantaNet component return, avoid appending the
literal "undefined" by ensuring containerClassName and className default to
empty strings or by using a class-merge helper; update the JSX that builds class
names (references: containerClassName and className in the VantaNet component)
to coalesce each value (e.g., containerClassName || '' and className || '') or
replace the template literals with a utility like clsx/cn to merge classes
safely so undefined values are never rendered.
- Line 30: Fix the typo in the default color value in VantaNet (the default
prop/variable named color is set to '#FFFFFFF'); change it to the correct
6-digit hex '#FFFFFF' so the component uses a valid white color value (look for
the color = '#FFFFFFF' occurrence in VantaNet.tsx and update it to '#FFFFFF').
- Around line 94-112: The cleanup currently returns early when polling for
window.VANTA, so when Vanta initializes via the interval the vantaInstance is
never destroyed; refactor the effect so the interval ID (checkInterval) is
declared in the outer scope of the effect and remove the early return — always
return a single cleanup that clears the interval if set and also calls
vantaInstance.current.destroy?.() and nulls vantaInstance.current; touch the
initVanta, vantaRef, vantaInstance symbols to ensure the interval logic and
final cleanup both have access to the same variables.
🧹 Nitpick comments (2)
src/ui/VantaNet.tsx (2)

63-68: Add null safety for TypeScript strictness.

Although vantaRef.current is checked at line 53 before resolveColor is called, TypeScript's type narrowing doesn't propagate into the nested function closure. Consider adding a null check or non-null assertion.

Proposed fix
          if (colorValue.includes('var(')) {
-           const computedColor = getComputedStyle(vantaRef.current)
+           const computedColor = getComputedStyle(vantaRef.current!)
              .getPropertyValue(colorValue.replace(/var\((--[\w-]+)\)/, '$1'))
              .trim();

45-48: Prop changes don't update the Vanta effect.

The early return at line 46 when vantaInstance.current exists means changing props (e.g., backgroundColor, spacing) after initial mount won't update the Vanta effect. If dynamic prop updates are intended, you'd need to destroy and reinitialize, or use Vanta's update methods if available.

If prop updates should be reflected, consider destroying and reinitializing:

  useEffect(() => {
-   if (!vantaRef.current || vantaInstance.current) {
+   if (!vantaRef.current) {
      return;
    }
+
+   // Destroy existing instance before reinitializing with new props
+   if (vantaInstance.current) {
+     vantaInstance.current.destroy?.();
+     vantaInstance.current = null;
+   }

Comment thread src/types/next-env.d.ts Outdated
Comment thread src/ui/VantaNet.tsx Outdated
Comment thread src/ui/VantaNet.tsx
Comment thread src/ui/VantaNet.tsx
@bprosen
bprosen merged commit 6cad84d into main Jan 18, 2026
7 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jan 18, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jan 31, 2026

This branch was successfully deployed

1 active deployment
Preview — d908eca2 Deployed Jan 18, 2026 by vercel[bot]
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