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

Feature/minimal mode #356

Merged
merged 20 commits into from
Jan 29, 2020
Merged

Conversation

crisner
Copy link
Contributor

@crisner crisner commented Jan 21, 2020

Fixes #123 (<=== Add issue number here)

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • PR is descriptively titled 📑 and links the original issue above 🔗
  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
  • code is in uniquely-named feature branch and has no merge conflicts 📁
  • screenshots/GIFs are attached 📎 in case of UI updation
  • ask @publiclab/reviewers for help, in a comment below

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

Thanks!

@crisner crisner changed the title Feature/minimal mode [WIP] Feature/minimal mode Jan 21, 2020
@crisner
Copy link
Contributor Author

crisner commented Jan 21, 2020

Things done:

  • created a toggle button
  • Added toggle function
  • Added circle marker and styles to eonet fires layer
  • Added condition to render markers according to selected mode

Things to do:

  • Add circle marker and conditions to remaining layers
  • Add minimal mode control to one-liner code

Default mode:

127 0 0 1_5500_example_index html (11)

Minimal mode:

127 0 0 1_5500_example_index html (12)

The bottom-most button on the left side of the map is the button to toggle modes. The icon changes depending on the mode.

@crisner
Copy link
Contributor Author

crisner commented Jan 21, 2020

The toggle button is a simple leaflet styled button for now. What I had in my project proposal was this:
1

This seemed a bit out of place so I opted for the simpler button. I could maybe make the button attached here to look more like leaflet styles if a switch type toggle button is preferred.

Copy link
Collaborator

@sagarpreet-chadha sagarpreet-chadha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks fine :)
Can you try to do this for a layer with many markers and then tell me if it is working smoothly? Thanks!

@@ -264,6 +264,9 @@ var embedControl = new L.control.embed({
});
embedControl.addTo(map);

var modeControl = new L.control.minimalMode(leafletControl);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So many features :P
We need to make readme.md readble!!!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I will be doing that this weel. :)

@crisner
Copy link
Contributor Author

crisner commented Jan 22, 2020

Minimal mode markers from aqicn and opensense layers:

127 0 0 1_5500_example_index html (15)

In default mode the screen starts to lag when both these layers are turned on. The experience seems to be smooth in minimal mode.

@crisner
Copy link
Contributor Author

crisner commented Jan 22, 2020

Also, the markers in aqicn layer are colour-coded and I carried the same over to minimal mode. So, when this layer is turned on with other layers it may be difficult to identify which layer the markers belong to. Should I change the markers to have a single colour?

@crisner
Copy link
Contributor Author

crisner commented Jan 22, 2020

To do:

  • add minimal mode to remaining layers
  • update readme

@nstjean
Copy link
Contributor

nstjean commented Jan 22, 2020

The implementation looks good! Not sure about the button. I'm not sure people will have any idea what it does, though maybe the tooltip will be enough.

It looks like button shows the minimal dot when it's in minimal mode, and shows a map marker when the map markers are showing. Should that be opposite? So when you're in minimal mode it shows the full map marker on the button so you know to click it to show the full marker?

@crisner
Copy link
Contributor Author

crisner commented Jan 22, 2020

You are right! It should be the opposite!

More things to do:

  • Correct the icon displayed on toggle button
  • Add tooltip

I just got an idea. What if I add the toggle button like the zoom in and out buttons? One could be disabled while the other mode is active.

@nstjean
Copy link
Contributor

nstjean commented Jan 22, 2020

I think that would be nice and visual to see what is on/off!

Copy link
Collaborator

@sagarpreet-chadha sagarpreet-chadha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow...happy to see we are not lagging with so many markers!!!
Leaflet circles are awesome!!!

@crisner
Copy link
Contributor Author

crisner commented Jan 23, 2020

Active layers: aqicn, openaq and opensense

Default mode;

127 0 0 1_5500_example_index html (17)

Minimal mode;

127 0 0 1_5500_example_index html (16)

@crisner
Copy link
Contributor Author

crisner commented Jan 23, 2020

To do:

  • write tests

@crisner crisner changed the title [WIP] Feature/minimal mode Feature/minimal mode Jan 24, 2020
@crisner
Copy link
Contributor Author

crisner commented Jan 24, 2020

Updated npm version by running npm version minor.

Copy link
Contributor

@nstjean nstjean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! I'm glad you added it to the one-liner code as well. I like the way you did the control to switch between the two modes.

FireShot Capture 231 - Leaflet Environmental Layers -

this._map._minimalMode = this.options.minimalMode;
this._modeBtnContainer = L.DomUtil.create('div', 'leaflet-control-mode leaflet-bar leaflet-control');
this._defaultMode = this._createButton('Default mode', 'fas fa-map-marker-alt', this.loadDefaultMode);
this._minimalMode = this._createButton('Minimal mode', 'far fa-dot-circle', this.loadMinimalMode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be something more descriptive, like "Default markers" and "Dot markers"? Or "Minimal markers"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean in L17 and L18? If so for clarity I could change it to defaultModeBtn? I think it will be misleading to add 'markers' to the button's name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I mean for the text that is in the pop-up, so it is descriptive to users. Changing the name to defaultModeBtn would be good!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that one! That's a great idea!

@jywarren
Copy link
Member

Wow, really impressive!

image

Ready for a merge?

@jywarren
Copy link
Member

These screenshots above would be great for a blog post!!! 😄

Copy link
Member

@jywarren jywarren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. big changes! So glad to see these tests in here!!!

@jywarren
Copy link
Member

Ah, so, just needs a recompile. This is ready for merge otherwise? 🙌

@crisner
Copy link
Contributor Author

crisner commented Jan 28, 2020

Yes. Ready for a merge. :)

@jywarren
Copy link
Member

Ah, sorry, i meant that it looks like the /dist/ files need to be recompiled, could you do that and then we'll merge? Thanks!

@crisner
Copy link
Contributor Author

crisner commented Jan 29, 2020

  • Merged and fixed conflicts
  • Updated build
  • Also added a demo page with multiple maps each having different options in the one-liner usage

127 0 0 1_5500_example_multipleMaps html (1)

@jywarren, this is now merge-ready. 😃

@jywarren jywarren merged commit c69ad9a into publiclab:master Jan 29, 2020
@jywarren
Copy link
Member

So awesome! Fantastic work, @crisner !!

sagarpreet-chadha added a commit that referenced this pull request Mar 25, 2020
* Remove use of hardcoded extents for displaying layers (#332)

* Fix embed code with duplicated text (#340)

* Fix duplication of text in embed code

* Update build file

* Update README.md (#335)

* Update README.md

* Update README.md

* Add check that layers group is not undefined when creating layers-sub-list (#339)

Fixes #333

* Display new items mark in layers menu (#341)

* Create function to check for available layers

* Display badge to show new items

* Save map instance in a variable

* Update readme

* Add contribute button to open infra map

* Add media queries for size 235x300 (#346)

* Add default basemap when undefined (#351)

* Add default basemap when undefined

* Update version number indicating bug-fix

* [WIP] Add layers in include to map by default (#352)

* Add unearthing layer to demo

* Fix bug with removing points from the map on removeLayer

* Add all layers in include param upon map initialization

* bump to v2.1.9

* Implement new menu

* Add new menu dependancies

* Fix styles from overriding default leaflet classes

* Refactor code

* Fix styles for layer group name and layer description

* Add option to disable layer visibility when param.include is true

* Add option to use default layer control

* Fix errors when trying to display layer when out of bounds

* Add missing viewport meta tag

* Move styles to LeafletEnvironmentalLayers.css

* Update documentation

* Add missing dependencies and update build

* Fix error from unearthing layer on page reload

* Set addLayersToMap options from param

* Update documentation

* Update AllLayers.js (#366)

Fixed: Prevent use of the same default tile layer for multiple maps

* Add PLpeopleLayer (#361)

* add PLpeopleLayer to maps

* fix function name to PLpeopleLayer

* fix capital in function name

* make naming consistent for both map examples

* change layer name to PLpeople

* version 2.2.0 and bump LBL to 1.7.0 (#368)

* Feature/minimal mode (#356)

* Create toggle mode control

* Add marker for minimal mode

* Change markers on mode change

* Add condition and marker styles for eonet fires layer

* Add minimal mode content to layers in layercode

* Add minimal mode content to aqicn layer

* Add minimal mode option

* Refactor minimalMode control

* Add mode control to one liner code

* Add documentation to readme

* Fix duplication of layers control, set simple layer control for demo

* Add basic tests

* Update build

* 2.2.0

* Change button names and title

* Update tests for mode control

* Update build

* Add demo with multiple maps in a single page

* Add a check for jQuery and update build

* Bug/fix missing layers in layer menu on refresh (#375)

* Fix 'moveend' event check to affect only when removing layers from map

* Add a check when adding minimal markers to confirm this._map exists

* Update build

* fix conflict

* add parameter display to turn on layers

* check if layer exists before turning it on

* Remove conditions and code responsible for jquery duplication

* Update link to jquery 3.3.1 and remove references to older versions

* Move info.json outside iife and update build

* Install cypress

* published

* Bug/fix layers not removed from map when hash false (#380)

* Add error handling on removing unearthing from map

* Remove redundant code

* Comment out unused baselayer instantiation and update build

* Uncomment baselayers

* Reformat init defaults (#396)

* rewrite init defaults

* remove console.log

* use L.Util.setOptions to set defaults

* Add Cypress

* Add tests to check leaflet left controls

* Add tests for embed prompt and layers menu

* Add child window to prevent iframe conflict on hash change

* Add test to check hash update on map movement

* Move hash test to a seperate file and increase delay

* Set up http server for localhost

* Ignore cypress screenshot and video folders

* Set up cypress in travis

* Oneliner/basic implementation tests (#397)

* testing all the specs

* using babel

* add layer name id to broswer menu

* leaflet not fully loading

* recent tests

* testing error in multiple maps

* rewrite init defaults

* basic one liner tests work

* test shorter transpile files

* emove jquery from gruntfile browserify dist

* use L.Util.setOptions to set defaults

* turn on basic tests again

* disable babel-plugin-transform-object-rest-spread

* clean up

* rebase

* add wisconsin layer back in and fix error

* remove text-table files

* add css file back in

* fix merge errors

* Edit and update documentation for more clarity (#367)

* Add dependencies to documentation

* Add updated documentation to readme

* Add more information

* Edit usage example for layer menu

* Added links to more information

* Update minimal mode documentation

* Add files via upload

* added a layerData folder containing the json file for sea level rise data

Co-authored-by: Renisha Christie. A <29401459+crisner@users.noreply.github.com>
Co-authored-by: Suyash Choudhary <57896905+sssash18@users.noreply.github.com>
Co-authored-by: llabake <lemboyelabake@gmail.com>
Co-authored-by: crisner <christie.reni@gmail.com>
Co-authored-by: Sagarpreet Chadha <chadha.sagarpreet97@gmail.com>
Co-authored-by: jywarren <jeff@unterbahn.com>
Co-authored-by: z-arnott <50159450+z-arnott@users.noreply.github.com>
Co-authored-by: Natalie St Jean <49460529+nstjean@users.noreply.github.com>
Co-authored-by: Natalie <natalie.stjean@gmail.com>
Co-authored-by: Cess <cessmbuguar@gmail.com>
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

Successfully merging this pull request may close these issues.

"minimal" mode
4 participants