conor-f/via-web

Support GET Variables to Render Different Sections

Closed this issue · 2 comments

Some examples to get started:

  • /?hide_sidebar_nav=true
    • Hide sidebar when true
    • Default false
  • /?show_tables=true
    • Show the tables at the bottom of the page when true
    • Default false
    • Toggles from sidebar selectors

See #7 for detailed breakdown.

  mounted() {
    const urlParams = new URLSearchParams(window.location.search);
    this.name = urlParams.get("name");
  },

This snippet should be sufficient as opposed to using Router

This snippet works in small cases, but to extend the functionality this is garbage. A full set of GET params will include (at least)

{
    showSidebar: <true | false, default true (but dependent on screen size)>,
    showDetailsTable: <true | false, default false>,
    lat: <float representing the centre latitude for the map, default Dublin>,
    lng: <float representing the centre longitude for the map, default Dublin>,
    zoom: <int representing the zoom level, default something sane>,
    earliestTime: <string of format YYYY-MM>,
    latestTime: <string of format YYYY-MM>,
    ... (any other input boxes)
}

This will definitely need a router.