mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Split the News panel into Conflicts and Local
Conflicts is the hotspots' significant news, on the map whenever the layer is on. Local lists every report within 500 km of the view centre below 3,000 km, and the map shows those instead while it is chosen. The section replaces the "Include minor news" and "Show event cards" toggles: picture cards are always on, and Local is what reads minor news. The Conflicts feed reads the same whichever section is shown.
This commit is contained in:
1 parent
4817d2a648
commit
f72f79f48b
20 files changed
+280
-189
No files matched your search
@@ -46,6 +46,14 @@ export const NEWS_DETAIL_MAX_HEIGHT_M = 2_500_000;
|
||||
export const NEWS_IN_VIEW_MAX_HEIGHT_M = 3_000_000;
|
||||
export const NEWS_IN_VIEW_RADIUS_KM = 500;
|
||||
export const NEWS_IN_VIEW_LIMIT = 12;
|
||||
/** The Local section lists at most this many reports near the view centre. */
|
||||
export const NEWS_LOCAL_LIMIT = 40;
|
||||
/**
|
||||
* The News panel's sections: Conflicts (the hotspots' significant news, on the
|
||||
* map whenever the layer is on) and Local (everything near the view centre,
|
||||
* on the map while the section is chosen).
|
||||
*/
|
||||
export const NEWS_SECTIONS = Object.freeze(['conflicts', 'local']);
|
||||
export const NEWS_SETTLE_MS = 800;
|
||||
export const NEWS_CELL_DEG = 0.5;
|
||||
/** A feed card's click flies the camera to this height over the event. */
|
||||
@@ -625,9 +633,9 @@ export function normalizeFilters(next = {}, hotspots = [], previous = {}) {
|
||||
hotspot,
|
||||
category,
|
||||
minSeverity,
|
||||
includeMinor: merged.includeMinor === true,
|
||||
// Event cards on the map; off leaves only the clicked event's card.
|
||||
cards: merged.cards !== false,
|
||||
section: NEWS_SECTIONS.includes(merged.section)
|
||||
? merged.section
|
||||
: 'conflicts',
|
||||
// A shorter window than the server's; null shows all it serves.
|
||||
hours: NEWS_WINDOW_CHOICES.includes(merged.hours) ? merged.hours : null,
|
||||
};
|
||||
@@ -661,12 +669,22 @@ export function visibleOnMap(
|
||||
);
|
||||
}
|
||||
|
||||
/** API query for the feed under the current filters: the window only. */
|
||||
/**
|
||||
* The filters Local applies: every hotspot and every severity, near the view
|
||||
* centre; the category and the window still hold.
|
||||
*/
|
||||
export const localFilters = (filters) => ({
|
||||
...filters,
|
||||
hotspot: 'all',
|
||||
minSeverity: 0,
|
||||
});
|
||||
|
||||
/** API query for the Conflicts feed under the current filters: the window only. */
|
||||
export function feedQueryFor(filters, extra = {}) {
|
||||
return {
|
||||
events: true,
|
||||
today: true,
|
||||
relevance: filters.includeMinor ? '' : NEWS_RELEVANT,
|
||||
relevance: NEWS_RELEVANT,
|
||||
hotspot: filters.hotspot,
|
||||
category: filters.category === 'all' ? '' : filters.category,
|
||||
limit: NEWS_FEED_PAGE,
|
||||
|
||||
Reference in new issue
Block a user