Skip to content

feat(satellites): add interactive spotlight effect for hover/select (#95)#142

Merged
krishkhinchi merged 3 commits into
7-Blocks:mainfrom
SankeerthNara:Interactive-Satellite-Spotlight-Effect
Jul 26, 2026
Merged

feat(satellites): add interactive spotlight effect for hover/select (#95)#142
krishkhinchi merged 3 commits into
7-Blocks:mainfrom
SankeerthNara:Interactive-Satellite-Spotlight-Effect

Conversation

@SankeerthNara

@SankeerthNara SankeerthNara commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

User description

Summary

Implements the Interactive Satellite Spotlight Effect requested in #95. Hovering or clicking a satellite now visually highlights it — brighter color, larger size, a smooth ~220ms transition — while dimming nearby objects so it stands out. The active satellite's orbit path is drawn with a glowing polyline, and collision-risk satellites get a stronger red highlight plus a warning badge. Clicking locks the spotlight (cleared by clicking empty space or Escape), double-clicking flies the camera to the target, and a new info card shows name, NORAD ID, orbit type, altitude, and health/risk status while selected. Arrow-key navigation, Enter/Space to select, and a visible focus ring on the globe container are included for keyboard/accessibility support, and all transitions respect prefers-reduced-motion.

The implementation follows the folder structure suggested in the issue (components/SatelliteSpotlight/, hooks/, styles/spotlight.css) and is designed to be reusable for other object types later — swapping what populates the entity/catalog maps is enough to reuse the same spotlight system elsewhere.

Highlight/dim state is diffed against the previous hover/selection, so a hover change only ever touches the previously-active and newly-active entities rather than iterating the whole dataset, keeping it performant with large catalogs.

Related Issue

Fixes #95

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 📚 Documentation update
  • 🚀 Performance improvement
  • 🎨 UI/UX enhancement
  • 🔧 Refactoring
  • 🧹 Chore / Maintenance
  • 🔒 Security improvement

Testing Performed

  • Tested locally
  • Tested relevant functionality
  • Checked for linting errors
  • Checked for TypeScript/build errors
  • Tested responsive behavior (if applicable)

tsc -b shows no new type errors compared to the unmodified baseline (31 pre-existing errors in unrelated files, unchanged). ESLint is clean on all new/modified files aside from two pre-existing setState-in-effect patterns that already exist elsewhere in the codebase. Full manual click-through against live satellite data is still pending in my environment due to an unrelated local backend/DB setup issue — will update with screenshots once verified, or happy to have a maintainer test the branch directly in the meantime.

Breaking Changes

None. EarthTwin.tsx's existing hover/click behavior is replaced by the new spotlight system but the external interface (props, store usage) is unchanged.

Checklist

  • I have read and followed the contributing guidelines.
  • My code follows the project's coding standards and guidelines.
  • I have completed testing of my changes.
  • I have updated documentation where applicable.
  • I have checked that my changes do not introduce unintended regressions.

CodeAnt-AI Description

Add interactive satellite spotlighting and keyboard navigation

What Changed

  • Hovering over a tracked object highlights it, dims nearby objects, shows its name, and draws its orbit path.
  • Clicking locks the spotlight and opens an information card with the satellite’s NORAD ID, orbit type, altitude, and health or conjunction-risk status.
  • Double-clicking focuses the camera on the selected satellite; clicking empty space or pressing Escape clears the selection.
  • Arrow keys navigate between objects, while Enter or Space selects the focused object with a visible keyboard focus indicator.
  • Collision-risk satellites receive stronger red highlighting and a warning badge, while spotlight transitions respect reduced-motion preferences.
  • The globe no longer includes the previous save-view and bookmarks controls.

Impact

✅ Clearer satellite identification
✅ Faster camera focus on tracked objects
✅ Keyboard-accessible globe navigation
✅ More visible conjunction risks

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • New Features
    • Added Satellite Spotlight with hover highlighting, click selection, and double-click camera focus, including a selected-satellite info card and keyboard navigation (arrow keys, Enter/Space, Esc).
    • Added highlighted orbit paths and animated point/outline visual states (baseline/dimmed/highlighted).
  • Accessibility
    • Improved keyboard focus handling and added reduced-motion support for camera movement and spotlight animations.
  • UI/Improvements
    • Updated HUD/legend layout and added loading skeletons for collision status; spotlight behavior now refreshes cleanly on dataset updates.

Greptile Summary

Adds an interactive Cesium satellite spotlight system.

  • Introduces hover, click, double-click, and keyboard selection behavior.
  • Adds animated highlight/dimming states, orbit polylines, and collision-risk styling.
  • Adds a selected-satellite information card and reduced-motion-aware presentation.

Confidence Score: 3/5

The PR is not yet safe to merge because bookmark workflows remain unreachable and shadowed satellites remain visually indistinguishable from illuminated ones.

EarthTwin still omits all bookmark integration and shared-link restoration, while entity creation and spotlight baseline restoration continue to apply fixed opacity without evaluating satellite illumination.

Files Needing Attention: frontend/src/components/EarthTwin.tsx, frontend/src/components/SatelliteSpotlight/GlowEffect.tsx

Important Files Changed

Filename Overview
frontend/src/components/EarthTwin.tsx Integrates the spotlight manager and refactors Cesium entity setup, while previously reported bookmark and illumination regressions remain unresolved.
frontend/src/components/SatelliteSpotlight/SpotlightManager.tsx Coordinates pointer and keyboard interactions, spotlight state, and the selected-object information card.
frontend/src/components/SatelliteSpotlight/OrbitHighlight.tsx Generates highlighted orbit polylines and now varies orbital radius for eccentric objects.
frontend/src/hooks/useSpotlightEffect.ts Applies diffed baseline, dimmed, and highlighted visual states across refreshed Cesium datasets.
frontend/src/components/SatelliteSpotlight/GlowEffect.tsx Implements reduced-motion-aware point transitions, but its fixed baseline opacity participates in the outstanding illumination regression.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Input[Mouse or keyboard input] --> Manager[SpotlightManager]
  Manager --> Selection[Hover and selection hooks]
  Selection --> Visuals[Spotlight visual state]
  Visuals --> Entities[Cesium entities]
  Visuals --> Orbit[Orbit highlight]
  Selection --> Card[Satellite info card]
Loading

Reviews (3): Last reviewed commit: "Merge branch 'main' into Interactive-Sat..." | Re-trigger Greptile

@codeant-ai

codeant-ai Bot commented Jul 25, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 6b5fe56 Jul 25, 2026 · 17:38 17:41
✅ Reviewed your PR a12e1b4 Jul 25, 2026 · 16:32 16:47

@github-actions github-actions Bot added bug Something isn't working database Database and schema related changes documentation Improvements or additions to documentation enhancement New feature or request frontend Frontend development size/XL Very large or complex contribution. type:bug Fixes an existing bug or unexpected behavior. type:documentation Improves project documentation. type:feature Introduces a new feature or enhancement. type:frontend Changes frontend or client-side code. labels Jul 25, 2026
@codeant-ai codeant-ai Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Jul 25, 2026
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

EarthTwin now delegates satellite hover, selection, keyboard navigation, animated spotlight visuals, orbit highlighting, and selected-object details to reusable modules. Shared satellite types and visual constants are centralized, while globe overlays and loading states are updated.

Changes

Satellite Spotlight

Layer / File(s) Summary
Shared satellite contracts and visuals
frontend/src/types/satellite.ts, frontend/src/lib/satelliteVisuals.ts, frontend/src/components/EarthTwin.tsx
Shared catalog/collision types and category-based Cesium styling helpers are introduced and consumed by EarthTwin, with stronger orbital-position validation.
Animated entity and orbit effects
frontend/src/components/SatelliteSpotlight/GlowEffect.tsx, frontend/src/components/SatelliteSpotlight/OrbitHighlight.tsx, frontend/src/hooks/useSpotlightEffect.ts
Entity point and label states animate between baseline, dimmed, and highlighted modes, while the active satellite receives a replaceable glowing orbit polyline.
Interaction hooks and selection UI
frontend/src/hooks/useSatelliteHover.ts, frontend/src/hooks/useSatelliteSelection.ts, frontend/src/components/SatelliteSpotlight/SpotlightManager.tsx, frontend/src/components/SatelliteSpotlight/SpotlightInfoCard.tsx, frontend/src/styles/spotlight.css
Mouse hover, click selection, double-click camera focus, keyboard navigation, selected-satellite details, collision styling, and reduced-motion presentation are added.
EarthTwin wiring and overlay updates
frontend/src/components/EarthTwin.tsx
Cesium interaction ownership moves to SpotlightManager; entity data, dataset changes, and viewer cleanup are updated, while HUD, collision, summary, and legend overlays are revised.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CesiumViewer
  participant SpotlightManager
  participant useSatelliteHover
  participant useSatelliteSelection
  participant useSpotlightEffect
  participant SpotlightInfoCard
  User->>CesiumViewer: hover or click satellite
  CesiumViewer->>SpotlightManager: picked entity event
  SpotlightManager->>useSatelliteHover: process mouse movement
  SpotlightManager->>useSatelliteSelection: update selection
  SpotlightManager->>useSpotlightEffect: provide hover or selected ID
  useSpotlightEffect->>CesiumViewer: dim entities and highlight orbit
  SpotlightManager->>SpotlightInfoCard: render selected satellite details
Loading

Possibly related PRs

  • 7-Blocks/Kepler#99: Both changes modify EarthTwin satellite visual styling and Cesium lighting behavior.
  • 7-Blocks/Kepler#129: Both changes modify EarthTwin bookmark controls and camera restore handling.

Suggested labels: ECSoC26, ECSoC26-L2

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also removes bookmark/shared-view flow and changes satellite rendering unrelated to the spotlight requirements, so it includes extra scope beyond #95. Split bookmark/view-state cleanup and unrelated rendering refactors into a separate PR, or restore them if they are required; keep this PR focused on spotlight behavior.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the requested hover/select spotlight, orbit emphasis, lock/clear behavior, collision-risk styling, camera focus, keyboard access, and reduced-motion support.
Title check ✅ Passed The title clearly matches the PR’s main change: adding an interactive spotlight effect for satellite hover and selection.
Description check ✅ Passed The description covers summary, issue link, change type, testing, breaking changes, and checklist; only screenshots are missing.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the AI Artificial Intelligence and Machine Learning label Jul 25, 2026
<div className="bg-status-success/20 border border-status-success px-3 md:px-4 py-1 flex items-center gap-2">
<MaterialIcon name="verified_user" className="text-status-success text-sm" />
<span className="font-technical-data text-status-success text-[11px] md:text-[12px] font-bold">
ALL CLEAR

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Bookmark workflows become unreachable

When a Dashboard user tries to save or reopen a globe view, or follows an existing shared-bookmark URL, EarthTwin no longer exposes the bookmark controls, modal/sidebar integration, or shared-URL restoration call, causing all bookmark management actions to disappear and shared links to be silently ignored.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/components/EarthTwin.tsx
Line: 417

Comment:
**Bookmark workflows become unreachable**

When a Dashboard user tries to save or reopen a globe view, or follows an existing shared-bookmark URL, EarthTwin no longer exposes the bookmark controls, modal/sidebar integration, or shared-URL restoration call, causing all bookmark management actions to disappear and shared links to be silently ignored.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 148 to +149
pixelSize,
color: sunlit ? colorConfig.cesium.withAlpha(0.85) : colorConfig.cesium.withAlpha(0.3),
outlineColor: sunlit ? colorConfig.cesium.withAlpha(0.4) : colorConfig.cesium.withAlpha(0.1),
color: colorConfig.cesium.withAlpha(0.85),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Satellite illumination state is lost

When a tracked satellite enters Earth's shadow, entity population now assigns the same fixed color and outline opacity used for illuminated satellites while globe lighting is disabled, causing shadowed objects to remain visually indistinguishable from sunlit ones.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/components/EarthTwin.tsx
Line: 148-149

Comment:
**Satellite illumination state is lost**

When a tracked satellite enters Earth's shadow, entity population now assigns the same fixed color and outline opacity used for illuminated satellites while globe lighting is disabled, causing shadowed objects to remain visually indistinguishable from sunlit ones.

How can I resolve this? If you propose a fix, please make it concise.

Comment thread frontend/src/components/SatelliteSpotlight/OrbitHighlight.tsx Outdated
@github-actions github-actions Bot added GitHub Actions GitHub Actions workflows and CI/CD github-actions GitHub Actions workflows and CI/CD labels Jul 25, 2026

@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

🧹 Nitpick comments (2)
frontend/src/hooks/useSpotlightEffect.ts (1)

52-130: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

No effect cleanup on unmount or viewer swap.

The effect never returns a teardown, so on unmount (or when viewer changes) the orbit highlight is left in place and the refs keep state that no longer matches the new viewer. Consider clearing the highlight and resetting dimmedIdsRef/prevActiveIdRef/lastDatasetVersionRef in a cleanup keyed on viewer.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/hooks/useSpotlightEffect.ts` around lines 52 - 130, Add cleanup
to the useEffect so unmounts and viewer changes call clearOrbitHighlight for the
current viewer and reset dimmedIdsRef, prevActiveIdRef, and
lastDatasetVersionRef. Return this teardown from the effect, keyed to the
existing viewer dependency, without changing the active/hover highlight
behavior.
frontend/src/components/EarthTwin.tsx (1)

12-53: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Earth-radius constant and orbital-position math are duplicated across three files. EARTH_RADIUS/EARTH_RADIUS_KM/literal 6371 and the GMST/RAAN/inclination sweep are each re-implemented rather than shared, risking silent divergence if one site is ever tuned (e.g. a more precise radius, or a J2 correction) without the others.

  • frontend/src/components/EarthTwin.tsx#L12-L53: extract EARTH_RADIUS and the GMST/position-from-orbital-elements logic in keplerToLatLonAlt into a shared module (e.g. frontend/src/lib/orbitalMath.ts) that both this file and OrbitHighlight.tsx import.
  • frontend/src/components/SatelliteSpotlight/OrbitHighlight.tsx#L15-L62: replace the local EARTH_RADIUS_KM constant and duplicated GMST/argLat/lon/lat computation with the shared helper instead of re-deriving it.
  • frontend/src/components/SatelliteSpotlight/SpotlightInfoCard.tsx#L26-L26: import the shared Earth-radius constant instead of the inline literal 6371 for the altitude calculation.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/components/EarthTwin.tsx` around lines 12 - 53, Create a shared
orbital math module exporting the Earth-radius constant and a helper for GMST
and orbital-element position calculations, then update
frontend/src/components/EarthTwin.tsx lines 12-53 to use it from
keplerToLatLonAlt, frontend/src/components/SatelliteSpotlight/OrbitHighlight.tsx
lines 15-62 to remove its local EARTH_RADIUS_KM and duplicated position math in
favor of the helper, and
frontend/src/components/SatelliteSpotlight/SpotlightInfoCard.tsx line 26 to
import the shared radius instead of using the literal 6371.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/components/EarthTwin.tsx`:
- Around line 328-341: Replace the inline toLatLonAlt wrapper in EarthTwin’s
SpotlightManager props with the stable module-level keplerToLatLonAlt function
reference, preserving its existing default-argument behavior and preventing
useSatelliteSelection’s click-handler effect from re-registering on hover-driven
renders.

In `@frontend/src/components/SatelliteSpotlight/GlowEffect.tsx`:
- Around line 95-122: Update applyDim to explicitly reset point.outlineWidth to
baseline.outlineWidth alongside the other point style properties, ensuring
previously highlighted entities lose their widened outline when dimmed.

In `@frontend/src/hooks/useSatelliteSelection.ts`:
- Around line 80-98: Update the double-click handler in useSatelliteSelection
around viewer.camera.flyTo so it respects the shared prefersReducedMotion()
result used by GlowEffect.tsx: skip the animated flyTo when reduced motion is
preferred, while preserving the existing destination and duration behavior
otherwise. Extract or reuse the preference utility rather than duplicating
detection logic.
- Around line 64-78: Update the LEFT_CLICK handler in useSatelliteSelection to
focus the existing globe container after both selectSatellite and clearSelection
paths. Reuse the container element already rendered by EarthTwin with
tabIndex={0}, ensuring mouse interactions restore focus for SpotlightManager
keyboard handling without focusing the Cesium canvas.

---

Nitpick comments:
In `@frontend/src/components/EarthTwin.tsx`:
- Around line 12-53: Create a shared orbital math module exporting the
Earth-radius constant and a helper for GMST and orbital-element position
calculations, then update frontend/src/components/EarthTwin.tsx lines 12-53 to
use it from keplerToLatLonAlt,
frontend/src/components/SatelliteSpotlight/OrbitHighlight.tsx lines 15-62 to
remove its local EARTH_RADIUS_KM and duplicated position math in favor of the
helper, and frontend/src/components/SatelliteSpotlight/SpotlightInfoCard.tsx
line 26 to import the shared radius instead of using the literal 6371.

In `@frontend/src/hooks/useSpotlightEffect.ts`:
- Around line 52-130: Add cleanup to the useEffect so unmounts and viewer
changes call clearOrbitHighlight for the current viewer and reset dimmedIdsRef,
prevActiveIdRef, and lastDatasetVersionRef. Return this teardown from the
effect, keyed to the existing viewer dependency, without changing the
active/hover highlight behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d690bca5-31a3-4999-927e-3718167a6b62

📥 Commits

Reviewing files that changed from the base of the PR and between 0ffff9b and a12e1b4.

📒 Files selected for processing (11)
  • frontend/src/components/EarthTwin.tsx
  • frontend/src/components/SatelliteSpotlight/GlowEffect.tsx
  • frontend/src/components/SatelliteSpotlight/OrbitHighlight.tsx
  • frontend/src/components/SatelliteSpotlight/SpotlightInfoCard.tsx
  • frontend/src/components/SatelliteSpotlight/SpotlightManager.tsx
  • frontend/src/hooks/useSatelliteHover.ts
  • frontend/src/hooks/useSatelliteSelection.ts
  • frontend/src/hooks/useSpotlightEffect.ts
  • frontend/src/lib/satelliteVisuals.ts
  • frontend/src/styles/spotlight.css
  • frontend/src/types/satellite.ts

Comment thread frontend/src/components/EarthTwin.tsx
Comment thread frontend/src/components/SatelliteSpotlight/GlowEffect.tsx
Comment thread frontend/src/hooks/useSatelliteSelection.ts
Comment thread frontend/src/hooks/useSatelliteSelection.ts

@krishkhinchi krishkhinchi 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.

LGTM!!

@krishkhinchi
krishkhinchi merged commit 9152665 into 7-Blocks:main Jul 26, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Artificial Intelligence and Machine Learning bug Something isn't working database Database and schema related changes documentation Improvements or additions to documentation enhancement New feature or request frontend Frontend development GitHub Actions GitHub Actions workflows and CI/CD github-actions GitHub Actions workflows and CI/CD size/XL Very large or complex contribution. size:XXL This PR changes 1000+ lines, ignoring generated files type:bug Fixes an existing bug or unexpected behavior. type:documentation Improves project documentation. type:feature Introduces a new feature or enhancement. type:frontend Changes frontend or client-side code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🌠 Implement Interactive Satellite Spotlight Effect for Enhanced Object Selection

2 participants