myrjola / neartobeer

Find cheap beers near you
0 stars 0 forks source link

Populate the map with the listings #1

Closed myrjola closed 7 years ago

myrjola commented 7 years ago

You can fetch the listings by HTTP GETing http://beersunderthirty.org/places/places.json. The output looks something like this:

[
  {
    "post_id": 38,
    "post_title": "MacLarens",
    "post_author": 1,
    "post_content": "Serves chilled Norrlands Guld on tap for only 29:-. One of the most best places in town for cheap beer lovers.",
    "post_category": "Beer under 30",
    "default_category": "Beer under 30",
    "post_tags": "",
    "post_type": "gd_place",
    "post_status": "publish",
    "is_featured": "",
    "geodir_video": "",
    "post_address": "Norrtullsgatan 11",
    "post_city": "Stockholm",
    "post_region": "Stockholm County",
    "post_country": "Sweden",
    "post_zip": "113 29",
    "post_latitude": 59.3419634,
    "post_longitude": 18.051719899999966,
    "geodir_timing": "",
    "geodir_contact": "",
    "geodir_email": "",
    "geodir_website": "",
    "geodir_twitter": "",
    "geodir_facebook": "",
    "geodir_special_offers": "",
    "IMAGE": ""
  },
  {
    "post_id": 39,
    "post_title": "Lion Bar Sveavägen 39",
    "post_author": 1,
    "post_content": "The famous Lion Bar chain is a perfect find for bargain brew lovers! 7 Places all around Stockholm serve chilled Spendrups (40cl, tapped) for 23:- until 20h. After this the prices will increase in two steps: until midnight the price will be 36:-, thereafter 40:-. Go and get there early to get yourself a crispy brew for under 30:- !",
    "post_category": "Beer under 30",
    "default_category": "Beer under 30",
    "post_tags": "",
    "post_type": "gd_place",
    "post_status": "publish",
    "is_featured": "",
    "geodir_video": "",
    "post_address": "Sveavägen 39 Stockholm",
    "post_city": "Stockholm",
    "post_region": "Stockholm County",
    "post_country": "Sweden",
    "post_zip": "",
    "post_latitude": 59.3404626,
    "post_longitude": 18.05888660000005,
    "geodir_timing": "",
    "geodir_contact": "",
    "geodir_email": "",
    "geodir_website": "",
    "geodir_twitter": "",
    "geodir_facebook": "",
    "geodir_special_offers": "",
    "IMAGE": ""
  }
]

I think this is a good place to start on rendering markers to the map: https://github.com/airbnb/react-native-maps#rendering-a-list-of-markers-on-a-map.

myrjola commented 7 years ago

Working on this now for half an hour.

myrjola commented 7 years ago

I got the marker showing.

myrjola commented 7 years ago

Next step is to fetch the JSON data and render the markers with it. Maybe this guide would be of some help http://mediatemple.net/blog/tips/loading-and-using-external-data-in-react/. But it seems that the big boys don't want you to fetch the data in the presentation components http://disq.us/p/16z1pk2.

I also think that we should create our marker as a React Component to make the code cleaner.

myrjola commented 7 years ago

The next step is to perform the HTTP GET from beersunderthirty.org. I think I'm going to do it according to Redux's async guide http://redux.js.org/docs/advanced/AsyncActions.html