Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

feat: enhance GlobeRenderer with orbit rings#57

Merged
Sithumli merged 1 commit intomainfrom
fix/globe
Mar 20, 2026
Merged

feat: enhance GlobeRenderer with orbit rings#57
Sithumli merged 1 commit intomainfrom
fix/globe

Conversation

@Sithumli
Copy link
Copy Markdown
Member

@Sithumli Sithumli commented Mar 20, 2026

This pull request introduces a significant visual and functional overhaul to the GlobeRenderer component, focusing on orbit ring animations, improved point positioning, and enhanced globe styling. The main changes group into new orbit ring features, globe appearance updates, and point animation logic improvements.

Orbit ring animation and configuration:

  • Added an OrbitConfig interface and created three orbit rings with distinct tilts, speeds, and radii, animating their visibility based on the currently visible points. [1] [2]
  • Orbit rings are properly cleaned up on component unmount to prevent memory leaks.

Globe appearance improvements:

  • Introduced a custom purple-magenta tinted material for the globe and updated the atmosphere color for a more vibrant look. [1] [2]

Point animation and positioning logic:

  • Reworked point position calculation: points now animate along orbit rings instead of latitude/longitude, with scaling based on their position relative to the viewer. [1] [2]
  • Improved logic for determining when a point is "in center" (now based on Z position), and adjusted scaling behavior for points at the front of the globe.

UI tweaks:

  • Updated the styling for point icons, making the background more subtle and removing the border for a cleaner look.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added three animated orbit rings circling the globe with independently configurable properties (radius, speed, tilt angles, and start angles).
  • Style

    • Applied purple-tinted material to the globe and updated atmosphere color to purple (#8B5CF6) for refreshed visual appearance.
  • Improvements

    • Refined point positioning using orbit-based computation for smoother animations.
    • Enhanced visibility tracking to improve rendering performance and reliability.

@Sithumli Sithumli self-assigned this Mar 20, 2026
@Sithumli Sithumli added the area: frontend UI/UX, Next.js, Tailwind, shadcn/ui label Mar 20, 2026
Copilot AI review requested due to automatic review settings March 20, 2026 17:10
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 20, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This change refactors the globe point rendering system to use orbit-based positioning instead of spherical coordinates. Points now orbit along configurable tilted circular paths with dynamic visibility tracking via refs. The globe material is updated to purple-tinted styling, and orbit ring resources are properly cleaned up.

Changes

Cohort / File(s) Summary
Orbit Ring System & Point Rendering Overhaul
src/components/backgrounds/GlobeRenderer.tsx
Replaced point lat/lng computation with orbit-based positioning using three configurable ring objects (radius, speed, tiltX, tiltZ, startAngle). Removed generatePointsData() helper and emptied pointsData(). Reworked visibility tracking via visiblePointsRef for animation loop access. Updated Z-based center detection (normalizedZ > 0.7) and scaling thresholds. Applied purple-tinted MeshPhongMaterial and changed atmosphere color to #8B5CF6. Added orbit ring resource cleanup on effect teardown.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 Around and around the orbits go,
Purple spheres with cosmic glow,
Points that dance on tilted rings,
The globe renderer spreads its wings!
Old spheres fade, new orbits spin,
A whimsical change begins!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: enhance GlobeRenderer with orbit rings' clearly and accurately reflects the main change: adding orbit ring visuals and animations to the GlobeRenderer component, which is a primary objective of this PR.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/globe

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.

Tip

CodeRabbit can use your project's `biome` configuration to improve the quality of JS/TS/CSS/JSON code reviews.

Add a configuration file to your project to customize how CodeRabbit runs biome.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying ui-kit with  Cloudflare Pages  Cloudflare Pages

Latest commit: 321294b
Status: ✅  Deploy successful!
Preview URL: https://f39ce6e6.ui-kit-d46.pages.dev
Branch Preview URL: https://fix-globe.ui-kit-d46.pages.dev

View logs

@github-actions
Copy link
Copy Markdown
Contributor

Preview Package Published

A preview version of this package has been published to npm!

Version: 0.0.39-pr57.1
Tag: pr-preview

Install this specific commit

npm install @b3-crow/ui-kit@0.0.39-pr57.1
# or
bun add @b3-crow/ui-kit@0.0.39-pr57.1
# or
yarn add @b3-crow/ui-kit@0.0.39-pr57.1

Install latest commit from this PR

npm install @b3-crow/ui-kit@pr-preview
# or
bun add @b3-crow/ui-kit@pr-preview
# or
yarn add @b3-crow/ui-kit@pr-preview

Note: Each commit gets a unique preview version. The pr-preview tag always points to the latest preview. All preview versions for this PR will be automatically cleaned up when the PR is closed.

@Sithumli Sithumli merged commit 02bc776 into main Mar 20, 2026
4 of 5 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates GlobeRenderer to add animated orbit rings, switch point positioning to orbit-based animation, and refresh the globe’s visual styling (material + atmosphere), along with minor UI styling tweaks for point icons.

Changes:

  • Added orbit ring configs and runtime ring creation with opacity animation tied to point visibility.
  • Reworked point positioning/scaling logic to animate points along orbit paths rather than lat/lng projection.
  • Updated globe styling via a custom material and new atmosphere color; adjusted point icon container styling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 95 to +99
const timeout = setTimeout(() => {
setVisiblePoints(prev => new Set(prev).add(i));
setVisiblePoints(prev => {
const next = new Set(prev).add(i);
visiblePointsRef.current = next;
return next;
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

On displayPoints change, the stagger-reveal logic only ever adds indices; it never clears visiblePoints / visiblePointsRef. That can leave points (and orbit ring opacity) visible from a previous points prop, skipping the intended reveal for new data. Consider resetting both sets before scheduling the new timeouts.

Copilot uses AI. Check for mistakes.
Comment on lines +137 to +143
// Create custom purple-tinted material for the globe
const globeMaterial = new THREE.MeshPhongMaterial({
color: new THREE.Color(0.85, 0.45, 0.95), // Purple-magenta tint
emissive: new THREE.Color(0x3a2559),
emissiveIntensity: 0.25,
shininess: 5,
});
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

globeMaterial is created inside the effect but never disposed in the cleanup. Since Three.js materials allocate GPU resources, consider disposing this material (and ideally removing/disposing the globe object as well) in the effect cleanup to avoid leaks on unmount/remount.

Copilot uses AI. Check for mistakes.
Comment on lines +243 to +246
const positions: PointPosition[] = displayPoints.map((_point, index) => {
if (index >= orbitConfigs.length) {
return { x: 0, y: 0, z: -1, scale: 0, opacity: 0, isInCenter: false };
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

displayPoints.map returns a hidden placeholder when index >= orbitConfigs.length, which effectively limits the renderer to 3 points. Any additional points will become "visible" (via visiblePoints) but never get a real position, leading to missing/incorrect UI for callers that pass more than 3 points. Consider mapping points onto orbit configs (e.g., modulo assignment) or generating orbit configs/angles per point so all provided points animate and render.

Copilot uses AI. Check for mistakes.
Comment on lines +231 to +234
// Update orbit ring visibility based on visible points
orbitRings.forEach((ring, index) => {
const material = ring.material as THREE.LineBasicMaterial;
const targetOpacity = visiblePointsRef.current.has(index) ? 0.3 : 0;
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

Orbit ring opacity is keyed off visiblePointsRef.current.has(index), where index is the ring index (0..2). Since visiblePoints tracks point indices, this only works coincidentally for the first three points; it won’t correctly show a ring when points are assigned differently (or if you later support >3 points). Consider deriving each ring’s visibility from whether any visible point is mapped to that ring.

Suggested change
// Update orbit ring visibility based on visible points
orbitRings.forEach((ring, index) => {
const material = ring.material as THREE.LineBasicMaterial;
const targetOpacity = visiblePointsRef.current.has(index) ? 0.3 : 0;
// Update orbit ring visibility based on visible points mapped to each ring
const visibleRingIndices = new Set<number>();
visiblePointsRef.current.forEach(pointIndex => {
if (pointIndex >= 0 && pointIndex < orbitConfigs.length) {
visibleRingIndices.add(pointIndex);
}
});
orbitRings.forEach((ring, index) => {
const material = ring.material as THREE.LineBasicMaterial;
const targetOpacity = visibleRingIndices.has(index) ? 0.3 : 0;

Copilot uses AI. Check for mistakes.
const rendererRef = useRef<THREE.WebGLRenderer | null>(null);
const animationRef = useRef<number | undefined>(undefined);
const globeRef = useRef<ThreeGlobe | null>(null);
const orbitRingsRef = useRef<THREE.Line[]>([]);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

orbitRingsRef is declared but never read anywhere in this component. If it’s not needed for external access or a follow-up effect, consider removing it to avoid dead state; otherwise add the usage that requires it.

Suggested change
const orbitRingsRef = useRef<THREE.Line[]>([]);

Copilot uses AI. Check for mistakes.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: frontend UI/UX, Next.js, Tailwind, shadcn/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants