Make Sokko TCG's Watcher's Bag compact, with items used elsewhere shown small
- Only the engraving burin and the workshop plan (while the workshop is open) keep a card in the bag, now compact: art on the left, name, help and action on the right. - Every other item (destination items, wind rose, anchor, balm, oblivion scroll) is shown small on the same row, with what it does and where to use it in a tooltip. - The oblivion card picker is gone: the scroll is used from a card's sheet. - The bag's styles move to their own sheet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9d2c561fc6
commit
e8fe27a90f
10 changed files with 76 additions and 78 deletions
|
|
@ -1,6 +1,5 @@
|
|||
// Rôle : depuis les Expéditions, améliorer ses cartes sans passer par la collection. `CardSheet` ouvre la fiche d'une carte sur
|
||||
// son amélioration ; `EngraveModal` est l'atelier de gravure du Burin ; `ImproveCardPicker` montre les cartes jouables en
|
||||
// illustrations pour le Parchemin, puis ouvre la fiche de celle qu'on choisit sur sa répartition.
|
||||
// son amélioration ; `EngraveModal` est l'atelier de gravure du Burin.
|
||||
import { useState } from "react";
|
||||
import { Modal } from "../../components/Modal.jsx";
|
||||
import { CardDetailModal } from "./CardDetailModal.jsx";
|
||||
|
|
@ -210,21 +209,3 @@ export function CardSheet({ catalog, state, editionId, content, focus = null, bu
|
|||
if (!entry) return null;
|
||||
return <CardDetailModal catalog={catalog} state={state} entry={entry} content={content} focus={focus} initialTab="improve" runMutation={runMutation} busy={busy} onClose={onClose} />;
|
||||
}
|
||||
|
||||
export function ImproveCardPicker({ catalog, state, view, item, content, busy, runMutation, onClose }) {
|
||||
const [chosen, setChosen] = useState(null);
|
||||
const filters = useCardFilters();
|
||||
const cards = applyCardFilters([...view.cards].sort((a, b) => b.power - a.power), filters, { entryOf: (card) => editionEntry(catalog, card.editionId), statOf: (card, stat) => card.stats[stat], mode: "sort" });
|
||||
if (chosen) return <CardSheet catalog={catalog} state={state} editionId={chosen} content={content.cardSheet} focus="plan" busy={busy} runMutation={runMutation} onClose={onClose} />;
|
||||
return <Modal dialogClassName="confirm-modal nds-modal nebula-expedition-picker" labelledBy="nebula-improve-picker-title" onRequestClose={onClose}>
|
||||
<h2 id="nebula-improve-picker-title">{content.items[item]}</h2>
|
||||
<p className="nebula-form-help">{content.improvePickerHelp[item]}</p>
|
||||
<CardFilters catalog={catalog} filters={filters} entries={view.cards.map((card) => editionEntry(catalog, card.editionId))} content={content} />
|
||||
{cards.length ? <ul className="nebula-expedition-cards" aria-label={content.cardsLabel}>{cards.map((card) => <ExpeditionCardTile key={card.editionId} catalog={catalog} card={card}
|
||||
destination={null} content={content} selected={false} onSelect={() => setChosen(card.editionId)} />)}</ul>
|
||||
: <p className="nds-inline-notice" data-variant="info">{view.cards.length ? content.filterEmpty : content.improvePickerEmpty[item]}</p>}
|
||||
<div className="nds-toolbar nebula-expedition-picker-actions">
|
||||
<button className="nds-button" data-variant="secondary" type="button" onClick={onClose}>{content.cancel}</button>
|
||||
</div>
|
||||
</Modal>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@
|
|||
// suivre les autres joueurs (relecture régulière, retour sur l'onglet, échéances d'inscription et de retour).
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { Tabs } from "../../components/Tabs.jsx";
|
||||
import { Tooltip } from "../../components/Tooltip.jsx";
|
||||
import { addBonusDestination, addTestPlayer, claimExpedition, craftPowerCommon, recallExpedition, departExpedition, joinExpedition, leaveExpedition, loadExpeditions, markStarterSeen, openTestGroup, rerollDestinations, startExpedition, updateExpeditionMember } from "./cardsApi.js";
|
||||
import { CurrencyAmount } from "./Currency.jsx";
|
||||
import { fillTemplate, formatCountdown } from "./dailyShare.js";
|
||||
import { ExpeditionAtelier } from "./ExpeditionAtelier.jsx";
|
||||
import { ExpeditionGroupCard } from "./ExpeditionGroupCard.jsx";
|
||||
import { EngraveModal, ImproveCardPicker } from "./ExpeditionImprove.jsx";
|
||||
import { EngraveModal } from "./ExpeditionImprove.jsx";
|
||||
import { ExpeditionJourney } from "./ExpeditionJourney.jsx";
|
||||
import { MaskIcon } from "./ExpeditionLabels.jsx";
|
||||
import { ExpeditionPlanner } from "./ExpeditionPlanner.jsx";
|
||||
|
|
@ -35,10 +36,10 @@ const expeditionCall = (call) => async () => {
|
|||
}
|
||||
};
|
||||
|
||||
// Sac du Veilleur : objets rapportés ; les destinations bonus s'ouvrent ici, l'ancre et le burin depuis l'expédition et la fiche de carte.
|
||||
// Sac du Veilleur en grille de cartes : l'illustration de chaque objet (sans illustration, l'icône générique des objets) et sa
|
||||
// quantité, son nom, son aide, puis son action. La Rose des vents s'utilise depuis les destinations du jour ; le plan ouvre
|
||||
// l'atelier en fenêtre.
|
||||
// Sac du Veilleur : objets rapportés. Le Burin et le plan d'atelier (quand l'atelier est ouvert) s'utilisent depuis le Sac : chacun a
|
||||
// une carte compacte (l'illustration et la quantité, le nom, l'aide, l'action). Les autres s'utilisent ailleurs (sous les destinations
|
||||
// du jour, à côté d'elles, depuis l'expédition en route, la fiche d'une carte, l'Équipe du jour) : ils sont montrés en petit, sur la
|
||||
// même ligne, avec leur rôle et où s'en servir au survol.
|
||||
const BAG_ORDER = ["guideStar", "skyChart", "fragment", "windRose", "anchor", "engraving", "plan", "balm", "oblivion"];
|
||||
|
||||
function ItemArt({ id, count }) {
|
||||
|
|
@ -58,8 +59,10 @@ const readBagOpen = () => {
|
|||
}
|
||||
};
|
||||
|
||||
function ItemBag({ catalog, state, view, content, busy, onBonus, onCraft, onAtelierClosed, runMutation }) {
|
||||
function ItemBag({ catalog, state, view, content, busy, onCraft, onAtelierClosed, runMutation }) {
|
||||
const [crafting, setCrafting] = useState(false);
|
||||
// Burin : l'atelier de gravure, ouvert depuis le Sac.
|
||||
const [engraving, setEngraving] = useState(false);
|
||||
// Replié, le Sac n'est qu'une rangée d'objets et leur quantité : la préparation de l'expédition remonte.
|
||||
const [open, setOpen] = useState(readBagOpen);
|
||||
const toggle = () => {
|
||||
|
|
@ -70,17 +73,16 @@ function ItemBag({ catalog, state, view, content, busy, onBonus, onCraft, onAtel
|
|||
// Sans stockage, le choix vaut pour cette visite.
|
||||
}
|
||||
};
|
||||
// Burin ou Parchemin : la fenêtre des cartes ouverte pour cet objet, puis la fiche de la carte choisie.
|
||||
const [improving, setImproving] = useState(null);
|
||||
const { items } = view;
|
||||
const used = new Set(view.destinations.map((destination) => destination.bonusSlot).filter(Boolean));
|
||||
// Objets de destination : la place de la destination ajoutée et le nombre d'exemplaires qu'il faut.
|
||||
const actions = { guideStar: ["5", 1], skyChart: ["6", 1], fragment: ["hidden", view.fragmentsForMap] };
|
||||
// Les objets de destination d'abord, du plus simple au plus riche ; puis les autres.
|
||||
const owned = Object.entries(items).filter(([, count]) => count > 0)
|
||||
.sort(([a], [b]) => BAG_ORDER.indexOf(a) - BAG_ORDER.indexOf(b));
|
||||
// Sans objet, pas de Sac du Veilleur.
|
||||
if (!owned.length) return null;
|
||||
const usableHere = (id) => id === "engraving" || (id === "plan" && view.atelierAvailable);
|
||||
const full = owned.filter(([id]) => usableHere(id));
|
||||
const mini = owned.filter(([id]) => !usableHere(id));
|
||||
const help = (id) => fillTemplate(`${content.itemHelp[id]} ${content.itemWhere[id] || ""}`.trim(), { count: view.fragmentsForMap });
|
||||
return <section className="nds-panel nebula-expedition-bag" aria-labelledby="nebula-expedition-bag-title" data-open={open || undefined}>
|
||||
<div className="nebula-expedition-bag-heading">
|
||||
<h3 id="nebula-expedition-bag-title">{content.bagTitle}</h3>
|
||||
|
|
@ -91,20 +93,18 @@ function ItemBag({ catalog, state, view, content, busy, onBonus, onCraft, onAtel
|
|||
{open ? content.bagHide : content.bagShow}
|
||||
</button>
|
||||
</div>
|
||||
{open && <ul id="nebula-expedition-bag-items">{owned.map(([id, count]) => {
|
||||
const action = actions[id];
|
||||
return <li key={id} className="nds-card nebula-bag-item">
|
||||
{open && <div id="nebula-expedition-bag-items" className="nebula-expedition-bag-items">
|
||||
{full.length > 0 && <ul className="nebula-bag-items">{full.map(([id, count]) => <li key={id} className="nds-card nebula-bag-item">
|
||||
<ItemArt id={id} count={count} />
|
||||
<span className="nebula-bag-text"><strong>{content.items[id]}</strong><span className="nebula-form-help">{fillTemplate(content.itemHelp[id], { count: view.fragmentsForMap })}</span></span>
|
||||
{/* Les fragments n'ont de bouton qu'une fois assez nombreux pour une carte au trésor. */}
|
||||
{action && view.enabled && count >= action[1] && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy || used.has(action[0])} aria-label={fillTemplate(content.useItemLabel, { item: content.items[id] })} onClick={() => onBonus(id)}>{content.useItem}</button>}
|
||||
{(id === "engraving" || id === "oblivion") && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy}
|
||||
aria-label={fillTemplate(content.useItemLabel, { item: content.items[id] })} onClick={() => setImproving(id)}>{content.useItem}</button>}
|
||||
{id === "plan" && view.atelierAvailable && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => setCrafting(true)}>{content.atelierOpen}</button>}
|
||||
</li>;
|
||||
})}</ul>}
|
||||
{improving === "engraving" && <EngraveModal catalog={catalog} state={state} view={view} content={content} busy={busy} runMutation={runMutation} onClose={() => setImproving(null)} />}
|
||||
{improving === "oblivion" && <ImproveCardPicker catalog={catalog} state={state} view={view} item={improving} content={content} busy={busy} runMutation={runMutation} onClose={() => setImproving(null)} />}
|
||||
{id === "plan" ? <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => setCrafting(true)}>{content.atelierOpen}</button>
|
||||
: <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} aria-label={fillTemplate(content.useItemLabel, { item: content.items[id] })} onClick={() => setEngraving(true)}>{content.useItem}</button>}
|
||||
</li>)}</ul>}
|
||||
{mini.length > 0 && <ul className="nebula-bag-minis" aria-label={content.bagOthers}>{mini.map(([id, count]) => <li key={id}>
|
||||
<Tooltip className="nebula-bag-mini" content={help(id)}><ItemArt id={id} count={count} /><span>{content.items[id]}</span></Tooltip>
|
||||
</li>)}</ul>}
|
||||
</div>}
|
||||
{engraving && <EngraveModal catalog={catalog} state={state} view={view} content={content} busy={busy} runMutation={runMutation} onClose={() => setEngraving(false)} />}
|
||||
{crafting && <ExpeditionAtelier catalog={catalog} state={state} content={content} busy={busy} powerValues={view.powers} onCraft={onCraft} onClose={() => { setCrafting(false); onAtelierClosed(); }} />}
|
||||
</section>;
|
||||
}
|
||||
|
|
@ -272,7 +272,7 @@ export function ExpeditionsPanel({ catalog, state, runMutation, busy, content, j
|
|||
<h3>{content.planTitle}</h3>
|
||||
<span className="nebula-form-help">{fillTemplate(content.nextDay, { time: formatCountdown(view.nextDayAt - now) })}</span>
|
||||
</div>
|
||||
<ItemBag catalog={catalog} state={state} view={view} content={content} busy={busy} onBonus={bonus} onCraft={craft} onAtelierClosed={reload} runMutation={equipAndRefresh} />
|
||||
<ItemBag catalog={catalog} state={state} view={view} content={content} busy={busy} onCraft={craft} onAtelierClosed={reload} runMutation={equipAndRefresh} />
|
||||
<ExpeditionPlanner key={view.day} catalog={catalog} state={state} view={view} content={content} busy={busy} onStart={start} onReroll={reroll} onBonus={bonus} runMutation={equipAndRefresh} />
|
||||
</>}
|
||||
</>}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue