Reword bulk recycling and awakening texts, and list only the recycled rarities
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 22m11s
Validate and deploy Sokko G / deploy (push) Successful in 13s

The confirmation said "rareté Commun ou plus commune": it now names the recycled rarities ("Vos doublons communs, rares et épiques deviennent …") and its value list keeps only those rarities. The box no longer reads "0 doublon … +0 poussière", and the awakening texts say "6 doublons rares" instead of "doublons de rareté Rare". The history no longer shows "−undefined Éclats" for an awakening with duplicates of the collection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-19 10:20:42 +01:00
parent 0533a8f766
commit 83ac709907
8 changed files with 69 additions and 26 deletions

View file

@ -7,8 +7,9 @@ import { fillTemplate } from "./dailyShare.js";
import { editionEntry } from "./expeditionFormat.js";
import { NebulaCard } from "./NebulaCard.jsx";
// `awakening` : vue du serveur (needed, candidates) ; `onAwaken(editionIds)` renvoie le résultat de la mutation, null en cas d'échec.
export function AwakeningPicker({ catalog, cardName, awakening, rarityLabel, collectionName, content, busy, onAwaken, onClose }) {
// `awakening` : vue du serveur (needed, candidates) ; `rarityWords(count)` : les raretés acceptées accordées (« rares »,
// « légendaire ou mythique ») ; `onAwaken(editionIds)` renvoie le résultat de la mutation, null en cas d'échec.
export function AwakeningPicker({ catalog, cardName, awakening, rarityWords, collectionName, content, busy, onAwaken, onClose }) {
const [chosen, setChosen] = useState([]);
const { needed, candidates } = awakening;
const plural = needed > 1 ? "s" : "";
@ -23,7 +24,7 @@ export function AwakeningPicker({ catalog, cardName, awakening, rarityLabel, col
return <Modal dialogClassName="confirm-modal nds-modal nebula-expedition-picker nebula-atelier nebula-awakening-picker" labelledBy="nebula-awakening-picker-title" onRequestClose={onClose} canClose={!busy}>
<h2 id="nebula-awakening-picker-title">{fillTemplate(content.awakenPickerTitle, { card: cardName, power: awakening.power })}</h2>
<p className="nebula-form-help">{fillTemplate(content.awakenPickerHelp, { count: needed, s: plural, rarity: rarityLabel, collection: collectionName })}</p>
<p className="nebula-form-help">{fillTemplate(content.awakenPickerHelp, { count: needed, s: plural, rarity: rarityWords(needed), collection: collectionName })}</p>
{/* Sélection : une place par doublon demandé ; une carte posée se retire d'un clic. */}
<section className="nebula-atelier-selection" aria-labelledby="nebula-awakening-selection-title">
<h3 id="nebula-awakening-selection-title">{fillTemplate(content.awakenSelection, { count: chosen.length, needed })}</h3>
@ -48,7 +49,7 @@ export function AwakeningPicker({ catalog, cardName, awakening, rarityLabel, col
</span>
<strong>{card.card.name}</strong>
</li>;
})}</ul> : <p className="nebula-form-help">{fillTemplate(content.awakenNoCandidates, { rarity: rarityLabel, collection: collectionName })}</p>}
})}</ul> : <p className="nebula-form-help">{fillTemplate(content.awakenNoCandidates, { rarity: rarityWords(1), collection: collectionName })}</p>}
<div className="nds-toolbar nebula-expedition-picker-actions">
<button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={onClose}>{content.awakenCancel}</button>
<button className="nds-button" data-variant="primary" type="button" disabled={busy || chosen.length !== needed} onClick={awaken}>{content.awakenConfirm}</button>

View file

@ -10,6 +10,7 @@ import { Tabs } from "../../components/Tabs.jsx";
import { recycleDuplicates, setFavorite, upgradeCard } from "./cardsApi.js";
import { AwakeningPicker } from "./AwakeningPicker.jsx";
import { CardPlan } from "./CardPlan.jsx";
import { frenchList, rarityAdjective } from "./rarityWords.js";
import { CurrencyAmount } from "./Currency.jsx";
import { readCollection } from "./collectionState.js";
import { fillTemplate } from "./dailyShare.js";
@ -57,8 +58,9 @@ function CardAwakening({ catalog, progress, busy, runMutation, content }) {
const { awakening } = progress;
const own = catalog.editions.find((edition) => edition.id === progress.editionId);
const card = catalog.cards.find((item) => item.id === own?.cardId);
const rarityLabel = (id) => catalog.rarities.find((item) => item.id === id)?.label ?? id;
const accepted = own?.rarity === "mythic" ? `${rarityLabel("legendary")} ou ${rarityLabel("mythic")}` : rarityLabel(own?.rarity);
// « rare », « légendaires ou mythiques » : les raretés acceptées, accordées avec le nombre de doublons.
const acceptedIds = own?.rarity === "mythic" ? ["legendary", "mythic"] : [own?.rarity];
const accepted = (count) => frenchList(acceptedIds.map((id) => rarityAdjective(catalog, id, count)), "disjunction");
const collectionName = catalog.collections.find((item) => item.id === card?.collectionId)?.name ?? "";
const exactIsOther = awakening.exact && awakening.exact !== progress.editionId;
const plural = awakening.needed > 1 ? "s" : "";
@ -67,10 +69,10 @@ function CardAwakening({ catalog, progress, busy, runMutation, content }) {
<p className="nebula-form-help">{content.awakeningText}</p>
<div className="nds-toolbar">
<button className="nds-button" data-variant="primary" type="button" disabled={busy || !awakening.exact} onClick={() => runMutation(() => upgradeCard(progress.editionId, "duplicate"))}>{exactIsOther ? content.awakenLegendary : content.awakenExact}</button>
<button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => setChoosing(true)}>{fillTemplate(content.awakenChoose, { count: awakening.needed, s: plural })}</button>
<button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => setChoosing(true)}>{fillTemplate(content.awakenChoose, { count: awakening.needed, s: plural, rarity: accepted(awakening.needed) })}</button>
</div>
<p className="nebula-form-help">{fillTemplate(content.awakenPoolCount, { available: Math.min(awakening.available, awakening.needed), count: awakening.needed, s: plural, rarity: accepted, collection: collectionName })}</p>
{choosing && <AwakeningPicker catalog={catalog} cardName={card?.name ?? ""} awakening={awakening} rarityLabel={accepted} collectionName={collectionName} content={content} busy={busy}
<p className="nebula-form-help">{fillTemplate(content.awakenPoolCount, { available: Math.min(awakening.available, awakening.needed), count: awakening.needed, rarity: accepted(2), collection: collectionName })}</p>
{choosing && <AwakeningPicker catalog={catalog} cardName={card?.name ?? ""} awakening={awakening} rarityWords={accepted} collectionName={collectionName} content={content} busy={busy}
onAwaken={(editionIds) => runMutation(() => upgradeCard(progress.editionId, "awaken", editionIds))} onClose={() => setChoosing(false)} />}
</section>;
}

View file

@ -13,6 +13,8 @@ import { readCollection, visibleCollections } from "./collectionState.js";
import { NebulaCard } from "./NebulaCard.jsx";
import { StardustBalance } from "./Currency.jsx";
import { formatStardust } from "./stardustFormat.js";
import { fillTemplate } from "./dailyShare.js";
import { frenchList, rarityAdjective } from "./rarityWords.js";
const OWNERSHIP_OPTIONS = [{ value: "owned", label: "Possédées" }, { value: "missing", label: "Manquantes" }, { value: "duplicates", label: "Doublons" }];
const countDuplicates = (count) => `${count} doublon${count > 1 ? "s" : ""}`;
@ -59,7 +61,7 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
setRecycleNotice("");
const result = await runMutation(() => recycleDuplicates(null, maxRarity));
if (!result?.recycled) return;
setRecycleNotice(`${result.recycled.count > 1 ? `${result.recycled.count} doublons recyclés` : "1 doublon recyclé"} : +${formatStardust(result.recycled.stardust)} d’étoiles.`);
setRecycleNotice(fillTemplate(content.done, { count: countDuplicates(result.recycled.count), recycled: result.recycled.count > 1 ? "recyclés" : "recyclé", stardust: formatStardust(result.recycled.stardust) }));
// Il ne reste plus de doublon à montrer : on revient à toute la collection.
if (ownership.includes("duplicates")) setOwnership(ownership.filter((value) => value !== "duplicates"));
}
@ -67,9 +69,9 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
const { recycling, wallet, shop } = state;
// Raretés recyclables en masse (sans les mythiques), dans l'ordre du catalogue, avec l'aperçu de chacune envoyé par le serveur.
const massRarities = catalog.rarities.filter((rarity) => Object.hasOwn(recycling.byRarity ?? {}, rarity.id));
const chosen = massRarities.slice(0, massRarities.findIndex((rarity) => rarity.id === maxRarity) + 1).map((rarity) => recycling.byRarity[rarity.id]);
const chosenRarities = massRarities.slice(0, massRarities.findIndex((rarity) => rarity.id === maxRarity) + 1);
const chosen = chosenRarities.map((rarity) => recycling.byRarity[rarity.id]);
const preview = { count: chosen.reduce((total, item) => total + item.count, 0), stardust: chosen.reduce((total, item) => total + item.stardust, 0) };
const maxRarityLabel = massRarities.find((rarity) => rarity.id === maxRarity)?.label ?? maxRarity;
const showingDuplicates = ownership.includes("duplicates");
const collectionOptions = collections.map((item) => ({ value: item.id, label: item.name }));
const rarityOptions = catalog.rarities.map((item) => ({ value: item.id, label: item.label }));
@ -86,7 +88,7 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
<section className="nds-panel nebula-recycle-box" aria-label={content.barLabel}>
<StardustBalance value={wallet.stardust} />
<SelectDropdown className="nebula-recycle-box-rarity" label={content.maxRarityLabel} size="sm" value={maxRarity} options={massRarities.map((rarity) => ({ value: rarity.id, label: rarity.label }))} onChange={setMaxRarity} />
<p><strong>{countDuplicates(preview.count)}</strong> à recycler pour <strong>+{formatStardust(preview.stardust)}</strong></p>
{preview.count ? <p><strong>{countDuplicates(preview.count)}</strong> à recycler pour <strong>+{formatStardust(preview.stardust)}</strong></p> : <p>{content.none}</p>}
<div className="nebula-recycle-box-actions">
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || Boolean(state.pendingOpening) || !preview.count} onClick={() => setConfirmingRecycle(true)}>{content.allButton}</button>
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={() => setOwnership(showingDuplicates ? [] : ["duplicates"])}>{showingDuplicates ? content.viewAll : content.viewDuplicates}</button>
@ -128,12 +130,14 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
})}</div> : <div className="nds-empty-state"><p>Aucune édition ne correspond à ces filtres.</p></div>}
</section>
{confirmingRecycle && <ConfirmModal
title={`Recycler ${countDuplicates(preview.count)} ?`}
message={`Vous recevrez ${formatStardust(preview.stardust)} d’étoiles pour les doublons de rareté ${maxRarityLabel} ou plus commune. Les exemplaires recyclés disparaissent de votre collection ; un exemplaire de chaque carte est conservé, les doublons réservés par un échange ne sont pas recyclés et les mythiques se recyclent une par une.`}
confirmLabel="Recycler"
title={fillTemplate(content.confirmTitle, { count: countDuplicates(preview.count) })}
message={fillTemplate(content.confirmText, { rarities: frenchList(chosenRarities.map((rarity) => rarityAdjective(catalog, rarity.id, 2))), stardust: formatStardust(preview.stardust) })}
confirmLabel={content.allButton}
onClose={(confirmed) => { setConfirmingRecycle(false); if (confirmed) void recycleAll(); }}
>
<ul className="nebula-shop-rates" aria-label={content.ratesLabel}>{catalog.rarities.map((rarity) => <li key={rarity.id} data-rarity={rarity.id}><span>{rarity.label}</span><StardustBalance value={shop.stardustValues[rarity.id] ?? 0} /></li>)}</ul>
<p className="nebula-form-help">{content.confirmKept}</p>
{/* Seules les raretés recyclées cette fois, avec ce que rapporte chacun de leurs doublons. */}
<ul className="nebula-shop-rates" aria-label={content.ratesLabel}>{chosenRarities.map((rarity) => <li key={rarity.id} data-rarity={rarity.id}><span>{rarity.label}</span><StardustBalance value={shop.stardustValues[rarity.id] ?? 0} /></li>)}</ul>
</ConfirmModal>}
{selected && <CardDetailModal catalog={catalog} state={state} entry={selected} content={cardSheetContent} runMutation={runMutation} busy={busy} onClose={() => setSelected(null)} onStartTransfer={onStartTransfer} />}
</>;

View file

@ -59,6 +59,14 @@ function OpenedCards({ entry, catalog, pendingOpeningId, content }) {
})}</ul>;
}
// Ce qu'a coûté une amélioration : des Éclats, un doublon, ou les doublons d'un Éveil (au palier de Puissance atteint).
function upgradeCost(details) {
const copies = (details.used ?? []).reduce((total, item) => total + item.count, 0) || 1;
const duplicates = copies > 1 ? `${copies} doublons utilisés` : "un doublon utilisé";
if (details.awakened) return `Éveil · ${duplicates}`;
return details.method === "duplicate" ? duplicates : `−${details.eclats} Éclats`;
}
function HistoryDetail({ entry, catalog }) {
const { details } = entry;
if (details.sent || details.received) return <span>{[details.sent && `Donnée : ${cardReference(details.sent, catalog)}`, details.received && `Reçue : ${cardReference(details.received, catalog)}`].filter(Boolean).join(" · ")}</span>;
@ -71,7 +79,7 @@ function HistoryDetail({ entry, catalog }) {
}
if (entry.type === "expedition_cancelled_by_guild") return <span>{details.destinationName} · cartes libérées, sans butin</span>;
if (entry.type === "expedition_dissolved") return <span>{details.destinationName} · {details.reason === "creator_left" ? "dissous par son créateur" : "pas assez de joueurs"} · cartes libérées</span>;
if (entry.type === "card_upgraded") return <span>{[cardReference(entry.entityId, catalog), `niveau ${details.level}`, `Puissance ${details.power}`, details.method === "duplicate" ? "un doublon utilisé" : `−${details.eclats} Éclats`].join(" · ")}</span>;
if (entry.type === "card_upgraded") return <span>{[cardReference(entry.entityId, catalog), `niveau ${details.level}`, `Puissance ${details.power}`, upgradeCost(details)].join(" · ")}</span>;
if (entry.type === "item_used") {
const name = { anchor: "Ancre des Veilleurs", guideStar: "Étoile guide", skyChart: "Carte céleste", fragment: "Carte au trésor", engraving: "Burin de graveur", plan: "Plan d’atelier", windRose: "Rose des vents" }[details.item] || details.item;
if (details.item === "windRose") return <span>{name} · nouvelles destinations du jour</span>;

View file

@ -0,0 +1,11 @@
// Rôle : mots des raretés dans les phrases (« 6 doublons rares », « doublons communs, rares et épiques »), plutôt que leur nom
// d'étiquette (« rareté Rare »).
// Adjectif d'une rareté accordé avec « doublon » : « rare », « légendaires », « communs ».
export function rarityAdjective(catalog, rarityId, count = 1) {
const word = (catalog.rarities.find((item) => item.id === rarityId)?.label ?? rarityId).toLocaleLowerCase("fr");
return count > 1 ? `${word}s` : word;
}
// Liste en français : « a, b et c » (`conjunction`) ou « a ou b » (`disjunction`).
export const frenchList = (items, type = "conjunction") => new Intl.ListFormat("fr", { type }).format(items);