Files
gods-eye-view/src/layers/shipwrecks/eras.js
T
Itallo BrandãoandClaude Opus 5.5 112ffd4386 feat(shipwrecks): period picker like air accidents, sharper icons
- Replace the four era chips with the start and end year pickers the
  air-accidents layer uses (the same RowRange control, ported as is);
  the era colours stay as a legend under the row.
- Rasterize the boat marker at 144 px so large markers stay sharp.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 04:49:36 -03:00

22 lines
682 B
JavaScript

/** Era chips, oldest first; a wreck with no known year sits in its own chip. */
export const SHIPWRECK_ERAS = Object.freeze([
'before-1900',
'1900-1945',
'after-1945',
'undated',
]);
/**
* The era a wreck belongs to. Ancient wrecks dated only by period
* ("Roman Imperial", "C1st AD") count as before 1900.
* @param {{year?: number|null, ancient?: boolean}} record
* @returns {string}
*/
export function eraOf(record) {
const year = Number.isInteger(record?.year) ? record.year : null;
if (year === null) return record?.ancient ? 'before-1900' : 'undated';
if (year < 1900) return 'before-1900';
if (year <= 1945) return '1900-1945';
return 'after-1945';
}