sokko-g/website/src/features/toolboxes/modules/EquipmentPlannerEditors.jsx
Shinuwa 22b397ebfa Document Sokko G's architecture and folders, and move JavaScript file headers to JSDoc @file blocks
Add ARCHITECTURE.md (layers, flows, folder map, glossary), CONTRIBUTING.md
(setup and step-by-step recipes) and a README in each main folder, with an
index of docs/. Convert the 511 JavaScript headers from "// Rôle :" lines to
JSDoc @file blocks, define a three-level header template in website/AGENTS.md
and check the header in tests/file-headers.test.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:42:13 +01:00

74 lines
3 KiB
JavaScript

/**
* @file Expose l'affichage détaillé et les éditeurs spécialisés du planificateur d'équipements.
*/
import { Icon } from "../../../components/Icon.jsx";
import { formatValue } from "./equipmentPlannerOptions.js";
import { SocketShapeIcon } from "./EquipmentPlannerPickers.jsx";
export { CharacteristicsEditor } from "./EquipmentPlannerCharacteristics.jsx";
export { MaterialsEditor } from "./EquipmentPlannerMaterials.jsx";
export { SocketItemsEditor } from "./EquipmentPlannerSockets.jsx";
export function EquipmentDisplay({ equipment, textContent }) {
const hasStats = equipment.characteristics.length > 0;
const hasSockets = equipment.socketItems.length > 0;
const hasCraft = Boolean(equipment.obtain || equipment.materials.length);
if (!hasStats && !hasSockets && !hasCraft) {
return <p className="equipment-planner-muted">{textContent.emptyEquipmentDetails || "Aucun détail renseigné."}</p>;
}
return (
<div className="equipment-planner-display-grid">
{hasStats && (
<section className="equipment-planner-display-panel">
<h4>{textContent.displayStatsTitle || "Statistiques"}</h4>
<ul>
{equipment.characteristics.map((trait) => (
<li className="equipment-planner-display-stat" key={trait.id}>
<Icon name={trait.icon || "sword"} />
<span>{trait.name}</span>
{trait.value !== "" && <b>{formatValue(trait.value)}</b>}
</li>
))}
</ul>
</section>
)}
{hasSockets && (
<section className="equipment-planner-display-panel">
<h4>{textContent.displaySocketTitle || "Objets sertis"}</h4>
<ul>
{equipment.socketItems.map((socketItem) => (
<li className="equipment-planner-display-socket" key={socketItem.id}>
<SocketShapeIcon shape={socketItem.shape} color={socketItem.color} />
<div>
<strong>{socketItem.name}</strong>
{socketItem.bonuses.map((bonus) => (
<small key={bonus.id}>{bonus.name}{bonus.value !== "" ? ` +${formatValue(bonus.value)}` : ""}</small>
))}
</div>
</li>
))}
</ul>
</section>
)}
{hasCraft && (
<section className="equipment-planner-display-panel">
<h4>{textContent.craftTab || "Craft"}</h4>
{equipment.obtain ? <p>{equipment.obtain}</p> : null}
{equipment.materials.length ? (
<ul>
{equipment.materials.map((material) => <li key={material.id}><span>{material.name}</span><b>x{material.qty}</b></li>)}
</ul>
) : null}
</section>
)}
</div>
);
}
export function TabIcon({ tab }) {
if (tab === "stats") return <span className="equipment-planner-percent-icon" aria-hidden="true">%</span>;
if (tab === "sockets") return <Icon name="jewel" />;
return <Icon name="hammer" />;
}