diff --git a/package.json b/package.json index 3b7af0d2..090c21b4 100644 --- a/package.json +++ b/package.json @@ -185,7 +185,7 @@ "is-electron": "^2.2.1", "isomorphic-git": "^1.24.0", "js-yaml": "^4.1.0", - "jxl-pdf": "0.6.5", + "jxl-pdf": "0.7.0", "localforage": "1.10.0", "lodash.isequal": "^4.5.0", "markdown-translatable": "1.3.0", diff --git a/renderer/src/layouts/editor/InnerFramePopup.js b/renderer/src/layouts/editor/InnerFramePopup.js index c4b97fb5..8a2733cb 100644 --- a/renderer/src/layouts/editor/InnerFramePopup.js +++ b/renderer/src/layouts/editor/InnerFramePopup.js @@ -259,7 +259,8 @@ export default function InnerFramePopup() { // the order Of The Selected choice const [orderSelection, setOrderSelection] = useState([0]); // is the json is validate or not - const [isJsonValidate, setIsJsonValidate] = useState(false); + const [isJsonValidate, setIsJsonValidate] = useState(true); + const [jsonValidation, setJsonValidation] = useState({}); const [messagePrint, setMessagePrint] = useState(''); // the actual kitchenFaucet const pdfCallBacks = (json) => { @@ -285,7 +286,7 @@ export default function InnerFramePopup() { ); // the selected headerInfo - const [headerInfo, setHeaderInfo] = useState('{"sizes":"9on11","fonts":"allGentium","pages":"EXECUTIVE"}'); + const [headerInfo, setHeaderInfo] = useState('{"sizes":"9on11","fonts":"allGentium","pages":"EXECUTIVE", "verbose":"false"}'); // const [headerInfo, setHeaderInfo] = useState('{}'); const [nameFile, setNameFile] = useState(''); const [folder, setFolder] = useState(null); @@ -417,6 +418,7 @@ export default function InnerFramePopup() { useEffect(() => { const validationJson = global.PdfGenStatic.validateConfig(JSON.parse(kitchenFaucet)); + setJsonValidation(validationJson); if (validationJson.length === 0) { const header = JSON.parse(headerInfo); if ( @@ -438,7 +440,7 @@ export default function InnerFramePopup() { setIsJsonValidate(true); } } else { - setIsJsonValidate(false); + setIsJsonValidate(true); } }, [selected, headerInfo, orderSelection, folder, kitchenFaucet]); @@ -457,7 +459,6 @@ export default function InnerFramePopup() { } if (chosenFolder.filePaths.length > 0) { setFolder(chosenFolder.filePaths[0]); - setMessagePrint((prev) => `${prev }\nfolder selected : ${ chosenFolder.filePaths[0]}`); } else { // Handle case where no folder was selected // eslint-disable-next-line @@ -559,19 +560,19 @@ export default function InnerFramePopup() { }} > {SelectOption( - 'fonts', - 'fonts', - jsonWithHeaderChoice.fonts, + 'Paper size', + 'pages', + jsonWithHeaderChoice.pages, handleChangeHeaderInfo, )} {SelectOption( - 'Pages', - 'pages', - jsonWithHeaderChoice.pages, + 'Font', + 'fonts', + jsonWithHeaderChoice.fonts, handleChangeHeaderInfo, )} {SelectOption( - 'Sizes', + 'Font size', 'sizes', jsonWithHeaderChoice.sizes, handleChangeHeaderInfo, @@ -637,7 +638,7 @@ export default function InnerFramePopup() { fontWeight: 600, }} > - Advanced + Advanced mode
- mode Merge projects into a single + Merge projects into a single export, access more print types, and use loop mode.
@@ -750,6 +751,7 @@ export default function InnerFramePopup() { alignItems: 'center', backgroundColor: '#F50', color: 'white', + cursor: 'pointer', }} onClick={() => handleOpenModalAddWrapper(true)} > @@ -783,8 +785,9 @@ export default function InnerFramePopup() { openFileDialogSettingData(); }} > - Choose export folder + Choose an export folder +
{folder ? `Folder selected : ${folder}` : "Please choose an export folder"}
{ handleInputChange(e); @@ -815,7 +818,7 @@ export default function InnerFramePopup() { } } onClick={async () => { - if (isJsonValidate) { + if (jsonValidation.length == 0) { setMessagePrint(''); const pdfGen = new global.PdfGenStatic( JSON.parse(kitchenFaucet), @@ -830,6 +833,22 @@ export default function InnerFramePopup() { return; } setMessagePrint((prev) => `${prev }\nSuccessful pdf generation.`); + } else { + let cleanerMessage = jsonValidation.map( + txt => { + console.log(txt); + console.log("txt.includes('outputPath')", txt.includes('outputPath')); + if(txt.includes('outputPath')) { + return "Please choose an export folder"; + } else if(txt.includes('Unknown section type')) { + return "Please choose at least one 'Print type'"; + } else if(txt.includes('requires ranges')) { + return "Canon specification : please choose at least one book"; + } + return txt; + } + ).join('\n'); + setMessagePrint(`# Error\n${cleanerMessage}`); } }} > diff --git a/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/BookList.js b/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/BookList.js new file mode 100644 index 00000000..332bd64f --- /dev/null +++ b/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/BookList.js @@ -0,0 +1,17 @@ +import React from 'react'; + +export const BookList = ({ books }) => { + return ( +
+ {books.map((book, index) => ( +
+
+
+ {book} +
+
+
+ ))} +
+ ); +}; diff --git a/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/HeaderWrapper/BCVHeaderWrapper.js b/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/HeaderWrapper/BCVHeaderWrapper.js index 8341a0b1..15ba088c 100644 --- a/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/HeaderWrapper/BCVHeaderWrapper.js +++ b/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/HeaderWrapper/BCVHeaderWrapper.js @@ -1,12 +1,14 @@ import { useEffect, useState, useContext } from 'react'; import { Modal } from '@material-ui/core'; import { ProjectContext } from '@/components/context/ProjectContext'; +import { ReferenceContext } from '@/components/context/ReferenceContext'; import SelectBook from '@/components/EditorPage/Navigation/reference/SelectBook'; import { useBibleReference } from 'bible-reference-rcl'; import { XMarkIcon } from '@heroicons/react/24/outline'; import { useTranslation } from 'react-i18next'; import Layout from '../../../../../../public/icons/basil/Solid/Interface/Layout.svg'; import { TextOnlyTooltip, LoopSwitch } from '../fieldPicker/customMuiComponent'; +import { BookList } from '../BookList'; export function BCVWrapperSortableList({ keyWrapper, @@ -21,11 +23,16 @@ export function BCVWrapperSortableList({ const initialVerse = '1'; const { t } = useTranslation(); + const { + state: { + bookId, + }, + } = useContext(ReferenceContext); const { state: { bookList }, } = useBibleReference({ - initialBook, + initialBook: bookId, initialChapter, initialVerse, }); @@ -33,7 +40,7 @@ export function BCVWrapperSortableList({ states: { canonList }, } = useContext(ProjectContext); // end get all book from current project - const [selectedBooks, setSelectedBooks] = useState([]); + const [selectedBooks, setSelectedBooks] = useState(bookId ? [bookId.toUpperCase()] : []); const [openModalBook, setOpenModalBook] = useState(false); useEffect(() => { @@ -47,7 +54,7 @@ export function BCVWrapperSortableList({ return (
-
+
{advanceMode ? (
- Ressources in the loop will be added to - the export, form + Projects in the loop are added one by one to the document, + for each book selected above.
)} @@ -99,13 +106,13 @@ export function BCVWrapperSortableList({ style={{ margin: 'auto', display: 'flex', - justifyContent: 'center', + justifyContent: 'left', alignItems: 'center', // Added alignment to center vertically - fontSize: 24, + fontSize: 20, color: 'black', }} > -
+
Translation @@ -212,7 +219,10 @@ export function BCVWrapperSortableList({ > {t('label-custom')}
+
+ +
{ @@ -70,8 +75,8 @@ export function JXLHeaderWrapper({ fontWeight: 400, }} > - Ressources in the loop will be added to - the export, form + Projects in the loop are added one by one to the document, + for each book selected above.
)} diff --git a/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/HeaderWrapper/OBSHeaderWrapper.js b/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/HeaderWrapper/OBSHeaderWrapper.js index 1c9e7679..ecfa5a55 100644 --- a/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/HeaderWrapper/OBSHeaderWrapper.js +++ b/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/HeaderWrapper/OBSHeaderWrapper.js @@ -127,8 +127,8 @@ export function OBSWrapperSortableList({ fontWeight: 400, }} > - Ressources in the loop will be added to - the export, form + Projects in the loop are added one by one to the document, + for each book selected above. )} diff --git a/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/SectionAccordion.js b/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/SectionAccordion.js index ab7f094d..ebcd027c 100644 --- a/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/SectionAccordion.js +++ b/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/SectionAccordion.js @@ -20,6 +20,20 @@ const convertionWrapperType = (type) => { } }; +const hashPrintTypes = { + 'bcvBible': 'Bible by verse', + 'bookNote': 'Book Note', + '4ColumnSpread': 'Four resources on facing pages', + '2Column': 'Two resources in two columns', + 'biblePlusNotes': 'Notes focus (by verse)', + 'paraBible': 'Formatted Bible', + 'markdown': 'Simple formatting', + // 'jxlSpread': 'Juxtalinear on facing pages', + 'jxlSimple': 'Juxtalinear', + 'obs': 'Obs', + 'obsPlusNotes': 'Obs with Notes', +} + export function AccordionPicker({ language, setSelected, @@ -236,7 +250,7 @@ export function AccordionPicker({ }} > {keySpecification !== 'null' - ? keySpecification + ? hashPrintTypes[keySpecification] : 'select a print type'} diff --git a/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/WrapperTemplate.js b/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/WrapperTemplate.js index c0e3831d..74eb0eb4 100644 --- a/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/WrapperTemplate.js +++ b/renderer/src/layouts/editor/pdfGenInterface/pdfGenWrappers/WrapperTemplate.js @@ -228,7 +228,7 @@ export function WrapperTemplate({ }} >
- + )}
diff --git a/styles/globals.css b/styles/globals.css index c9e6f18f..0bc61f88 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -378,6 +378,7 @@ p.paragraph:has(.chapter) { border-radius: 6px; border-style: solid; border-width: 1px; + cursor: pointer; } .pdfChoice:hover { @@ -609,12 +610,18 @@ Select scribe theme Start */ .selectScribeTheme { + width: 200px; min-width: 120px; border-radius: 5px; border-color: rgba(115, 115, 115, 1); border-width: 1px; background-color: #ffffff; - /* Default background color */ +} + +.centered-container { + display: flex; + justify-content: center; + align-items: center; } .selectScribeTheme:hover {