Put news on the globe, with a feed panel in the right rail

Events ▸ News draws the last 24 hours of reports from curated hotspots
(Ukraine–Russia, Israel–Gaza–Lebanon, Iran–Hormuz, Yemen–Red Sea, Sudan,
Sahel) and developing situations elsewhere, from any server that answers the
`/api/news` read routes.

- Globe: one marker per merged event, clamped to the ground and culled at the
  horizon; one beacon per hotspot when zoomed out and a pulsing beacon for a
  developing situation; hotspot outlines with disputed areas dotted and
  labelled by who administers and who claims them; picture cards for at most
  ten major or fast-growing events with two or more sources, never
  overlapping, switchable off.
- Panel: hotspot chips, a severity filter (significant and above by default),
  categories, minor news off by default, and a scrolling list of event cards
  with picture, headline, place, sources, age and the sides that reported it.
  "In view" lists what is near the map below 3,000 km once the camera
  settles. A card flies the globe to its event and opens it with a link to
  the publisher. Reduced motion stops the pulse and the flights.
- Core serves no news itself: the local server proxies GEV_NEWS_ORIGIN when it
  is set, and answers 503 unavailable otherwise, so the layer reads "not
  configured" once instead of retrying.
- Share token 9 (enabled-only); voice stays off for this layer.
This commit is contained in:
Denis Groshev committed 2026-11-06 00:45:24 +01:00
1 parent 2d9d518946
commit 5bb489d1fb
48 files changed
+3394 -53

No files matched your search

+127
View File
@@ -0,0 +1,127 @@
<script setup>
import { ref, watch } from 'vue';
import { t } from '../../i18n/index.js';
import UiButton from '../kit/UiButton.vue';
// One event in the News panel: the publisher's
// picture when the event has one, the headline, a mono meta line (severity
// marker, category, place, sources, age), who reported it, and its
// attestation and media chips. A click chooses it (the layer flies there and
// opens its card on the globe); open, it shows the summary, the other sides'
// reports and the link to the original article. The layer computes every
// value shown (feedCardView in src/layers/news/model.js).
const props = defineProps({
item: { type: Object, required: true },
open: { type: Boolean, default: false },
onChoose: { type: Function, default: () => {} },
onClear: { type: Function, default: () => {} },
});
// A picture the publisher no longer serves leaves the card without one.
const pictureFailed = ref(false);
const dropPicture = () => {
pictureFailed.value = true;
};
watch(
() => props.item.picture?.url,
() => (pictureFailed.value = false),
);
const meta = () =>
[
props.item.category,
props.item.place &&
(props.item.placedByModel
? t('{place} (placed by model)', { place: props.item.place })
: props.item.place),
props.item.sources,
props.item.age,
]
.filter(Boolean)
.join(' · ');
</script>
<template>
<article
class="news-card"
:class="{ 'is-open': open, 'is-unmapped': !item.mappable }"
:data-report-id="item.id"
:style="{ '--news-color': item.color }"
>
<button
type="button"
class="news-card__main ui-focus"
:aria-expanded="open ? 'true' : 'false'"
@click="onChoose(item)"
>
<span v-if="item.picture && !pictureFailed" class="news-card__thumb"
><img
:src="item.picture.url"
alt=""
loading="lazy"
decoding="async"
referrerpolicy="no-referrer"
v-on="{ error: dropPicture }"
/><span v-if="item.picture.credit" class="news-card__credit">{{
item.picture.credit
}}</span></span
>
<span class="news-card__title">{{ item.title }}</span>
<span v-if="item.original" class="news-card__note">{{
t('English headline by the model')
}}</span>
<span class="news-card__meta ui-mono"
><span
class="news-card__marker"
:class="{ solid: item.solid }"
role="img"
:aria-label="item.severityLabel"
:title="item.severityLabel"
><svg viewBox="0 0 16 16" aria-hidden="true">
<path :d="item.icon" /></svg></span
>{{ meta() }}</span
>
<span v-if="item.sides" class="news-card__sides">{{ item.sides }}</span>
<span v-if="item.chips.length" class="news-card__chips"
><span
v-for="chip in item.chips"
:key="`${chip.kind}:${chip.label}`"
class="news-chip"
:class="`news-chip--${chip.kind}`"
>{{ chip.label }}</span
></span
>
</button>
<div v-if="open" class="news-card__open">
<p v-if="item.original" class="news-card__original">{{
item.original
}}</p>
<p v-if="item.snippet" class="news-card__snippet">{{ item.snippet }}</p>
<p v-if="!item.mappable" class="news-card__note">
{{ t('Not placed on the map') }}
</p>
<ul v-if="item.others.length" class="news-card__others">
<li v-for="other in item.others" :key="other.url">
<span class="news-card__side ui-mono">{{ other.side }}</span
><a :href="other.url" target="_blank" rel="noopener noreferrer"
>{{ other.publisher }}: {{ other.title }}</a
>
</li>
</ul>
<div class="news-card__actions">
<a
class="news-card__link"
:href="item.url"
target="_blank"
rel="noopener noreferrer"
>{{ item.sourceLink }}</a
>
<UiButton
class="data-toggle-chip news-card__clear"
type="button"
@click="onClear()"
>{{ t('Close') }}</UiButton
>
</div>
</div>
</article>
</template>
+217
View File
@@ -0,0 +1,217 @@
<script setup>
import { computed } from 'vue';
import { t } from '../../i18n/index.js';
import UiButton from '../kit/UiButton.vue';
import UiEmpty from '../kit/UiEmpty.vue';
import UiSelect from '../kit/UiSelect.js';
import RailChips from '../rail/RailChips.vue';
import NewsCard from './NewsCard.vue';
// The News panel: the last 24 hours only. Hotspot chips, filters, the chosen
// event, "In view" (reports near the view centre while the camera is low)
// and a continuous feed, newest first. It renders the `feed` view the news
// layer publishes and acts only through `onParams`.
const props = defineProps({
view: { type: Object, default: null },
onParams: { type: Function, default: () => {} },
});
const filters = computed(() => props.view?.filters ?? {});
const chips = computed(() =>
(props.view?.hotspots ?? []).map((chip) => ({
id: chip.id,
label: `${chip.label} ${chip.count}`,
active: chip.active,
title: chip.label,
})),
);
const severityOptions = computed(() => {
const levels = props.view?.severities ?? [];
return [
{ value: '0', label: t('Any severity') },
...levels.slice(1, 3).map((level) => ({
value: String(level.value),
label: t('{severity} and above', { severity: level.label }),
})),
...levels.slice(3).map((level) => ({
value: String(level.value),
label: t('{severity} only', { severity: level.label }),
})),
];
});
const categoryOptions = computed(() => [
{ value: 'all', label: t('All categories') },
...(props.view?.categories ?? []),
]);
const selectedId = computed(() => props.view?.selected?.id ?? null);
// The chosen event leads the panel unless the feed already shows it open.
const selectedApart = computed(() => {
const chosen = props.view?.selected;
if (!chosen) return null;
const listed =
props.view.items.some((item) => item.id === chosen.id) ||
(props.view.inView.active &&
props.view.inView.items.some((item) => item.id === chosen.id));
return listed ? null : chosen;
});
const status = computed(() => {
const view = props.view;
if (!view) return '';
if (view.error) return view.error;
if (view.loading && !view.items.length) return t('Reading the news…');
return '';
});
const setFilter = (name, value) =>
props.onParams({ filters: { [name]: value } });
function choose(item) {
if (item.id === selectedId.value) props.onParams({ clear: true });
else props.onParams({ reportId: item.id, focus: true });
}
const clear = () => props.onParams({ clear: true });
</script>
<template>
<section
v-if="view"
class="news-readout"
:aria-label="t('News, last 24 hours')"
>
<p class="news-readout__window ui-mono">{{ t('Last 24 h') }}</p>
<div class="news-readout__chips" role="group" :aria-label="t('Hotspots')">
<RailChips
:chips="chips"
:on-select="(chip) => setFilter('hotspot', chip.id)"
/>
</div>
<div class="news-readout__filters">
<UiSelect
class="gev-field news-filter"
:aria-label="t('Severity')"
:model-value="String(filters.minSeverity ?? 2)"
:options="severityOptions"
@update:model-value="setFilter('minSeverity', Number($event))"
/>
<UiSelect
class="gev-field news-filter"
:aria-label="t('Category')"
:model-value="filters.category ?? 'all'"
:options="categoryOptions"
@update:model-value="setFilter('category', $event)"
/>
<label class="news-toggle"
><input
type="checkbox"
:checked="filters.includeMinor === true"
@change="setFilter('includeMinor', $event.target.checked)"
/><span>{{ t('Include minor news') }}</span></label
>
<label class="news-toggle"
><input
type="checkbox"
:checked="filters.cards !== false"
@change="setFilter('cards', $event.target.checked)"
/><span>{{ t('Show event cards') }}</span></label
>
</div>
<NewsCard
v-if="selectedApart"
class="news-readout__selected"
:item="selectedApart"
open
:on-choose="choose"
:on-clear="clear"
/>
<section
v-if="view.inView.active"
class="news-readout__section"
:aria-label="t('In view')"
>
<h3 class="news-readout__head ui-mono">{{ t('In view') }}</h3>
<p v-if="view.inView.error" class="news-readout__status">
{{ view.inView.error }}
</p>
<UiEmpty
v-else-if="!view.inView.items.length && !view.inView.loading"
class="news-readout__empty"
:title="t('Nothing reported near here in the last 24 h')"
/>
<ol
v-else
class="news-readout__list"
:class="{ 'is-stale': view.inView.loading }"
:aria-busy="view.inView.loading ? 'true' : 'false'"
>
<li v-for="item in view.inView.items" :key="item.id">
<NewsCard
:item="item"
:open="item.id === selectedId"
:on-choose="choose"
:on-clear="clear"
/>
</li>
</ol>
</section>
<section class="news-readout__section" :aria-label="t('Latest news')">
<h3 class="news-readout__head ui-mono">{{ t('Latest') }}</h3>
<ol
v-if="view.items.length"
class="news-readout__list news-readout__feed"
>
<li v-for="item in view.items" :key="item.id">
<NewsCard
:item="item"
:open="item.id === selectedId"
:on-choose="choose"
:on-clear="clear"
/>
</li>
</ol>
<UiEmpty
v-else-if="!view.loading && !view.error"
class="news-readout__empty"
:title="t('No news matches these filters in the last 24 h')"
/>
<div class="news-readout__footer">
<span class="news-readout__status" role="status">{{ status }}</span>
<UiButton
v-if="view.hasMore && !view.loading"
class="data-toggle-chip"
type="button"
@click="onParams({ loadMore: true })"
>{{ t('Load older news') }}</UiButton
>
</div>
</section>
<details class="news-legend">
<summary>{{ t('How to read the map') }}</summary>
<p>{{ t('Colour: severity · icon: type of event') }}</p>
<ul class="news-legend__severity">
<li
v-for="level in view.severities"
:key="level.value"
:style="{ '--news-color': level.color }"
>
{{ level.label }}
</li>
</ul>
<p>{{
t(
'Solid rim: reported by both sides or independently. Dashed rim: a claim. Thin rim: one source, or one side’s own press.',
)
}}</p>
<p>{{
t(
'Larger: more sources · fainter: older. Picture card: a major or fast-growing event with two or more sources.',
)
}}</p>
<p>{{
t('Side labels describe the source, not whether a report is true.')
}}</p>
</details>
</section>
</template>