allen-cell-animated / website-3d-cell-viewer

Other
5 stars 5 forks source link

fix: Remove hash routing on GitHub pages #226

Closed ShrimpCryptid closed 4 months ago

ShrimpCryptid commented 4 months ago

Closes #213, removing hash routing on GitHub pages. This means we don't need to include the # character for subpaths anymore, so our S3 and GitHub Pages will use consistent link formats.

Before: https://allen-cell-animated.github.io/website-3d-cell-viewer/#/viewer After: https://allen-cell-animated.github.io/website-3d-cell-viewer/viewer

Estimated size: medium, 20-25 minutes

Changes

This uses a custom 404 HTML page catch missing pages and reroute the browser to the viewer's base index.html page. The base page checks for the redirect and, if found, redirects internally to the correct page.

See https://github.com/rafgraph/spa-github-pages for the original solution.

Testing:

(this link will break after today so ping me if you want to see it again)

ShrimpCryptid commented 4 months ago

The functions that do the url manipulation look complicated and unreadable enough to merit unit tests but that could be for a future ticket.

yeah... I could move this into index.tsx and the functions into their own typescript files.

ShrimpCryptid commented 4 months ago

Taking this back to draft while I do some reworking!

ShrimpCryptid commented 4 months ago

@toloudis re-requesting your review because I've made some substantial changes. The reroute code now lives in a typescript file with unit tests, and I added more styling to the 404 page (as well as some webpack config changes).