From ee3a50912a35e9aaf15ad73e4735fb80dfae5b24 Mon Sep 17 00:00:00 2001 From: Luis Carlos Date: Mon, 26 Aug 2024 11:48:58 -0400 Subject: [PATCH] fix the PR comments --- src/components/EditorHeader/ControlPanel.jsx | 39 +++++++++----------- src/i18n/locales/en.js | 1 - src/i18n/locales/es.js | 1 - src/i18n/locales/fr.js | 1 - src/utils/exportAs/documentation.js | 8 ++-- 5 files changed, 20 insertions(+), 30 deletions(-) diff --git a/src/components/EditorHeader/ControlPanel.jsx b/src/components/EditorHeader/ControlPanel.jsx index fecedf2..2c00f5f 100644 --- a/src/components/EditorHeader/ControlPanel.jsx +++ b/src/components/EditorHeader/ControlPanel.jsx @@ -1062,29 +1062,24 @@ export default function ControlPanel({ })); }, }, - ], - function: () => {}, - }, - documentation: { - children: [ - { - Markdown: () => { - setModal(MODAL.CODE); - const result = jsonToDocumentation({ - tables: tables, - relationships: relationships, - notes: notes, - subjectAreas: areas, - database: database, - title: title, - }); - setExportData((prev) => ({ - ...prev, - data: result, - extension: "md", - })); - } + { + Readme: () => { + setModal(MODAL.CODE); + const result = jsonToDocumentation({ + tables: tables, + relationships: relationships, + notes: notes, + subjectAreas: areas, + database: database, + title: title, + }); + setExportData((prev) => ({ + ...prev, + data: result, + extension: "md", + })); } + }, ], function: () => {}, }, diff --git a/src/i18n/locales/en.js b/src/i18n/locales/en.js index ace7f05..944e44b 100644 --- a/src/i18n/locales/en.js +++ b/src/i18n/locales/en.js @@ -236,7 +236,6 @@ 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 7883dcf..173b297 100644 --- a/src/i18n/locales/es.js +++ b/src/i18n/locales/es.js @@ -212,7 +212,6 @@ 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 2e8ae7f..31cb97f 100644 --- a/src/i18n/locales/fr.js +++ b/src/i18n/locales/fr.js @@ -217,7 +217,6 @@ 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 f4764e8..e67ded1 100644 --- a/src/utils/exportAs/documentation.js +++ b/src/utils/exportAs/documentation.js @@ -1,5 +1,6 @@ import { dbToTypes } from "../../data/datatypes"; import { jsonToMermaid } from "./mermaid"; +import { databases } from "../../data/databases"; export function jsonToDocumentation(obj) { @@ -44,16 +45,13 @@ 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}\n`; }).join("") : ""; - console.log(obj.tables); - console.log(obj.relationships); - 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\n## Database type\n\n- **Database system:** `+ - `${obj.database.type}\n## Table structure\n\n${documentationEntities}`+ + `${databases[obj.database].name}\n## Table structure\n\n${documentationEntities}`+ `\n\n## Relationships\n\n${documentationRelationships}\n\n`+ `## Database Diagram\n\n\`\`\`${jsonToMermaid(obj)}\`\`\``; } \ No newline at end of file