Skip to content

Commit

Permalink
few bugfix, regarding juxtalinear editor and renaming the translation…
Browse files Browse the repository at this point in the history
…HelpImageCard to translationHelpMultimediaCard
  • Loading branch information
danielc-n committed Oct 18, 2024
1 parent 8893230 commit 58645b5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function SelectBook({
function bookSelect(e, bookId) {
e.preventDefault();
onChangeBook(bookId, selectedBooks[0]);
setBook(bookId);
setBook && setBook(bookId);
if (multiSelectBook === false) { selectBook(); }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
import { ReferenceContext } from '@/components/context/ReferenceContext';
import { debug } from '../../../logger';
import TranslationHelpsCard from './TranslationHelpsCard';
import TranslationHelpsImageCard from './TranslationHelpsImageCard';
import TranslationHelpsMultimediaCard from './TranslationHelpsMultimediaCard';

Check failure on line 8 in renderer/src/components/EditorPage/Reference/TranslationHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unable to resolve path to module './TranslationHelpsMultimediaCard'

Check failure on line 8 in renderer/src/components/EditorPage/Reference/TranslationHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

Missing file extension for "./TranslationHelpsMultimediaCard"
import ObsTnCard from './OBS/ObsTn';
import ObsTwlCard from './OBS/ObsTwlCard';
import packageInfo from '../../../../../package.json';
Expand Down Expand Up @@ -50,7 +50,6 @@ const TranslationHelps = ({
const pathRelationFile = path.resolve(pathToIngredients, 'relation.txt');

Check failure on line 51 in renderer/src/components/EditorPage/Reference/TranslationHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

Trailing spaces not allowed
if (fs.existsSync(pathRelationFile)) {
console.log("HERE WHAT NOPE")
setImagesPath(pathToIngredients);
const relationFileContent = fs.readFileSync(pathRelationFile, 'utf8');
const fileName = findFileByPartialName(fs, path.resolve(resourceDirPath), relationFileContent.trim());
Expand Down Expand Up @@ -93,7 +92,7 @@ const TranslationHelps = ({
);
case 'tir':
return (
<TranslationHelpsImageCard
<TranslationHelpsMultimediaCard
title={t('label-resource-tir')}
verse={verse}
chapter={chapter}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,24 @@ export default function TranslationHelpsCard({
let currentFile;
if (isBurrito) {
const asArray = Object.entries(offlineResource?.data?.value?.ingredients);
currentFile = asArray.filter(([key, value]) => {
// currentFile = asArray.filter(([key, value]) => {
// if (key.toLocaleLowerCase().indexOf(projectId.toLowerCase()) !== -1) {
// console.log("key ==", key);
// console.log("value ==", value);
// return value;
// }
// return [];
// })[0];
console.log("projectId.toLowerCase() ==", projectId.toLowerCase());

Check warning on line 119 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement

Check failure on line 119 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

Strings must use singlequote
for (let [key, value] of asArray) {

Check failure on line 120 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations

Check failure on line 120 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

'key' is never reassigned. Use 'const' instead

Check failure on line 120 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

'value' is never reassigned. Use 'const' instead
if (key.toLocaleLowerCase().indexOf(projectId.toLowerCase()) !== -1) {
return value;
console.log("key == ", key)

Check warning on line 122 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement

Check failure on line 122 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

Strings must use singlequote

Check failure on line 122 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

Missing semicolon
console.log("value == ", value)

Check warning on line 123 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement

Check failure on line 123 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

Strings must use singlequote
currentFile = key;
break;
}
return [];
})[0];
}
console.log("currentFile IN IF", currentFile)

Check warning on line 128 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
} else {
currentFile = offlineResource?.data?.value?.projects.filter((item) => {
if (item?.identifier.toLowerCase() === projectId.toLowerCase()) {
Expand All @@ -122,9 +134,11 @@ export default function TranslationHelpsCard({
return null;
});
}
console.log("currentFile OUT IF", currentFile)

Check warning on line 137 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
if (currentFile?.length > 0) {
// const filecontent = await fs.readFileSync(path.join(folder, projectName, currentFile[0].path), 'utf8');
const filecontent = await fs.readFileSync(path.join(folder, projectName, isBurrito ? currentFile[0] : currentFile[0].path), 'utf8');
const filecontent = await fs.readFileSync(path.join(folder, projectName, isBurrito ? currentFile : currentFile[0].path), 'utf8');
console.log("currentFile[0]", currentFile[0])

Check warning on line 141 in renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
// convert tsv to json
const headerArr = filecontent.split('\n')[0].split('\t');
let noteName;
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion renderer/src/components/EditorPage/TextEditor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function TextEditor() {
}
const { usj } = cachedData;
if (!usj && usj?.entries(usj).length === 0) { return; }
console.log(usj);
// console.log(usj);
setUsjInput(usj);
}, [book, cachedData]);

Expand Down

0 comments on commit 58645b5

Please sign in to comment.