Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use country coder package to switch preset section #56

Open
tordans opened this issue Oct 7, 2021 · 2 comments
Open

Use country coder package to switch preset section #56

tordans opened this issue Oct 7, 2021 · 2 comments

Comments

@tordans
Copy link
Collaborator

tordans commented Oct 7, 2021

I suggest adding a PR that uses https://github.com/ideditor/country-coder to change the preset section based on the lat/lng.

The way I expect this to work is

  • given a lat/lng, the package will return and " ISO 3166-1 alpha-2 code" like (DE)
  • if a preset is "registered" in the app for this code, it is shown
  • if no preset is found, the section that shows the presets does show a gray message similar to "no preset for found, learn more at https://github.com/zlant/parking-lanes/README.md#presets"
    • another PR could extend this by providing a dropdown to force-choose a preset (ideally that would be persisted as an URL parameter as well, so it's shareable)

For the files, it might be enough to have multiple files of https://github.com/zlant/parking-lanes/blob/master/src/parking/controls/editor/presets.ts and only import the right one(?) – or we keep them in one file like @jakecoppinger did in https://github.com/jakecoppinger/open-parking-map/blob/master/src/parking/controls/editor/presets.ts. However, I feel like adding some hierarchy (instead of a country-"category") will make it easier to maintain.

@zlant @jakecoppinger let me know what you think. Is this a good way to go? Would PR be welcome? Help is welcome :).


Outlook: Another think that could use this country coder feature is, having custom map layers per country. I find using the best areal images available in a region very helpful.

@jakecoppinger
Copy link
Contributor

Sounds great! If you PRed into parking-lanes I'd merge into https://github.com/jakecoppinger/open-parking-map and overwrite my country picker. As usual I'm keen to merge any improvements I make here too.

Another concern is some bugs I've noticed around the textfields of the values on the right hand side - if you swap to a preset which doesn't have an empty value string for a given key, then the textbox isn't cleared.

For example, if you have a no parking preset which doesn't specify time intervals, unless you have a key value pair with the value being an empty string, the textbox isn't cleared.

if no preset is found, the section that shows the presets does show a gray message similar to "no preset for found, learn more at https://github.com/zlant/parking-lanes/README.md#presets"

I love this idea, especially if it encouraged contributions.

(ideally that would be persisted as an URL parameter as well, so it's shareable)

I don't understand why this would be preferable - what if you sent a link to somebody in a different country?

@zlant
Copy link
Owner

zlant commented Oct 11, 2021

Great idea! I like.

multiple files or we keep them in one file like

I think one file will be enough.

if no preset is found, the section that shows the presets does show a gray message similar to "no preset for found, learn more at

I think need show default presets: no parking, no stopping, free and paid parking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants