- Developers need an easy to use way to render Translation Helps resources as PDFs.
- Developers need an easy to use way to render Translation Helps resources in their apps that create a printed PDF.
- Create a single solution to rendering to screen and PDF.
- Create an RCL that renders resources that are passed into it to screen compatible with a page layout.
- Use Paged.js to generate a PDF preview of the rendered resources.
- Use the browser's print function to create PDF file.
The rendering of resources should not be convoluted by the fetching of resources. The fetching of data and rendering should be discrete layers. Applications may already have all the data required to render and just need to render it. Ie. translationCore Create, Gateway Edit, Gateway Admin. This also allows an app to include this funcitonality and be completely offline without fetching data.
This includes Reference Implementation or other Apps.
- Use permalinks to get owner/repository/language/branch.
- Fetch required resources via Gitea React Toolkit or future Gitea React Hooks.
- Load resources offline from filesystem/indexedDB.
- Import React Component/Hook Library to render Print Preview.
- Pass resources to be rendered into Print Preview component/hook.
- Choose where to render Print Preview on screen in another component such as full page, modal, or new window/tab.
The Print Preview React Component/Hook Library is focused on breaking down Resources into pieces and rendering them via Translation Helps RCL in a Layout that is a Print Preview via Paged.js.
- Import Translation Helps RCL for rendering pieces of resources.
- Use resources passed into library to render components in the Layout.
- Split resource content into pieces that Translation Helps RCL Components need to render.
- Use Paged.js to render Print Preview.
Translation Helps RCL is focused on rendering individual pieces of resources as React Components and providing necessary data for doing so.
- Render portions of a resource as a React component.
- Use props passed in to render.
- Provide hook to get a GL quote from OL quote and related scripture data.
The Node.js environment does not need to reacreate everything that the app or RCLs do to create a PDF.
-
Generate data required to pass to an App that generates Print Preview.
-
If the app requires .zip files of all resources, download and provide those.
-
If the app requires a link to make permalinks load required data from server.
-
-
Pass link into a headless browser and trigger Print function after the page renders.
This repository is broken down into two parts:
- The React Component Library (React Styleguidist) that is published to NPM.
- The Reference Implementation (Create React App) that is deployed to Netlify.