Git Product home page Git Product logo

jerboa88 / mergist Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 25.26 MB

Mergist is an online tool to combine multiple PDF files into one

Home Page: https://mergist.johng.io

License: MIT License

TypeScript 75.16% JavaScript 22.06% CSS 2.79%
gatsby gatsby-site gatsbyjs pdf pdf-combiner pdf-generation pdf-lib pdf-merge pdf-merger react reactjs tailwindcss webapp website font-awesome framer-motion typescript daisyui

mergist's Introduction

Project type Language Repository size Project license Project URL

Mergist is an online tool to combine multiple PDF files into one. Mergist has no ads, no file size limits, and your files never leave your device.


Installation

  1. Install Node.js and NPM (if they are not already set up on your system). See nodejs.org for more details.
  2. Install Yarn 3 (if it is not already set up on your system). See the Yarn docs for more details.
  3. Clone the repo with https://github.com/jerboa88/Mergist.git. Alternatively, you can download the repository as a zip file and extract it.
  4. Enter the project root with cd Mergist.
  5. Use yarn install to install the app and all of its dependencies.

Usage

Mergist is a static site built using the Gatsby framework. We can build the site using the Gatsby CLI, which should have been installed with the install command above. All of the necessary commands are declared in package.json for convenience.

There are two ways to build & serve the site:

  1. Use yarn develop to run the app in development mode. This will start the development server at localhost:8000 (by default). The project will automatically be rebuilt when changes are made.

  2. Use yarn build to generate a production build of the app, then use yarn serve to serve it. The site can be viewed at localhost:9000 (by default).

yarn clean can be used to clear the local Gatsby cache if you encounter any issues with stale data/dependencies.

See the Gatsby CLI docs for additional commands and options. You will likely have to prefix commands with yarn to make sure package resolution works properly. For example, the above yarn develop is actually just a shortcut for yarn gatsby develop.

Contributing

This a personal project but feel free to create an issue if you encounter any problems with the site. Please see CONTRIBUTING.md for more details.

License

This project is licensed under the MIT License. See LICENSE for details. This project includes various resources which carry their own copyright notices and license terms. See LICENSE-THIRD-PARTY.md for more details.

mergist's People

Contributors

jerboa88 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

mergist's Issues

Add support for merging text files

What feature would you like?
Add support for merging a list of text files. We should be able to accept multiple file types as long as they are all text-based.

Add support for translations

What feature would you like?
The project only supports en-US atm so we should add support for additional translations.

Fix layout of file list on mobile

Helpful info

  • Browser & version: Irrelevant

Describe the bug
Mobile device screens are not always big enough to display the add/remove buttons and files in the file list. On small screen widths, we should:

  • Reduce unnecessary padding
  • Reduce text size. This should probably be reduced in general as the font size for the file list is larger than equivalent text in the header and footer components
  • Implement wrapping for flexboxes
  • Truncate long filenames to prevent overflow or line wrapping
  • Allow file removal by swiping on cards?

Steps to reproduce
Steps to reproduce the behavior:

  1. Open the site on a mobile device or emulate one via devtools
  2. Add some PDF files
  3. Notice that cards extend beyond the parent container horizontally and that add/remove buttons are cut off or not visible at all

Expected behavior
All elements should remain visible on small width screens, no matter how long filenames are.

Screenshots
localhost_8000_(iPhone 12 Pro)

Don't hide the merge button when only one file has been added

What feature would you like?
The merge button is currently hidden completely if only one file is added. Disable the button instead as this reduces layout changes and is more intuitive for users. Optionally show an informational tooltip when the button is disabled.

Disable reordering of files while processing

What feature would you like?
Although reordering files while merging is in process should have no side effects, it is not good UI design. We should be visually disabling the file list and preventing reordering of files whenever a merge is in progress.

The merge button should also be disabled to indicate that no input from the user is needed.

Improve accessibility

What feature would you like?
Various changes can be made to improve accessibility for disabled users:

  • Add descriptive text for label attached to theme toggle. This should only be visible to screen readers
  • Change h5 heading at top of file list to an h2 heading (ie. don't skip heading ranks)
  • Choose different secondary accent colors for dark and light themes. Change the brightness for primary and secondary theme colors to improve contrast against the page background
  • Limit animations when prefers-reduced-motion is set
  • Reconfigure sitemap generate such that sitemap.xml is located under the root domain?
  • Remove duplicate meta charset declaration
  • Remove section elements if possible. All page content aside from the header and footer are essentially in the same section, and it is not ideal to declare sections without titles

Fix broken link in footer

Helpful info

  • Browser & version: Irrelevant

Describe the bug
The JOHNG.IO link in the footer currently points to http://johng.io/projects/mergist, but we should probably change it johng.io because that link doesn't exist at the moment. This is more correct semantically as well since we never indicate we are linking to the project page on that site rather than the homepage.

Steps to reproduce
Steps to reproduce the behavior:

  1. Load the site
  2. Click the JOHNG.IO link in the footer
  3. Notice the link returns a 404 error

Expected behavior
Link goes to johng.io

Migrate form NPM to Yarn

Description
Switch from NPM to Yarn for package management. This will reduce the size of the local dependency cache and make builds faster.

Refactor components

Description
The components folder is a mess. We need to organize components together better based on their type and dependencies.

Reset button state upon merge error

Helpful info

  • Browser & version: Chrome 101.0.4951.54, probably others

Describe the bug
When a serious error is encountered in the merging process (ex. corrupted PDF file), an error alert is shown and we exit the createMergedFile method but the action button is never reset and still shows the progress percent.

Steps to reproduce
Steps to reproduce the behavior:

  1. Upload a corrupted file (ex. Mergist Test Document 5 (corrupt).pdf)
  2. Click the merge button
  3. See action button in indeterminate state

Expected behavior
We should either reset the button to its initial state (Merge), or change it to a disabled error button so that the user can remove the problematic file before trying again.

Screenshots
image

Add reset button to toggle switch components

What feature would you like?
Once a toggle switch is used, the user's preference is saved to local storage and used whenever the user visits the page again. Add a reset button/link to toggle switch components to handle the case where a user would like to have the theme or animation preference set automatically again.

Add additional error checking for createMergedFile method

What feature would you like?
Add additional error checking to the createMergedFile method of PDFManager to help avoid unexpected bugs. Since this method is only called once we can afford to do extra checks. For example:

  • Check that at least 1 PDF file has been added
  • Check that the size of the fileIds array matches the size of the file map
  • Add a separate try/catch block for setting metadata so that we can soft-fail and return a warning to the user instead of cancelling the merge altogether when there is an error
  • Figure out if it is possible to return warnings generated by pdf-lib. If some of the input files are only partially corrupted, it is still possible to merge them atm. However, pdf-lib displays warnings in the console when it encounters parsing issues so it would be good to inform the user that there were issues with the input files

Refactor modals

What feature would you like?

  • Use classes or React state to open popups instead of targets to prevent page from scrolling to the top when links are clicked
  • Make the privacy modal automatically open on page load
  • Add a new item to local storage to track whether it is a user's first time visiting the site and integrate this with the privacy modal

Fix OpenGraph image

Describe the bug
OpenGraph images don't support base64 URLs as currently used by the site. Copy this image to the public folder on build and replace this with a traditional URL.

Also add metadata tags for Twitter cards so that these can be displayed properly as well.

Steps to reproduce

  1. Use an online OpenGraph tag previewer
  2. Note that no image is displayed

Expected behavior
OpenGraph image should be shown as expected.

Use Web Workers to merge PDFs for actual PDF merging

What feature would you like?

  • Move the actual PDF merging functionality into a web worker so that it doesn't freeze up the UI.
  • Increase granularity of the calculateProgress() method
  • Throttle messages for progress updates to a reasonable speed and update the transition duration to match

Make a transparent icon with text for README

Description
The OpenGraph image is currently being used as the logo image in the README but the sizing and background color are not ideal for this purpose. Instead we should make make a transparent version of the text logo that is larger and update the README with it.

Fix FOUC issues for icons and custom fonts

Helpful info

  • Browser & version: Chrome 101.0.4951.54, probably others

Describe the bug
On page load, various styles aren't applied immediately, causing disruptive FOUC. Examples include:

  • The page title, which shows unstyled text for a brief moment (this is hardly noticeable in comparison to the other examples)
  • The icon next to the page title, which temporarily display's itself above the title text rather than inline with it
  • The add files icon of the file picker, which temporarily shows with a width of 100%
  • The icons in the footer take a moment to show up

Steps to reproduce
Steps to reproduce the behavior:

  1. Reload the page
  2. See FOUC

Expected behavior
Either a loading screen should be shown to cover the partially loaded page or the icons should be shown with their final layout positions/sizes when the page first loads.

Screenshots
image

Other
For the text, we should specific a default font that is much closer to the desired font so that any font changes are less noticeable. In addition, we could make the text transparent until it is ready to display.

For the icons, this is likely an issue with font-awesome styles loading later than the page content. This issue is mentioned in the FontAwesome docs.

Add Google Analytics tracking

Description
Add Google Analytics tracking code to the site so that we can track usage statistics. Update the privacy policy section to reflect this change.

Themes are not being set as expected

Helpful info

  • Browser & version: Chrome 101.0.4951.54, probably others

Describe the bug
If the light or dark theme has not been manually selected by the user, than it should automatically be chosen based on the prefers-color-scheme property. If this property is not available, we should be using the dark theme as the default.

Steps to reproduce
Steps to reproduce the behavior:

  1. Enable dark mode in your OS
  2. Reload the site in an incognito window so that local storage is not preserved
  3. Notice the light theme is loaded and the setting is automatically stored in local storage

Expected behavior
Theme selection should use the following rules:

  • We should be picking the theme based on the prefers-color-scheme property if it exists
  • We should not be saving any particular theme to local storage unless the user specifically picks that theme
  • If the prefers-color-scheme property is not available and the user has not picked a theme, we should select the dark theme by default as this is the best looking one

Add PWA support

What feature would you like?
Because processing is already done locally, we can make the site a progressive web app. This will allow users to add a shortcut to their homescreen and run the app offline. Lighthouse reports two issues that need to be resolved to make the site compatible:

  • Does not register a service worker that controls page and start_url
  • Manifest doesn't have a maskable icon

We can implement a service worker using gatsby-plugin-offline.

Add accept attribute to file input

What feature would you like?
Add accept attribute to file input so that the file picker will only suggest uploading PDF files in supported browsers.

Have alerts display as toasts

What feature would you like?
Change the layout of alerts such that they displayed in a fixed position at the bottom of the page on top of all other page elements. This will ensure that users always see alerts when they are generated and prevent unnecessary reflow when alerts are show/hidden.

Create CONTRIBUTIONS.md

Description
Create CONTRIBUTIONS.md with more details about the project. Move existing info out of the README and link to the new file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.