diff --git a/client/src/components/attachments/Attachments/CsvViewer.jsx b/client/src/components/attachments/Attachments/CsvViewer.jsx
index dab29ae2..959087f0 100644
--- a/client/src/components/attachments/Attachments/CsvViewer.jsx
+++ b/client/src/components/attachments/Attachments/CsvViewer.jsx
@@ -3,20 +3,19 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
-import React, { useEffect, useState, useCallback, useMemo } from 'react';
+import React, { useCallback, useEffect, useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
-import { Pagination, Table } from 'semantic-ui-react';
import Papa from 'papaparse';
import Frame from 'react-frame-component';
+import { Loader, Pagination, Table } from 'semantic-ui-react';
import styles from './CsvViewer.module.scss';
const ROWS_PER_PAGE = 50;
-/* eslint-disable react/no-array-index-key */
const CsvViewer = React.memo(({ src, className }) => {
- const [csvData, setCsvData] = useState(null);
+ const [rows, setRows] = useState(null);
const [currentPage, setCurrentPage] = useState(1);
const frameStyles = useMemo(
@@ -34,7 +33,7 @@ const CsvViewer = React.memo(({ src, className }) => {
[],
);
- const handlePageChange = useCallback((e, { activePage }) => {
+ const handlePageChange = useCallback((_, { activePage }) => {
setCurrentPage(activePage);
}, []);
@@ -49,47 +48,46 @@ const CsvViewer = React.memo(({ src, className }) => {
Papa.parse(text, {
skipEmptyLines: true,
- complete: (results) => {
- const rows = results.data;
- setCsvData({
- rows,
- totalRows: rows.length,
- });
+ complete: ({ data }) => {
+ setRows(data);
},
});
- } catch (err) {
- setCsvData(null);
+ } catch {
+ /* empty */
}
}
fetchFile();
}, [src]);
- if (!csvData) {
- return null;
+ if (rows === null) {
+ return ;
}
- const startIdx = (currentPage - 1) * ROWS_PER_PAGE;
- const endIdx = startIdx + ROWS_PER_PAGE;
- const currentRows = csvData.rows.slice(startIdx, endIdx);
- const totalPages = Math.ceil(csvData.totalRows / ROWS_PER_PAGE);
+ const startIndex = (currentPage - 1) * ROWS_PER_PAGE;
+ const endIndex = startIndex + ROWS_PER_PAGE;
+ const currentRows = rows.slice(startIndex, endIndex);
+ const totalPages = Math.ceil(rows.length / ROWS_PER_PAGE);
- const content = (
-
+ return (
+
{frameStyles.join('')}}
+ className={classNames(styles.wrapper, className)}
+ >
- {csvData.rows[0].map((header, index) => (
- {header}
+ {rows[0].map((cell) => (
+ {cell}
))}
- {currentRows.slice(1).map((row, rowIndex) => (
-
- {row.map((cell, cellIndex) => (
- {cell}
+ {currentRows.slice(1).map((row) => (
+
+ {row.map((cell) => (
+ {cell}
))}
))}
@@ -98,30 +96,18 @@ const CsvViewer = React.memo(({ src, className }) => {
{totalPages > 1 && (
)}
-
- );
-
- return (
- {frameStyles.join('')}}
- className={classNames(styles.wrapper, className)}
- >
- {content}
);
});
-/* eslint-enable react/no-array-index-key */
CsvViewer.propTypes = {
src: PropTypes.string.isRequired,
diff --git a/client/src/locales/de-DE/core.js b/client/src/locales/de-DE/core.js
index a4798104..e1cd381a 100644
--- a/client/src/locales/de-DE/core.js
+++ b/client/src/locales/de-DE/core.js
@@ -1,5 +1,6 @@
import dateFns from 'date-fns/locale/de';
import timeAgo from 'javascript-time-ago/locale/de';
+
import markdownEditor from './markdown-editor.json';
export default {
diff --git a/client/src/locales/de-DE/markdown-editor.json b/client/src/locales/de-DE/markdown-editor.json
index e979d30d..4f2ca91e 100644
--- a/client/src/locales/de-DE/markdown-editor.json
+++ b/client/src/locales/de-DE/markdown-editor.json
@@ -63,7 +63,7 @@
"numbered-list_title": "Nummerierte Liste",
"numbered-list_hint": "1. Dein Text",
"documentation": "Dokumentation",
- "documentation_link": " https://diplodoc.com/docs/en/syntax/"
+ "documentation_link": "https://diplodoc.com/docs/en/syntax/"
},
"menubar": {
"bold": "Fett",
diff --git a/client/src/locales/en-GB/markdown-editor.json b/client/src/locales/en-GB/markdown-editor.json
index 06d3bd10..641c354a 100644
--- a/client/src/locales/en-GB/markdown-editor.json
+++ b/client/src/locales/en-GB/markdown-editor.json
@@ -63,7 +63,7 @@
"numbered-list_title": "Numbered list",
"numbered-list_hint": "1. Your text",
"documentation": "Documentation",
- "documentation_link": " https://diplodoc.com/docs/en/syntax/"
+ "documentation_link": "https://diplodoc.com/docs/en/syntax/"
},
"menubar": {
"bold": "Bold",
diff --git a/client/src/locales/en-US/markdown-editor.json b/client/src/locales/en-US/markdown-editor.json
index 06d3bd10..641c354a 100644
--- a/client/src/locales/en-US/markdown-editor.json
+++ b/client/src/locales/en-US/markdown-editor.json
@@ -63,7 +63,7 @@
"numbered-list_title": "Numbered list",
"numbered-list_hint": "1. Your text",
"documentation": "Documentation",
- "documentation_link": " https://diplodoc.com/docs/en/syntax/"
+ "documentation_link": "https://diplodoc.com/docs/en/syntax/"
},
"menubar": {
"bold": "Bold",
diff --git a/client/src/locales/pl-PL/markdown-editor.json b/client/src/locales/pl-PL/markdown-editor.json
index e71a1de1..3513607c 100644
--- a/client/src/locales/pl-PL/markdown-editor.json
+++ b/client/src/locales/pl-PL/markdown-editor.json
@@ -63,7 +63,7 @@
"numbered-list_title": "Lista numerowana",
"numbered-list_hint": "1. Twój tekst",
"documentation": "Dokumentacja",
- "documentation_link": " https://diplodoc.com/docs/en/syntax/"
+ "documentation_link": "https://diplodoc.com/docs/en/syntax/"
},
"menubar": {
"bold": "Pogrubienie",
diff --git a/client/src/locales/ru-RU/core.js b/client/src/locales/ru-RU/core.js
index 8a99fa58..23a8ebcf 100644
--- a/client/src/locales/ru-RU/core.js
+++ b/client/src/locales/ru-RU/core.js
@@ -1,5 +1,6 @@
import dateFns from 'date-fns/locale/ru';
import timeAgo from 'javascript-time-ago/locale/ru';
+
import markdownEditor from './markdown-editor.json';
export default {
diff --git a/client/src/locales/ru-RU/markdown-editor.json b/client/src/locales/ru-RU/markdown-editor.json
index 0beafbbf..1e78db5b 100644
--- a/client/src/locales/ru-RU/markdown-editor.json
+++ b/client/src/locales/ru-RU/markdown-editor.json
@@ -7,7 +7,7 @@
"bundle": {
"error-title": "Ошибка в редакторе markdown",
"settings_wysiwyg": "Визуальный редактор (wysiwyg)",
- "settings_markup": "Разметка Markdown",
+ "settings_markup": "Разметка markdown",
"markup_placeholder": "Введите разметку markdown..."
},
"codeblock": {
@@ -63,7 +63,7 @@
"numbered-list_title": "Нумерованный список",
"numbered-list_hint": "1. Ваш текст",
"documentation": "Документация",
- "documentation_link": " https://diplodoc.com/docs/en/syntax/"
+ "documentation_link": "https://diplodoc.com/docs/en/syntax/"
},
"menubar": {
"bold": "Жирный",