• Robert Knight's avatar
    Replace Angular router · 95de09d6
    Robert Knight authored
    Implement a replacement for the Angular JS router which will enable the
    root components of the app to be more easily migrated to Preact in future.
    Since the app only has three routes with very simple parameters, we
    don't yet need a fully-fledged router implementation but can get by with
    some pretty basic URL parsing.
    
     - Introduce a store module which holds the currently active route
       (`null`, "sidebar", "annotation" or "stream") and any parameters of
       that route.
    
       This state replaces the `isSidebar` boolean in the `viewer` module,
       since whether the app is the sidebar can be determined by checking
       the active route name.
    
     - Add a `router` service which handles synchronizing the store route
       with the current URL (via the `sync` method or in response to a
       `popstate` DOM event) or updating the URL and active route in the
       store (via the `navigate` method).
    
     - Modify the `<hypothesis-app>` component to fetch the active route
       from the store and use it to conditionally render the appropriate
       content component. This replaces the Angular router configuration
       that used to be in `src/sidebar/index.js`
    
     - Change the places that used to read or update the current route to
       read the active route and route params from the store (`store.{route,
       routeParams}`) and switch the current route by using the `router` service
       (`router.navigate`)
    
     - Remove the unused angular-route package
    
    Fixes #1878
    95de09d6
Name
Last commit
Last update
.github Loading commit data...
bin Loading commit data...
docs Loading commit data...
embedding-examples Loading commit data...
images Loading commit data...
scripts Loading commit data...
src Loading commit data...
.babelrc Loading commit data...
.dockerignore Loading commit data...
.eslintignore Loading commit data...
.eslintrc Loading commit data...
.gitignore Loading commit data...
.npmignore Loading commit data...
.npmrc Loading commit data...
.prettierignore Loading commit data...
.prettierrc Loading commit data...
.python-version Loading commit data...
.travis.yml Loading commit data...
CODE_OF_CONDUCT Loading commit data...
Dockerfile Loading commit data...
Jenkinsfile Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
gulpfile.js Loading commit data...
package.json Loading commit data...
requirements-dev.in Loading commit data...
tox.ini Loading commit data...
yarn.lock Loading commit data...