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

feat: adding ember leaflet #5429

Merged
merged 11 commits into from
Nov 7, 2020
Merged

feat: adding ember leaflet #5429

merged 11 commits into from
Nov 7, 2020

Conversation

maze-runnar
Copy link
Contributor

@maze-runnar maze-runnar commented Oct 30, 2020

Fixes #591

  • one thing is still remaining . The map is not getting correct lat and lng values. @iamareebjamal

Screenshot from 2020-10-30 18-33-15

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Oct 30, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/eventyay/open-event-frontend/j7futdjkm
✅ Preview: https://open-event-frontend-git-leaflet-map.eventyay.vercel.app

@codecov
Copy link

codecov bot commented Oct 30, 2020

Codecov Report

Merging #5429 (b6864fc) into development (190a3d6) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #5429      +/-   ##
===============================================
- Coverage        23.25%   23.24%   -0.01%     
===============================================
  Files              493      494       +1     
  Lines             5182     5162      -20     
  Branches            38       38              
===============================================
- Hits              1205     1200       -5     
+ Misses            3972     3957      -15     
  Partials             5        5              
Impacted Files Coverage Δ
app/components/public/event-map.js 0.00% <0.00%> (ø)
app/components/nav-bar.js 0.00% <0.00%> (-33.34%) ⬇️
app/components/tabbed-navigation.js 33.33% <0.00%> (-20.00%) ⬇️
app/routes/account/danger-zone.js 0.00% <0.00%> (ø)
app/services/loader.js 40.00% <0.00%> (+0.43%) ⬆️
app/components/public/add-to-calender.ts 9.09% <0.00%> (+4.54%) ⬆️
app/components/forms/orders/guest-order-form.js 20.00% <0.00%> (+5.71%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 79e0cbd...71ad234. Read the comment docs.

@iamareebjamal
Copy link
Member

Really cool. I'll check what's the issue once I'm free

@iamareebjamal
Copy link
Member

The map is not getting correct lat and lng values.

I don't understand. Do you mean it is showing wrong location for a latitude and longitude? Then try switching lat and lng

{{/g-map-address-marker}}
</GMap>
{{/if}}
<LeafletMap @lat={{this.lat}} @lng={{this.lng}} @zoom={{this.zoom}} as |layers|>
Copy link
Member

Choose a reason for hiding this comment

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

This should be shown only if event has lat lng. Otherwise, fallback to previous method

</GMap>
{{/if}}
<LeafletMap @lat={{this.lat}} @lng={{this.lng}} @zoom={{this.zoom}} as |layers|>
<layers.tile @url="https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png"/>
Copy link
Member

Choose a reason for hiding this comment

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

Please use a free to use basemap, this is only free for non-commercial projects

Our basemaps can be used for free in applications and visualizations for non-commercial use. For commercial purposes, you will need an Enterprise license to ensure you have the best basemaps available.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

{{#if (eq this.mapConfig.display 'embed') }}
<iframe title="Map" class="g-map" src="https://maps.google.com/maps?q={{this.event.locationName}}&t=&z=15&ie=UTF8&iwloc=&output=embed" frameborder="0" scrolling="no"></iframe>
{{else}}
<GMap @markersFitMode="live" @lat={{37.744}} @lng={{-122.4367}} @address={{this.event.locationName}} @zoom={{2}} @class="google-maps" as |context|>
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove this cause our goal is to remove ember-g-map

@@ -11,7 +11,7 @@ export default class EventMap extends Component {

@tracked
lng = this.event.longitude;

@tracked
zoom = 4;
Copy link
Member

Choose a reason for hiding this comment

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

Since this is read only?, it should not have tracked decorator

@@ -11,7 +11,7 @@ export default class EventMap extends Component {

@tracked
lng = this.event.longitude;
Copy link
Member

Choose a reason for hiding this comment

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

Read only properties don't need tracked

package.json Outdated
@@ -165,6 +166,7 @@
},
"private": true,
"dependencies": {
"ember-leaflet": "^4.1.1",
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be in devDependencies?

@iamareebjamal
Copy link
Member

@maze-runnar What's missing here?

@iamareebjamal
Copy link
Member

one thing is still remaining . The map is not getting correct lat and lng values.

I still don't understand

@maze-runnar
Copy link
Contributor Author

one thing is still remaining . The map is not getting correct lat and lng values.

I still don't understand

i mean lat and lng values are not coming from backend. Map is showing correctly them on putting any lat and lng manually.

@iamareebjamal
Copy link
Member

Try on this https://eventyay.com/e/45da88b7
And fix the build

@maze-runnar
Copy link
Contributor Author

Try on this https://eventyay.com/e/45da88b7

showing correctly -
scrnli_11_6_2020_9-30-43 PM
But it's with free ember-leaflet base map, other base-maps from https://wiki.openstreetmap.org/wiki/Tiles#Servers are showing blank screen -
scrnli_11_6_2020_9-47-31 PM

@iamareebjamal
Copy link
Member

Zoom level is very bad, that's why

@iamareebjamal
Copy link
Member

But it's with free ember-leaflet base map

But it's with free paid ember-leaflet base map.

Fixed that for you. It's paid, not free

@iamareebjamal
Copy link
Member

iamareebjamal commented Nov 7, 2020

There were several things wrong and missing:

  1. Tile server was wrong, it was supposed to be https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png. But I see the link I mentioned had a, b, c links. That's substitute for {s}
  2. Zoom level was 4 which is country level zoom. We want 15
  3. The way you wrote lat lng in component was wrong and crashing the test
  4. You wrote @tracked on a computed property. @tracked is used for tracking writes and update the dependent computed properties, it does nothing on read only computed properties
  5. You wrote @tracked in a classic component. It imports from glimmer package, thus only works on glimmer components
  6. Most importantly, you missed the production step in Installtion guide https://miguelcobain.github.io/ember-leaflet/docs/installation. It would not have worked in production without it

@iamareebjamal
Copy link
Member

iamareebjamal commented Nov 7, 2020

You also did not follow ember install ember-leaflet which would install latest leaflet. The current installed version is 0.7 and latest version is 1.6.0

It also would have automatically installed leaflet in devDependencies

@iamareebjamal iamareebjamal merged commit bac8331 into fossasia:development Nov 7, 2020
@maze-runnar maze-runnar deleted the leaflet-map branch December 13, 2020 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for OpenStreetMap and Mapbox
2 participants