Show the destination, result and loot in Sokko TCG Discord alerts, with a button to the expedition
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 23m48s
Validate and deploy Sokko G / deploy (push) Successful in 16s

- Each queued alert keeps an embed and a link button: the destination illustration as thumbnail, the tier, score and loot for a return, the difficulty and automatic departure for a new group.
- The button and the message link open #/cards/expeditions/<id>, which scrolls to the player's expedition or group and highlights it; Discord login now returns to that link.
- Without an https CARDS_PUBLIC_ORIGIN the link stays in the text, without button or thumbnail, which Discord would refuse.
- Delivery docs name palico-bot's NOTIFICATIONS_API_KEY and its local-only route on port 3101.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-29 11:35:15 +01:00
parent 734a3b6a8b
commit 82cebd0fd1
17 changed files with 184 additions and 37 deletions

View file

@ -1,6 +1,7 @@
// Rôle : suivi d'une expédition en route : devant le paysage fixe de la destination, un décor de ciel (nuages, îlots flottants,
// éclats de roche, étincelles, brume) dérive pendant que les cartes parties avancent, au-dessus d'une barre de progression et du
// compte à rebours du retour.
import { useEffect, useRef } from "react";
import { fillTemplate, formatCountdown } from "./dailyShare.js";
import { coverEntry, editionEntry } from "./expeditionFormat.js";
import { NebulaCard } from "./NebulaCard.jsx";
@ -39,14 +40,17 @@ function TrailScenery() {
</span>)}</div>;
}
export function ExpeditionJourney({ catalog, expedition, content, now, busy, anchors = 0, onRecall = null }) {
// `focused` : le joueur arrive par le lien direct de cette expédition (alerte Discord) : elle est mise en vue.
export function ExpeditionJourney({ catalog, expedition, content, now, busy, anchors = 0, onRecall = null, focused = false }) {
const articleRef = useRef(null);
useEffect(() => { if (focused) articleRef.current?.scrollIntoView({ block: "center" }); }, [focused]);
const span = Math.max(1, expedition.returnsAt - expedition.departsAt);
const pct = Math.round(Math.min(1, Math.max(0, (now - expedition.departsAt) / span)) * 100);
const cover = !expedition.destination.image && expedition.destination.coverCardId && coverEntry(catalog, expedition.destination.coverCardId);
const backdrop = expedition.destination.image || cover?.card.image || null;
const players = new Set(expedition.slots.filter((slot) => slot.editionId).map((slot) => slot.playerName ?? "")).size;
const mode = expedition.mode === "group" ? fillTemplate(content.journeyGroup, { count: players }) : content.journeyAlone;
return <article className="nds-panel nebula-expedition-journey" aria-labelledby={`nebula-journey-${expedition.id}`}>
return <article ref={articleRef} className="nds-panel nebula-expedition-journey" data-focused={focused || undefined} aria-labelledby={`nebula-journey-${expedition.id}`}>
<p className="eyebrow">{fillTemplate(content.journeyMeta, { stars: "★".repeat(expedition.stars), hours: expedition.hours, mode })}</p>
<h3 id={`nebula-journey-${expedition.id}`}>{expedition.destination.name}</h3>
<div className="nebula-expedition-trail" style={backdrop ? { "--nebula-trail-image": `url("${backdrop}")` } : undefined}>

View file

@ -1,6 +1,7 @@
// Rôle : retour d'une expédition du joueur, sur toute la largeur et en deux colonnes comme l'expédition en préparation : le paysage
// et l'équipe à gauche ; à droite, seulement ce que le joueur reçoit, visible dès le retour, et le bouton dessous. Un clic récupère le
// butin : l'expédition passe au Journal et la carte disparaît.
import { useEffect, useRef } from "react";
import { fillTemplate } from "./dailyShare.js";
import { editionEntry, formatEclats } from "./expeditionFormat.js";
import { DestinationArt, MaskIcon } from "./ExpeditionLabels.jsx";
@ -34,10 +35,13 @@ function ReturnLoot({ catalog, reward, content }) {
</section>;
}
export function ExpeditionReturn({ catalog, expedition, content, busy, onClaim }) {
// `focused` : le joueur arrive par le lien direct de cette expédition (alerte Discord) : elle est mise en vue.
export function ExpeditionReturn({ catalog, expedition, content, busy, onClaim, focused = false }) {
const articleRef = useRef(null);
useEffect(() => { if (focused) articleRef.current?.scrollIntoView({ block: "center" }); }, [focused]);
const { reward } = expedition;
const team = expedition.slots.filter((slot) => slot.editionId);
return <article className="nds-card nebula-expedition-group nebula-expedition-return" aria-labelledby={`nebula-return-${expedition.id}`}>
return <article ref={articleRef} className="nds-card nebula-expedition-group nebula-expedition-return" data-focused={focused || undefined} aria-labelledby={`nebula-return-${expedition.id}`}>
<div className="nebula-group-side">
<DestinationArt catalog={catalog} destination={expedition.destination} />
<section className="nebula-group-team" aria-label={content.returnTeam}>

View file

@ -238,17 +238,19 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content, j
const mine = view.groups.filter((group) => group.isMember);
const others = view.groups.filter((group) => !group.isMember);
const invited = joinId && view.groups.find((group) => group.id === joinId);
// Lien direct d'une alerte : une expédition du joueur, en route ou revenue, ou déjà rangée au Journal.
const linked = joinId && (view.expeditions.some((expedition) => expedition.id === joinId) || view.journal.some((expedition) => expedition.id === joinId));
const journalCount = view.journal.length;
const prepare = <>
{joinId && !invited && view.enabled && <p className="nds-inline-notice" data-variant="info">{content.joinMissing}</p>}
{joinId && !invited && !linked && view.enabled && <p className="nds-inline-notice" data-variant="info">{content.joinMissing}</p>}
{view.expeditions.map((expedition) => (expedition.status === "running" && expedition.returnsAt > now
? <ExpeditionJourney key={expedition.id} catalog={catalog} expedition={expedition} content={content} now={now} busy={busy} anchors={view.items.anchor} onRecall={recall} />
: <ExpeditionReturn key={expedition.id} catalog={catalog} expedition={expedition} content={content} busy={busy} onClaim={claim} />))}
? <ExpeditionJourney key={expedition.id} catalog={catalog} expedition={expedition} content={content} now={now} busy={busy} anchors={view.items.anchor} onRecall={recall} focused={expedition.id === joinId} />
: <ExpeditionReturn key={expedition.id} catalog={catalog} expedition={expedition} content={content} busy={busy} onClaim={claim} focused={expedition.id === joinId} />))}
{mine.length > 0 && <section className="nebula-expedition-active" aria-labelledby="nebula-expedition-mine-title">
<h3 id="nebula-expedition-mine-title">{content.mineTitle}</h3>
<div className="nebula-expedition-reports">{mine.map((group) => <ExpeditionGroupCard key={group.id} catalog={catalog} state={state} view={view} group={group} content={content} now={now} busy={busy} limitReached={limitReached}
runMutation={equipAndRefresh} onJoin={join} onMember={member} onLeave={leave} onDepart={depart} onTestPlayer={testPlayer} />)}</div>
runMutation={equipAndRefresh} onJoin={join} onMember={member} onLeave={leave} onDepart={depart} onTestPlayer={testPlayer} invited={group.id === joinId} />)}</div>
</section>}
{!view.enabled ? <div className="nds-empty-state"><h3>{content.closedTitle}</h3><p>{content.closedText}</p></div>
: !expired && !limitReached && <>