Only mention Sokko TCG while it is enabled and fix shop pack rates
The sidebar and About page advertised the game even when disabled. The admin rates also warned that the shop pack had no drawable common, rare or epic card although it draws them from the other collections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
de7e72fb42
commit
09a92de2c5
11 changed files with 61 additions and 23 deletions
|
|
@ -66,7 +66,7 @@ export function Shell({ route, content, games, drawerGameId = "", drawerVisible
|
|||
</div>
|
||||
<div className="sidebar-note">
|
||||
<span className="badge">{content.sidebar.badge}</span>
|
||||
<p>{content.sidebar.note}</p>
|
||||
<p>{cardsEnabled ? content.sidebar.cardsNote : content.sidebar.note}</p>
|
||||
<div className="sidebar-storage-actions" aria-label="Actions globales de stockage">
|
||||
<Tooltip as="button" className="sidebar-action-button sidebar-backup-button nds-button" content={compactSidebar ? content.toolboxes.autoBackup.title : ""} position="right" data-size="sm" data-variant="primary" type="button" onClick={onOpenAutoBackup} aria-label={content.toolboxes.autoBackup.title} title={compactSidebar ? undefined : content.toolboxes.autoBackup.title} data-toolbox-tutorial-target="backup">{compactSidebar && <Icon name="save" />}<span className="sidebar-storage-action-label">{content.toolboxes.autoBackup.sidebarLabel}</span></Tooltip>
|
||||
<ImportButton className="sidebar-action-button nds-icon-button import-icon-button" data-size="sm" ariaLabel="Importer toutes les toolboxes" tooltip="Importer toutes les toolboxes" tooltipPosition="right" onFile={actions.importAllToolboxes} icon="import" />
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ function CollectionPage({ catalog, lookup, collection, dashboard, mutateCatalog,
|
|||
<section className="nds-panel nebula-admin-drop-rates" aria-labelledby="nebula-admin-drop-rates-title">
|
||||
<h3 id="nebula-admin-drop-rates-title">Taux de tirage</h3>
|
||||
<p className="nebula-form-help">Chaque carte d’un paquet est tirée indépendamment : d’abord la rareté selon ces poids, puis une variation au hasard parmi celles tirables de cette rareté. Les nouveaux taux s’appliquent immédiatement.</p>
|
||||
<DropRatesEditor key={JSON.stringify(collection.dropWeights || null)} catalog={catalog} lookup={lookup} collection={collection} busy={busy} mutateCatalog={mutateCatalog} />
|
||||
<DropRatesEditor key={JSON.stringify(collection.dropWeights || null)} catalog={catalog} collection={collection} busy={busy} mutateCatalog={mutateCatalog} />
|
||||
</section>
|
||||
<CollectionOpeningPanel catalog={catalog} lookup={lookup} collection={collection} mutateCatalog={mutateCatalog} busy={busy} />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,22 +6,16 @@ import { setCollectionActive, setDropRates, updateRechargeSetting } from "../car
|
|||
import { formatPercent, rarityPercentages, recommendedWeights } from "../dropRates.js";
|
||||
import { formatDuration, formatRechargeInterval } from "./adminFormat.js";
|
||||
|
||||
function drawableCounts(catalog, lookup, collectionId) {
|
||||
const counts = Object.fromEntries(catalog.rarities.map((rarity) => [rarity.id, 0]));
|
||||
for (const edition of catalog.editions) {
|
||||
if (!edition.promotional && !edition.retired && lookup.cards.get(edition.cardId)?.collectionId === collectionId) counts[edition.rarity] += 1;
|
||||
}
|
||||
return counts;
|
||||
}
|
||||
|
||||
export function DropRatesEditor({ catalog, lookup, collection, busy, mutateCatalog }) {
|
||||
export function DropRatesEditor({ catalog, collection, busy, mutateCatalog }) {
|
||||
const saved = collection.dropWeights || null;
|
||||
const toDraft = (weights) => Object.fromEntries(catalog.rarities.map((rarity) => [rarity.id, String(weights?.[rarity.id] ?? 0)]));
|
||||
const savedDraft = toDraft(saved);
|
||||
const recommendedDraft = toDraft(recommendedWeights(catalog.rarities));
|
||||
const [draft, setDraft] = useState(savedDraft);
|
||||
const [confirming, setConfirming] = useState(false);
|
||||
const counts = drawableCounts(catalog, lookup, collection.id);
|
||||
const counts = collection.drawableCounts || {};
|
||||
// Dans le paquet de la boutique, la part configurée favorise ses propres cartes : une chance moyenne par variation serait fausse.
|
||||
const perVariation = collection.packCategory !== "shop";
|
||||
const parsed = Object.fromEntries(Object.entries(draft).map(([rarity, value]) => [rarity, /^\d+$/.test(value) ? Number(value) : NaN]));
|
||||
const valid = Object.values(parsed).every((value) => Number.isInteger(value) && value >= 0 && value <= 1_000_000) && Object.values(parsed).some((value) => value > 0);
|
||||
const sameAs = (other) => catalog.rarities.every((rarity) => draft[rarity.id] === other[rarity.id]);
|
||||
|
|
@ -35,14 +29,14 @@ export function DropRatesEditor({ catalog, lookup, collection, busy, mutateCatal
|
|||
<caption className="sr-only">Taux de tirage de {collection.name}</caption>
|
||||
<thead><tr><th scope="col">Rareté</th><th scope="col">Poids</th><th scope="col"><Tooltip content="Chance par carte tirée">Par carte</Tooltip></th><th scope="col"><Tooltip content="Variations tirables">Tirables</Tooltip></th><th scope="col"><Tooltip content="Chance d’obtenir une variation précise">Variation</Tooltip></th></tr></thead>
|
||||
<tbody>{after.map(({ rarity, percent, weight }, index) => {
|
||||
const count = counts[rarity.id];
|
||||
const count = counts[rarity.id] || 0;
|
||||
const previous = before[index].percent;
|
||||
return <tr key={rarity.id} data-rarity={rarity.id}>
|
||||
<th scope="row">{rarity.label}</th>
|
||||
<td><input className="nds-input" data-size="sm" type="number" inputMode="numeric" min="0" max="1000000" step="1" aria-label={`Poids ${rarity.label}`} value={draft[rarity.id]} disabled={busy} onChange={(event) => setDraft({ ...draft, [rarity.id]: event.target.value })} /></td>
|
||||
<td><strong>{formatPercent(percent)}</strong>{saved && changed && valid && Math.abs(percent - previous) > 0.0001 && <small>avant {formatPercent(previous)}</small>}</td>
|
||||
<td>{count}</td>
|
||||
<td>{count && weight ? formatPercent(percent / count, 3) : "—"}{weight > 0 && !count && <span className="nebula-admin-drop-warning" role="status">Aucune carte tirable : ce poids sera ignoré.</span>}</td>
|
||||
<td>{perVariation && count && weight ? formatPercent(percent / count, 3) : "—"}{weight > 0 && !count && <span className="nebula-admin-drop-warning" role="status">Aucune carte tirable : ce poids sera ignoré.</span>}</td>
|
||||
</tr>;
|
||||
})}</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { Icon } from "../components/Icon.jsx";
|
|||
import { RichText } from "../components/RichText.jsx";
|
||||
import { HomeOnboardingSection } from "./HomeOnboardingSection.jsx";
|
||||
|
||||
export function AboutPage({ siteContent }) {
|
||||
export function AboutPage({ siteContent, cardsEnabled = false }) {
|
||||
const content = siteContent.about;
|
||||
const limits = Array.isArray(content.limits) ? content.limits : [];
|
||||
const toolGroups = Array.isArray(content.toolGroups) ? content.toolGroups : [];
|
||||
|
|
@ -21,7 +21,7 @@ export function AboutPage({ siteContent }) {
|
|||
<div>
|
||||
<p className="eyebrow">{content.eyebrow}</p>
|
||||
<h1>{content.title}</h1>
|
||||
<p><RichText text={content.description} /></p>
|
||||
<p><RichText text={cardsEnabled ? content.cardsDescription : content.description} /></p>
|
||||
</div>
|
||||
</section>
|
||||
<section className="about-story-section nebula-panel nds-panel" aria-labelledby="about-story-title">
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function UnknownRouteRedirect() {
|
|||
export function RouteContent(props) {
|
||||
const { route } = props;
|
||||
if (route === "/") return <HomePage {...props} />;
|
||||
if (route === "/about") return <AboutPage siteContent={props.siteContent} />;
|
||||
if (route === "/about") return <AboutPage siteContent={props.siteContent} cardsEnabled={props.cardsConfig?.enabled} />;
|
||||
if (route === "/library") return <Suspense fallback={<RouteLoader />}><LibraryPage {...props} /></Suspense>;
|
||||
if (route === "/cards" || route.startsWith("/cards/")) {
|
||||
const [, , first = "", second = "", third = ""] = route.split("/");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue