1.5.7
Profile memory Comment cleanup
This commit is contained in:
+12
-12
@@ -1,12 +1,12 @@
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
// events.js — Cosmic & weather event engine for SunScope.
|
||||
// ------------------------------------------------------------------------
|
||||
// events.js - Cosmic & weather event engine for SunScope.
|
||||
//
|
||||
// This is the public-facing barrel module. It composes the smaller files
|
||||
// under ./events/ and exposes the same API as before, so callers
|
||||
// (app.js, components.js) keep working without changes.
|
||||
//
|
||||
// Returns the "active event" (or null) based on:
|
||||
// 1. PROMO_OVERRIDE — manually set a message for promotions etc.
|
||||
// 1. PROMO_OVERRIDE - manually set a message for promotions etc.
|
||||
// 2. Hardcoded cosmic calendar (eclipses, meteor showers, alignments)
|
||||
// 3. Weather-derived events (stargazing, sunset, heat spike, storm)
|
||||
//
|
||||
@@ -24,7 +24,7 @@
|
||||
// Weather check functions ..... ./events/weather-checks.js
|
||||
// Dynamic message helper ...... ./events/dynamic-message.js
|
||||
// Lens overlay SVG renderer ... ./events/lens-overlay.js
|
||||
// ════════════════════════════════════════════════════════════════════════
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
import { COSMIC_CALENDAR } from './events/cosmic-calendar.js';
|
||||
import {
|
||||
@@ -40,16 +40,16 @@ import { dynamicCosmicMessage } from './events/dynamic-message.js';
|
||||
export { getUpcomingEvents } from './events/almanac-calendar.js';
|
||||
export { getLensOverlaySVG } from './events/lens-overlay.js';
|
||||
|
||||
// ─── PROMO OVERRIDE ──────────────────────────────────────────────────────
|
||||
// --- PROMO OVERRIDE ------------------------------------------------------
|
||||
// Set this to show a custom banner regardless of weather or cosmic events.
|
||||
// Leave as null for automatic event detection.
|
||||
//
|
||||
// Example:
|
||||
// export const PROMO_OVERRIDE = {
|
||||
// id: 'promo-summer',
|
||||
// emoji: '☀️',
|
||||
// emoji: '--',
|
||||
// title: 'Summer Sale',
|
||||
// message: 'SunScope Extra — 20% off this weekend only.',
|
||||
// message: 'SunScope Extra - 20% off this weekend only.',
|
||||
// color: '#c8922a',
|
||||
// textColor: '#fff',
|
||||
// type: 'promo',
|
||||
@@ -57,7 +57,7 @@ export { getLensOverlaySVG } from './events/lens-overlay.js';
|
||||
//
|
||||
export const PROMO_OVERRIDE = null;
|
||||
|
||||
// ─── CELL TAG LOGIC ──────────────────────────────────────────────────────
|
||||
// --- CELL TAG LOGIC ------------------------------------------------------
|
||||
// Returns the subset of active events that should show an icon for this row.
|
||||
export function getCellTagEvents(events, row) {
|
||||
if (!events || events.length === 0) return [];
|
||||
@@ -73,7 +73,7 @@ export function getCellTagEvents(events, row) {
|
||||
});
|
||||
}
|
||||
|
||||
// ─── MAIN EXPORT ─────────────────────────────────────────────────────────
|
||||
// --- MAIN EXPORT ---------------------------------------------------------
|
||||
// Returns ALL active events for the given rows/date as an array.
|
||||
// Empty array = nothing active.
|
||||
//
|
||||
@@ -83,10 +83,10 @@ export function getCellTagEvents(events, row) {
|
||||
// 3. All matching weather-derived events
|
||||
|
||||
export function getActiveEvents(rows, location) {
|
||||
// 1. Manual promo override — shown alone, no mixing with other events
|
||||
// 1. Manual promo override - shown alone, no mixing with other events
|
||||
if (PROMO_OVERRIDE) return [PROMO_OVERRIDE];
|
||||
|
||||
// 2. Cosmic calendar — use the date of the rows being viewed, not today.
|
||||
// 2. Cosmic calendar - use the date of the rows being viewed, not today.
|
||||
const dateStr = (rows && rows.length > 0)
|
||||
? rows[0].iso.slice(0, 10)
|
||||
: new Date().toISOString().slice(0, 10);
|
||||
@@ -110,7 +110,7 @@ export function getActiveEvents(rows, location) {
|
||||
return [...cosmicHits, ...weatherEvents];
|
||||
}
|
||||
|
||||
// ─── LENS EVENT PICKER ───────────────────────────────────────────────────
|
||||
// --- LENS EVENT PICKER ---------------------------------------------------
|
||||
// From an array of active events, returns the single one closest to its peak
|
||||
// (most "intense"). Weather events without a peak use today's date.
|
||||
// Returns null if events array is empty.
|
||||
|
||||
Reference in New Issue
Block a user