diff --git a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js index 62a02bdd5..96fade0db 100644 --- a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js +++ b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js @@ -1,11 +1,110 @@ -import React, { useRef, useEffect } from 'react'; +import React, { useRef, useEffect, useState } from 'react'; import { useDispatch } from 'react-redux'; import { useFormik } from 'formik'; import * as Yup from 'yup'; import { browseDirectory } from 'providers/ReduxStore/slices/collections/actions'; import Modal from 'components/Modal'; +import { IconAlertTriangle, IconArrowRight, IconCaretDown, IconCaretRight, IconCopy } from '@tabler/icons'; +import toast from 'react-hot-toast'; -const ImportCollectionLocation = ({ onClose, handleSubmit, collectionName }) => { +const TranslationLog = ({ translationLog }) => { + const [showDetails, setShowDetails] = useState(false); + const preventSetShowDetails = (e) => { + e.stopPropagation(); + e.preventDefault(); + setShowDetails(!showDetails); + }; + const copyClipboard = (e, value) => { + e.stopPropagation(); + e.preventDefault(); + navigator.clipboard.writeText(value); + toast.success('Copied to clipboard'); + }; + return ( +
+
+
+
+
+
+

+ Warning: Some commands were not translated.{' '} +

+
+
+
+ + {showDetails && ( +
+ + Impacted Collections: {Object.keys(translationLog || {}).length} + + + Impacted Lines:{' '} + {Object.values(translationLog || {}).reduce( + (acc, curr) => acc + (curr.script?.length || 0) + (curr.test?.length || 0), + 0 + )} + + + The numbers after 'script' and 'test' indicate the line numbers of incomplete translations. + + + +
+ )} +
+ ); +}; + +const ImportCollectionLocation = ({ onClose, handleSubmit, collectionName, translationLog }) => { const inputRef = useRef(); const dispatch = useDispatch(); @@ -24,7 +123,6 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, collectionName }) => handleSubmit(values.collectionLocation); } }); - const browse = () => { dispatch(browseDirectory()) .then((dirPath) => { @@ -52,7 +150,9 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, collectionName }) => Name
{collectionName}
- + {translationLog && Object.keys(translationLog).length > 0 && ( + + )} <>