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>
52 lines
2.2 KiB
JavaScript
52 lines
2.2 KiB
JavaScript
/**
|
|
* @file Fournit les boutons et modales d'import/export texte des outils compatibles.
|
|
*/
|
|
|
|
import { Icon } from "../../../components/Icon.jsx";
|
|
import { TextImportModal } from "./TextImportModal.jsx";
|
|
import { useTextExchange } from "./useTextExchange.js";
|
|
|
|
export function TextExchangeActions({ type, data, context, onImport, textContent = {}, exportLabel = "" }) {
|
|
const exchange = useTextExchange({ type, data, context, onImport, textContent });
|
|
const importAccessibleLabel = textContent.importOpenButton || "Importer du texte";
|
|
const exportAccessibleLabel = textContent.exportOpenButton || exportLabel || "Exporter en format texte";
|
|
const configurationText = context.moduleConfigurationText || {};
|
|
|
|
return (
|
|
<>
|
|
<div className="text-import-actions">
|
|
<button className="nds-button" data-size="sm" type="button" onClick={exchange.openImport} aria-label={importAccessibleLabel}>
|
|
<Icon name="import" />
|
|
<span>{configurationText.importButtonLabel || "Importer"}</span>
|
|
</button>
|
|
<button className="nds-button" data-size="sm" type="button" onClick={exchange.openExport} disabled={!exchange.canExport} aria-label={exportAccessibleLabel}>
|
|
<Icon name="export" />
|
|
<span>{configurationText.exportButtonLabel || "Exporter"}</span>
|
|
</button>
|
|
</div>
|
|
{exchange.mode === "import" && (
|
|
<TextImportModal
|
|
title={textContent.importModalTitle || "Importer du texte"}
|
|
value={exchange.draft}
|
|
onChange={exchange.updateDraft}
|
|
error={exchange.error}
|
|
placeholder={textContent.importPlaceholder || "Collez le contenu à importer..."}
|
|
submitLabel={textContent.importButton || "Importer le texte"}
|
|
onSubmit={exchange.submitImport}
|
|
onClose={exchange.closeModal}
|
|
/>
|
|
)}
|
|
{exchange.mode === "export" && (
|
|
<TextImportModal
|
|
title={textContent.exportModalTitle || "Exporter en format texte"}
|
|
value={exchange.exportText}
|
|
readOnly
|
|
info={textContent.exportInfo || ""}
|
|
submitLabel={textContent.exportButton || "Copier le texte"}
|
|
onCopy={exchange.copyExport}
|
|
onClose={exchange.closeModal}
|
|
/>
|
|
)}
|
|
</>
|
|
);
|
|
}
|