Skip to content

Commit

Permalink
PDF Generator update (#361)
Browse files Browse the repository at this point in the history
* - added a Juxta mode that creates a translation burrito
- added a 'factoryCreateContent.js'  file to help factorize some code for 'createObsContent', 'createVersificationUSFM' and 'createAudioVersification' in 'saveProjetcsMeta.js'

- fixing some typos, fixing lint

* Refactorization of 'saveProjectsMeta.js'

* Scripture Burrito as a resource : added the poissibility for the user to search and download a SB as a resource in a module

* removed checkbox from the UI and query sb resource everytime

* Added a juxtalinear editor along with a new mode.
- auto load a book on the opening of a project
- auto save after a modification
- fixed a bit of typos and code

* created a juxtaBurrito creator and a function to add juxta content. Also edited the icon for Juxta mode (it's visible now) you can create a new juxta project

* ADDED juxta support for SB creation and fixed some typos

* ADDED support for usfm import for a juxta project. Now we have to change the way a juxta json is built.

* juxtalineat mode functionnal

* UPDATE : now the interface handle corectly a json juxta file and update it if needed. and layout color update

* function to update a json juxta file if needed

* checksums ok for each modifications of the juxta

* bugfix : juxta was still using a translation settings

* quick fix

* added new kewboard shortcuts : 'Tab' to navigate through line chuncks, 'double click' to modify a chunck, 'enter' to end the modification of a chunck. And added seemless navigation between Juxtalinear editor and the BibleEditorX. Navigating through verses and chapters with the menu bar will load the corresponding sentence and vice versa.

* removing a useless 'console.log'

* FIXED font size when aditing a chunck, ADDED a bit of css and added a skip for the liter for .ts files

* added juxtalinear alignment editor

* added prototype of Grammateus

* added release for win64

* to the point it works in scribe

* checkpoint for juxtaligner

* base code for pdf print

* UPDATE succesful. we also save ne more option to the settings file of the user : to know if the help pop has already been opened once

* removed useless comments and log

* removed useless comments and log

* added markdown rendering for juxtalign editor and fix #6

* Do print modal
zoom on pdf
2 sections for prints
font size, paper size, font familly selection
restyling of original modal

* I put the sentences loading one layer outside the main editor, to avoid the editor to re-render everytime the juxtalinear editor module

* do uninstall wrong pdf-react

* added basecode for bouquet picker

* base for Scripture content picker

* 'it works' version of scriptureContentPicker in scribe, with a button to open the popup example

* do sortableList
do accordion in sortableList
do select new option for sortable list

* do UwCommit for presentation
do css merge

* do add hiroshi componenent

* now hiroshi's module is nice and clean. Scribe also have 'listResourcesForPdf' as the json list for the module to list resources

* added a search bar and bugfixes

* hid the 'Korennummi' and 'Word' tabs

* added functions to parse burrito resources

* Many bugfixes #303 (comment)

* add a check if the folder exists

* added a little bit of secure code for OBS loading

* changed the behavior of the Snackbar. If error === 'failure' the snackbar will show up for a longer time

* changed the behavior of the Snackbar. If error === 'failure' the snackbar will show up for a longer time

* do add picker for scriptures in pdf

* bold text 'CREATE PROJECT' for better visibility and start to check 'canonSpecification' for a juxta project

* added the feature that download resources not imported by the user for juxtalinear project

* ajout ScriptureContentSarchBar en module simple à utiliser

* added jxl-pdf as dependencies and an example with '4ColumnSpread'

* do specification picker

* succesfully imported jxl-pdf

* Now the user is correctly notified when the imported books does not match the canon specification, and also, the canon specification automatically matches the file imported

* minor bugfixes and code cleaning

* changed place of the 'nprogress' by few px

* do finish print data setter

* added a better user-friendly messages to nugde the user to import at least one resource for a Juxtalinear project

* FIXED : archive a Text Translation project OK.

* star/unstar a juxtalinear project works now

* merge 2

* FIX : bug that prevented some resources to show up. and FIX : bug that was throwing an error when a user where to search for a resource in the resource search field, and click on 'no match found'

* deleted package-lock.json and updated yarn.lock

* updated french translation

* add wrappers

* 1/2 do figma revamp

* bugfix : you can now edit a juxta project properly

* fixed bug where on book change, the sentences where wronly saved under another filename

* make 'jsonFileContent.bookCode' to upper case for safety reasons

* FIX : export/import now works properly for juxtalinear projects

* interface, first draft kitchen faucet

* added global.PdfGen directly into the code

* first stage of clean up of code en refactor style

* second commit structure and refactor code, merge pdfGen, usePdfGen signature for section creation

* some adjustment of ui, Json validation for Print button

* fixed some horrible indent

* fix obs auto zipping on export

* spinner and 'create project' button css fix.

* 'create project' button reverted

* pdfGen working interface with obs

* technical demo pdfgen wip

* fixed most of the lint errors. It leaves the 'control label errors' and one nested ternary operation here : 'renderer/src/components/EditorPage/Reference/OBS/ObsTn.js' line 147

* lint fixes until 'labels missing'

* removed useless file

* removed a comment

* updated yarn lock and deps

* no more error with big pdf

* updated packages

* bug fixes, by project print

* deleted useless files

* deleted useless files

* remove me file

* select options defaults

* little changes

* for PR change
add error in user consol when print fail
change logic for book select in bcvWrapper
4 - 2 column spread work
4 -2 column and other are now only selectable in advance mode
close pdf modal with button
change export file name
other small changes

* rollback package.json

* update yarn lock

* bug fixes

* pdf-gen updata

* removed 'korennumi' and 'word' tabs

* changed jxl-pdf version

* updated packages

* indentation fixes

* updated jxl and updated the code to work with juxta

* add last changes for PDF print.

* removed juxtalign mode and bugfix : #357 => #357

* trying to increase ulimit

* installing distutils setuptools directly from brew for mac machine

* installing python-setuptools

* dist : release error

* trying a configuration to increase 'maxConcurrentTasks'

* removed @mui/icons-react from deps and let it in devDeps

* updated jxl-pdf

* correction of code

* increased maxfiles form kernel directly

* updated actions/upload-artifact@v1 to v4

* trying kern.maxfiles=10485760 with sudo

* the mac build take too much time for yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.65s. so I'm trying to make it verbose to detect the problem. Also, I authorized the overwrite of the artifacts

* removed some useless 'console.log' and changed the name of the artifacts to avoid error within github actions

* updated jxl-pdf

* working reset button

* changes for : #361 (comment)

* hide the print button on audio projects

---------

Co-authored-by: danielc-n <[email protected]>
Co-authored-by: Aillet Gabriel <[email protected]>
Co-authored-by: gabrielaillet <[email protected]>
  • Loading branch information
4 people authored Sep 12, 2024
1 parent d69fde3 commit 7745fd3
Show file tree
Hide file tree
Showing 106 changed files with 45,923 additions and 2,522 deletions.
15 changes: 15 additions & 0 deletions .expo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
> Why do I have a folder named ".expo" in my project?
The ".expo" folder is created when an Expo project is started using "expo start" command.

> What do the files contain?
- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds.
- "packager-info.json": contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator.
- "settings.json": contains the server configuration that is used to serve the application manifest.

> Should I commit the ".expo" folder?
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.

Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
8 changes: 8 additions & 0 deletions .expo/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"hostType": "lan",
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": null,
"https": false
}
37 changes: 17 additions & 20 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# This workflow will do a clean install of node dependencies, build the source code, and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
Expand Down Expand Up @@ -34,14 +34,6 @@ jobs:
- name: set max memory allocation
run: export NODE_OPTIONS=-max_old_space_size=4096

# - name: Read version and commit sha
# run: |
# echo "::set-env name=HASH::$(echo $GITHUB_SHA | cut -c1-7)"
# echo "::set-env name=APP_VERSION::$(node -p -e "require('./package.json').version")"

# - name: Set artifact name
# run: echo "::set-env name=ARTIFACT_NAME::$(echo "Autographa-linux-x64-$APP_VERSION.deb")"

- name: package
id: package
run: |
Expand All @@ -51,10 +43,11 @@ jobs:
run: |
npx rimraf "dist/!(*.deb|*.AppImage|*.dmg)"
- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: Scribe
path: dist
name: Scribe
path: Scribe-${{ github.run_id }}-${{ github.sha }}
overwrite: true

build-windows:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -97,10 +90,11 @@ jobs:
mkdir -p artifacts
mv dist/*.exe artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: Scribe
name: Scribe-${{ github.run_id }}-${{ github.sha }}
path: artifacts
overwrite: true

build-mac:
runs-on: macos-latest
Expand All @@ -119,6 +113,8 @@ jobs:
- run: |
node --version
yarn --version
- name: Increase file descriptor limit
run: sudo sysctl -w kern.maxfiles=10485760 && sudo sysctl -w kern.maxfilesperproc=1048576
- name: set @bitregistry translation-help
run: yarn config set '@bit:registry' https://node.bit.dev

Expand All @@ -137,14 +133,14 @@ jobs:
echo 'export CPPFLAGS="-I/opt/homebrew/opt/jpeg/include"' >> $HOME/.zprofile
echo 'export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig"' >> $HOME/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
/opt/homebrew/opt/[email protected]/bin/pip3 install setuptools
/opt/homebrew/opt/[email protected]/bin/pip3 install distutils
brew install python-setuptools
- name: set max memory allocation
run: export NODE_OPTIONS=-max_old_space_size=4096

- name: yarn install
run: yarn install
run: yarn install --verbose

- name: install dmg-license
run: yarn add dmg-license
Expand All @@ -158,7 +154,8 @@ jobs:
run: |
npx rimraf "dist/!(*.deb|*.AppImage|*.dmg)"
- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: Scribe
path: dist
name: Scribe-${{ github.run_id }}-${{ github.sha }}
path: dist
overwrite: true
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ bower_components
out_functions/
out_publish/
/out
/release

# ignore db files
Autogrpha-DB/
Expand All @@ -34,7 +35,7 @@ Autogrpha-DB/
/build
/dist
.next/

.todo
# misc
.DS_Store
*.pem
Expand Down Expand Up @@ -73,4 +74,4 @@ coverage
.npm

# Optional REPL history
.node_repl_history
.node_repl_history
7 changes: 5 additions & 2 deletions main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ config.config();

// Packages
const { BrowserWindow, app, ipcMain } = require('electron');
const isDev = require('electron-is-dev');
// const isDev = require('electron-is-dev');
const prepareNext = require('electron-next');
const { autoUpdater } = require('electron-updater');

let mainWindow;
function isDev() {
return process.argv[2] == '--dev';
}
// Prepare the renderer once the app is ready
function createWindow() {
mainWindow = new BrowserWindow({
Expand All @@ -27,7 +30,7 @@ function createWindow() {
},
});
require('@electron/remote/main').enable(mainWindow.webContents);
const url = isDev
const url = isDev()
? 'http://localhost:8000'
: format({
pathname: join(__dirname, '../renderer/out/index.html'),
Expand Down
3 changes: 3 additions & 0 deletions main/preload.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { ipcRenderer } = require('electron');
const log = require('electron-log');
const fontList = require('font-list');
const { PdfGen } = require('jxl-pdf');

const _fonts = [];
const fetchFonts = async () => {
Expand All @@ -19,7 +20,9 @@ fetchFonts();
// Since we disabled nodeIntegration we can reintroduce
// needed node functionality here
process.once('loaded', () => {

global.ipcRenderer = ipcRenderer;
global.log = log;
global.PdfGenStatic = PdfGen
global.fonts = _fonts;
});
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const nextConfig = {
// Fixes npm packages that depend on `fs` module
if (!isServer) {
config.resolve.fallback.fs = false;
config.resolve.alias.canvas = false;
}
config.module.rules.push({
test: /\.md$/,
Expand Down
65 changes: 31 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"scripts": {
"clean": "rimraf dist renderer/.next renderer/out",
"start": "electron .",
"start": "electron . --dev",
"dev": "next dev",
"prod": "yarn build && next start",
"test": "jest",
Expand All @@ -27,19 +27,22 @@
"build": "next build renderer && next export renderer",
"pack-app": "yarn build && electron-builder --dir",
"dist": "yarn build && electron-builder -p never",
"deploy": "yarn build && electron-builder -p always"
"deploy": "yarn build && electron-builder -p always",
"makewin": "electron-builder --windows"
},
"eslintIgnore": [
"*.test.js",
"*.tsx",
"*.ts"
"*.test.js"
],
"build": {
"asar": true,
"extraResources": "renderer/public",
"extraMetadata": {
"main": "main/index.js"
},
"directories": {
"buildResources": "resources",
"output": "dist"
},
"files": [
"main",
"renderer/out",
Expand Down Expand Up @@ -83,19 +86,16 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.5.4",
"@babel/preset-env": "^7.18.2",
"@babel/preset-env": "^7.25.4",
"@babel/preset-react": "^7.17.12",
"@capacitor/cli": "5.4.2",
"@mui/icons-material": "^5.8.4",
"@netlify/plugin-nextjs": "^4.8.0",
"@playwright/test": "^1.36.2",
"@svgr/webpack": "^5.5.0",
"@testing-library/dom": "^8.13.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "14.2.0",
"@types/file-saver": "^2.0.5",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"ajv": "^6.12.2",
"autoprefixer": "^10.4.13",
"babel-jest": "^28.1.1",
Expand All @@ -119,24 +119,22 @@
"postcss": "^8.4.21",
"prettier": "^2.8.3",
"source-map-explorer": "^2.5.3",
"tailwindcss": "^3.2.4",
"@mui/icons-material": "^5.8.4"
"tailwindcss": "^3.2.4"
},
"peerDependencies": {
"@material-ui/core": "^4.x",
"@material-ui/lab": "^4.x",
"@mui/icons-material": "^5.x"
},
"dependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@capacitor/app": "5.0.6",
"@capacitor/core": "5.4.2",
"@capacitor/haptics": "5.0.6",
"@capacitor/keyboard": "5.0.6",
"@capacitor/status-bar": "5.0.6",
"@electron/remote": "^2.0.8",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@headlessui/react": "^1.7.8",
"@heroicons/react": "^2.0.14",
"@ionic/react": "^7.0.0",
Expand All @@ -145,9 +143,12 @@
"@material-ui/icons": "^4.11.3",
"@material-ui/lab": "4.0.0-alpha.57",
"@mui/lab": "^5.0.0-alpha.104",
"@mui/material": "^5.10.12",
"@mui/material": "^5.15.15",
"@mui/styles": "^5.15.18",
"@ory/kratos-client": "^0.10.1",
"@radix-ui/react-dialog": "^1.0.3",
"@radix-ui/react-dropdown-menu": "^2.0.4",
"@react-pdf/renderer": "^3.4.0",
"@supabase/supabase-js": "^2.26.0",
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/typography": "^0.5.9",
Expand All @@ -165,7 +166,7 @@
"clsx": "1.1.1",
"crypto-js": "^4.1.1",
"dotenv": "^16.3.1",
"electron-is-dev": "^2.0.0",
"easy-file-system": "^2.1.242",
"electron-log": "4.4.7",
"electron-next": "^3.1.5",
"electron-updater": "^5.0.1",
Expand All @@ -184,11 +185,14 @@
"is-electron": "^2.2.1",
"isomorphic-git": "^1.24.0",
"js-yaml": "^4.1.0",
"jxl-pdf": "0.6.1",
"localforage": "1.10.0",
"lodash.isequal": "^4.5.0",
"markdown-translatable": "1.3.0",
"md5": "^2.3.0",
"module": "^1.2.5",
"moment": "^2.29.3",
"net": "^1.0.2",
"next": "^13.4.10",
"next-images": "^1.8.4",
"next-on-netlify": "^3.0.1",
Expand All @@ -199,43 +203,36 @@
"postcss-nested": "^6.0.0",
"prop-types": "15.8.1",
"proskomma-core": "^0.10.4",
"proskomma-json-tools": "^0.8.8",
"proskomma-json-tools": "^0.8.16",
"proskomma-react-hooks": "2.4.0",
"random-words": "^2.0.1",
"raw-loader": "^4.0.2",
"react": "^18.2.0",
"react-beautiful-dnd": "^13.1.1",
"react-dom": "^18.2.0",
"react-i18next": "^11.17.1",
"react-icons": "^4.11.0",
"react-icons": "^5.3.0",
"react-markdown": "^9.0.0",
"react-media-recorder": "^1.6.6",
"react-modal": "^3.16.1",
"react-number-format": "^5.3.4",
"react-pdf": "^7.7.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "5.0.1",
"styled-components": "^5.3.6",
"tc-ui-toolkit": "5.3.3",
"tls": "^0.0.1",
"translation-helps-rcl": "3.5.12",
"typescript": "^4.9.5",
"use-deep-compare": "^1.1.0",
"usfm-editor": "0.8.7",
"usfm-grammar": "^2.3.0",
"uuid": "^8.3.2",
"wavesurfer.js": "^6.6.4",
"uuid": "^9.0.1",
"wavesurfer.js": "^6.6.2",
"webpack-node-externals": "^3.0.0",
"winston": "^3.7.2",
"word-aligner": "1.0.0",
"workbox-background-sync": "^7.0.0",
"workbox-broadcast-update": "^7.0.0",
"workbox-cacheable-response": "^7.0.0",
"workbox-core": "^7.0.0",
"workbox-expiration": "^7.0.0",
"workbox-google-analytics": "^7.0.0",
"workbox-navigation-preload": "^7.0.0",
"workbox-precaching": "^7.0.0",
"workbox-range-requests": "^7.0.0",
"workbox-routing": "^7.0.0",
"workbox-strategies": "^7.0.0",
"workbox-streams": "^7.0.0",
"xregexp": "^5.1.1",
"yarn": "^1.22.19"
},
Expand All @@ -252,4 +249,4 @@
"word-aligner": "$word-aligner",
"@mui/lab": "$@mui/lab"
}
}
}
1 change: 1 addition & 0 deletions public/icons/circle-info-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/icons/expand_more.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7745fd3

Please sign in to comment.