From 4aef6c6e253a9472c8ee99878c6ce15f00f7f083 Mon Sep 17 00:00:00 2001 From: Luis Carlos Date: Mon, 26 Aug 2024 00:42:47 -0400 Subject: [PATCH] Add languages --- src/components/EditorHeader/ControlPanel.jsx | 2 +- src/i18n/locales/en.js | 1 + src/i18n/locales/es.js | 1 + src/i18n/locales/fr.js | 1 + src/utils/exportAs/documentation.js | 12 ++++++------ 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/EditorHeader/ControlPanel.jsx b/src/components/EditorHeader/ControlPanel.jsx index d2ad401..fecedf2 100644 --- a/src/components/EditorHeader/ControlPanel.jsx +++ b/src/components/EditorHeader/ControlPanel.jsx @@ -1065,7 +1065,7 @@ export default function ControlPanel({ ], function: () => {}, }, - Documentation: { + documentation: { children: [ { Markdown: () => { diff --git a/src/i18n/locales/en.js b/src/i18n/locales/en.js index 944e44b..ace7f05 100644 --- a/src/i18n/locales/en.js +++ b/src/i18n/locales/en.js @@ -236,6 +236,7 @@ const en = { empty_index_name: "Declared an index with no name in table '{{tableName}}'", didnt_find_diagram: "Oops! Didn't find the diagram.", unsigned: "Unsigned", + documentation: "Documentation", }, }; diff --git a/src/i18n/locales/es.js b/src/i18n/locales/es.js index 173b297..7883dcf 100644 --- a/src/i18n/locales/es.js +++ b/src/i18n/locales/es.js @@ -212,6 +212,7 @@ const es = { edit_relationship: "{{extra}} Editar relación {{refName}}", delete_relationship: "Eliminar relación {{refName}}", not_found: "No encontrado", + documentation: "Documentación", }, }; diff --git a/src/i18n/locales/fr.js b/src/i18n/locales/fr.js index 31cb97f..2e8ae7f 100644 --- a/src/i18n/locales/fr.js +++ b/src/i18n/locales/fr.js @@ -217,6 +217,7 @@ const fr = { edit_relationship: "{{extra}} Modifier la relation {{refName}}", delete_relationship: "Supprimer la relation {{refName}}", not_found: "Non trouvé", + documentation: "Documentation", }, }; diff --git a/src/utils/exportAs/documentation.js b/src/utils/exportAs/documentation.js index cd169dd..f4764e8 100644 --- a/src/utils/exportAs/documentation.js +++ b/src/utils/exportAs/documentation.js @@ -27,7 +27,7 @@ export function jsonToDocumentation(obj) { ` |${field.comment ? field.comment : ""} |`; }).join("\n"); - return `### ${table.name}\n${table.comment ? table.comment : ""}\n` + + return `### ${table.name}\n${table.comment ? table.comment : ""}\n\n` + `| Name | Type | Settings | References | Note |\n` + `|-------------|---------------|-------------------------------|-------------------------------|--------------------------------|\n` + `${fields}\n\n`; @@ -44,16 +44,16 @@ export function jsonToDocumentation(obj) { .map((r) => { const startTable = obj.tables[r.startTableId].name; const endTable = obj.tables[r.endTableId].name; - return `- **${startTable} to ${endTable}**: ${r.cardinality} (${r.comment ? r.comment : ""})\n`; + return `- **${startTable} to ${endTable}**: ${r.cardinality} ${r.comment ? "(" + r.comment + ")" : ""}\n`; }).join("") : ""; console.log(obj.tables); console.log(obj.relationships); - return `# ${obj.title} Database Documentation\n## Summary\n- [Introduction](#introduction)\n- [Database Type](#database-type)\n`+ + return `# ${obj.title} documentation\n## Summary\n\n- [Introduction](#introduction)\n- [Database Type](#database-type)\n`+ `- [Table Structure](#table-structure)\n${documentationSummary}\n- [Relationships](#relationships)\n- [Database Diagram](#database-Diagram)\n\n`+ - `## Introduction\n${obj.notes}\n## Database type\n- **Database system:** `+ + `## Introduction\n\n## Database type\n\n- **Database system:** `+ `${obj.database.type}\n## Table structure\n\n${documentationEntities}`+ - `\n\n## Relationships\n${documentationRelationships}\n\n`+ - `## Database Diagram\n\`\`\`${jsonToMermaid(obj)}\`\`\``; + `\n\n## Relationships\n\n${documentationRelationships}\n\n`+ + `## Database Diagram\n\n\`\`\`${jsonToMermaid(obj)}\`\`\``; } \ No newline at end of file