I am doing a test project to learn about Bubble’s capabilities, and I can’t figure out something.
The test project is a Yelp clone. So basically, I have a parent “Restaurant” object with child “Review” objects that are written by “User” objects.
I want this Yelp clone to be map-focused, and I want the map markers for Restaurants to be a circle if no User is logged in, e.g., public view. However if there IS a User logged in, I want the map marker to be a star for every Restaurant where the logged in User has written at least 1 Review.
It seems that Bubble’s native Maps will not be able to populate different marker colors (please correct me if wrong), so I’m going to use the Mapbox plugin, which also has a workflow where a list of Restaurants can be populated with custom icons. After consulting with Mapbox, it appears that to use their workflow to assign different icons for Restaurants, I need to update a field on the Restaurant object itself.
But this seems illogical… to have a field on Restaurant, but then have that field be simultaneously one value (e.g., LoggedInUserHasWrittenReview = true) when a User is logged in versus not.
How else would you handle this?
ALSO, it’s important to mention that I’m totally open to completely new ways of resolving this, as this is just a learning test for me.
Thinking about the list variations you’re looking for:
User A should see a star for a restaurant if they’ve written a review for that restaurant
User A should see a circle if they haven’t written a review for that restaurant but User B has written the only review for that restaurant and User B is logged out
What should User A see if they haven’t written a review for that restaurant but User B has written the only review for that restaurant and User B is logged in?
What should User A see if they haven’t written a review for that restaurant but multiple other Users have written a review, with some being logged in and some not being logged in?
I haven’t used the Mapbox plug-in, but my guess is that you would use the Add a List of Markers action at least two times on a workflow triggered by page load. Probably the first would be to add a list of Markers for restaurants that User A has not reviewed, with some having icon 1 if at least 1 review user is logged in and a circle icon if no users are logged in. You could potentially signal if any user is logged in that wrote a review for a restaurant by scheduling an API workflow after a user logs in to change a restaurant’s status field “has logged in reviewers” = yes on any restaurants where that user has written a review (changing only the restaurants that have a status of “has logged in reviewers” = no). Then another backend workflow triggered on users logging out to change the status of a list of restaurant objects they’ve reviewed if they’re the last logged on user for of the restaurants reviewers. The next action in a page load + logged in triggered workflow should probably be to remove a list of circle/other icon markers from any restaurants the user has reviewed, then do a Add a list of Markers workflow to add the list of restaurants the user reviewed with star icons.