TBR reader/web(refactor): adapts old file UI to work with device-sets

Several components were refactored and refined, at a high level the UI state now
treats device-sets as a top level component (over files). The initial screens
shows a list of device-sets each of which owns a file, some meta information and
a collection of devices. Several modifications were made to the markup and style
to have a cleaner (more material based) look and feel.

Other changes in this CL include:

Behavior for "Add a file": When clicking the "+" button in the UI and a file has been selected by the user:

1. A device-set is created, with an empty file and devices collection.
2. A file with the added PDF blob is added to the new device-set.
3. The "current" device is appended to the device-set's collection of devices.
4. The new device-set shows up in the list of items on the main screen.

Application state: The entire application state in main.js is continuously
serialized and saved to a local cache based on window.localStorage. Since PDF
blobs are large and not appropriate for this type of cacheing they are saved to
IndexedDB (SEE: https://goo.gl/sKGvCB) using a small wrapper in
browser/dom/blob-store.js. The state is then rehydrated on domready from any
previously saved state. This helps ensure correct initialization of state and
child components. Additionally this makes it possible to view the pervious state
when reloading the page.

Router: The router was refactored so that a hash of routes are passed into state
construction and can be checked against on app render. The router state atom
holds the current route, params from named routes like "/posts/:id", and
attaches a popstate listener to the window. The shared anchor helper was removed
since normal click events will trigger the popstate listener and call the
router's internal routing channel.

* The files component has been deleted.
* PDF rendering has been moved to the device-set component.
* Device-set list item rendering has been moved to the device-set component.
* The file component's Blob hashes are now MD5 hex digests.

SEE: IndexedDB - https://goo.gl/sKGvCB

Next Steps:

* Device-set management UI - https://github.com/vanadium/reader/issues/38
* Hook Vanadium/Syncbase back up - https://github.com/vanadium/reader/issues/39

Closes #7

Change-Id: Ifbdd409b44d96d796865aa8c179ea85a858f3c84
42 files changed
tree: 3d51b9f2d5814fd1c5bf619a689f7345abce093c
  1. android/
  2. common/
  3. web/
  4. .gitignore
  5. .jiriignore
  6. AUTHORS
  7. CONTRIBUTING.md
  8. CONTRIBUTORS
  9. LICENSE
  10. Makefile
  11. PATENTS
  12. README.md
  13. VERSION
README.md

Reader

An example multi-device PDF reader built using Vanadium on both the web and Android platforms. The web version requires use of the Vanadium Chrome extension.

All apps exchange information using Syncbase. Details of the various projects can be found in their respective directories.