Skip to content

feat: add day/night solar terminator overlay to map#529

Merged
koala73 merged 13 commits intokoala73:mainfrom
devalnor:feature/day-night-overlay
Feb 28, 2026
Merged

feat: add day/night solar terminator overlay to map#529
koala73 merged 13 commits intokoala73:mainfrom
devalnor:feature/day-night-overlay

Conversation

@devalnor
Copy link
Contributor

@devalnor devalnor commented Feb 28, 2026

image

In accordance with the contribution guidelines, this PR was made with the help of Claude Code (Opus 4.6) but has been reviewed and validated by me. The well-structured codebase and its documentation made it easy to understand the project and follow each development step alongside Claude. I hope this contribution will be appreciated!

Summary

  • Add a real-time Day/Night overlay layer using deck.gl PolygonLayer that renders the solar terminator (boundary between day and night zones)
  • Uses standard astronomical formulas (Meeus) to compute the subsolar point and trace the terminator line at 1° resolution
  • New toggleable layer available in all 3 variants (full/tech/finance) with theme-aware styling

Details

  • Rendering: Semi-transparent polygon over the night side of Earth, lighter on light theme, darker on dark theme
  • Performance: Cached polygon computation (not recomputed on every render), conditional 5-minute auto-refresh timer that only runs when the layer is enabled and pauses when render is paused
  • i18n: Translations added for all 17 locales (layer label, section label, help description)
  • Types: dayNight: boolean added to MapLayers interface and all variant/panel configs

Files changed

  • src/components/DeckGLMap.ts — Core implementation (computeNightPolygon, createDayNightLayer, timer management, toggle, help text)
  • src/types/index.ts — MapLayers type extension
  • src/config/panels.ts + src/config/variants/*.ts — Layer defaults for all variants
  • src/locales/*.json — i18n for 17 locales
  • src/e2e/*.ts — Test harness updates
  • docs/DOCUMENTATION.md — Layer documentation

Test plan

  • npm run typecheck passes for all 3 variants
  • npm run test:data — 91/91 pass
  • Visual verification on full, tech, and finance variants
  • Toggle on/off works correctly
  • Light and dark theme rendering verified
  • e2e failures (12) are pre-existing on main (runtime-fetch.spec.ts)

🤖 Generated with Claude Code

@vercel
Copy link

vercel bot commented Feb 28, 2026

@devalnor is attempting to deploy a commit to the Elie Team on Vercel.

A member of the Team first needs to authorize it.

@devalnor devalnor marked this pull request as draft February 28, 2026 11:37
koala73 and others added 12 commits February 28, 2026 12:37
- Add 5 Nigeria news sources to Africa section (Premium Times, Vanguard,
  Channels TV, Daily Trust, ThisDay)
- Add 5 Greek feeds with lang: 'el' for locale-aware filtering
  (Kathimerini, Naftemporiki, in.gr, iefimerida, Proto Thema)
- Add source tiers for all new outlets
- Allowlist 8 new domains in RSS proxy
…oala73#284)

* fix: add request coalescing to Redis cache layer

Concurrent cache misses for the same key now share a single upstream
fetch instead of each triggering redundant API calls. This eliminates
duplicate work within Edge Function invocations under burst traffic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: reduce AIS polling frequency from 10s to 30s

Vessel positions do not change meaningfully in 10 seconds at sea.
Reduces Railway relay requests by 66% with negligible UX impact.
Stale threshold bumped to 45s to match the new interval.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: quantize military flights bbox cache keys to 1-degree grid

Precise bounding box coordinates caused near-zero cache hit rate since
every map pan/zoom produced a unique key. Snapping to a 1-degree grid
lets nearby viewports share cache entries, dramatically reducing
redundant OpenSky API calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: parallelize ETF chart fetches instead of sequential await loop

The loop awaited each ETF chart fetch individually, blocking on every
Yahoo gate delay. Using Promise.allSettled lets all 10 fetches queue
concurrently through the Yahoo gate, cutting wall time from ~12s to ~6s.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add Redis pipeline batch GET to reduce round-trips

Add getCachedJsonBatch() using the Upstash pipeline API to fetch
multiple keys in a single HTTP call. Refactor aircraft details batch
handler from 20 sequential GETs to 1 pipelined request.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add structural tests for Redis caching optimizations

18 tests covering: cachedFetchJson request coalescing (in-flight dedup,
cache-before-fetch ordering, cleanup), getCachedJsonBatch pipeline API,
aircraft batch handler pipeline usage, bbox grid quantization (1-degree
step, expanded fetch bbox), and ETF parallel fetch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: enforce military bbox contract and add behavioral cache tests

---------

Co-authored-by: Elias El Khoury <efk@anghami.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…tion probes (koala73#296)

Sidecar validation probes were missing User-Agent headers, causing
Cloudflare-fronted APIs (e.g. Wingbits) to return 403 which was
incorrectly treated as an auth rejection. Added CHROME_UA to all 13
probes and isCloudflare403() helper to soft-pass CDN blocks.
)

Tauri WKWebView/WebView2 traps target="_blank" navigation, so news
links and other external URLs silently fail to open. Added a global
capture-phase click interceptor that routes cross-origin links through
the existing open_url Tauri command, falling back to window.open.
…73#308)

- Add levels, trends, fallback keys to top-level countryBrief in en/el/th/vi
  locales (fixes raw key display in intelligence brief and header badge)
- Add Export PDF option to country brief dropdown using scoped print dialog
- Add exportPdf i18n key to all 17 locale files
Add a real-time day/night overlay layer using deck.gl PolygonLayer that
renders the solar terminator (boundary between day and night zones).
The overlay uses astronomical formulas (Meeus) to compute the subsolar
point and trace the terminator line at 1° resolution.

- New toggleable "Day/Night" layer in all 3 variants (full/tech/finance)
- Theme-aware styling (lighter fill on light theme, darker on dark)
- Auto-refresh every 5 minutes with conditional timer (only runs when
  layer is enabled, pauses when render is paused)
- Cached polygon computation to avoid recomputing on every render
- i18n translations for all 17 locales
- Updated documentation with new layer entry

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@devalnor devalnor force-pushed the feature/day-night-overlay branch from 09810d0 to ac3d54a Compare February 28, 2026 11:48
@devalnor devalnor marked this pull request as ready for review February 28, 2026 11:55
- Replace safeTanDecl epsilon clamp with proper equinox handling:
  when |tanDecl| < 1e-6, draw terminator as vertical great circle
  through the poles (subsolar meridian ±90°) instead of clamping
- Fix JSON indentation in all 17 locale files: dayNight and
  tradeRoutes keys were left-aligned instead of matching 8-space
  indentation of surrounding keys
@koala73 koala73 added good first issue Good for newcomers area: map Map, globe, DeckGL visualization labels Feb 28, 2026
@koala73 koala73 merged commit 37b6bc1 into koala73:main Feb 28, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: map Map, globe, DeckGL visualization good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants