File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11< section class ="p-strip is-shallow u-no-padding--bottom ">
22 < div class ="u-fixed-width ">
3- < h2 > Most popular snaps </ h2 >
3+ < h2 > {{ title }} </ h2 >
44 </ div >
55</ section >
66< section class ="p-strip is-shallow u-no-padding--bottom ">
77 < div class ="row ">
8- {% for snap in popular_snaps %}
8+ {% for snap in snaps_list %}
99 {% if loop.index < = 8 %}
1010 < div class ="col-3 ">
1111 < p class ="p-heading--4 " style ="float: left; margin-right: 1rem "> {{ loop.index }}</ p >
Original file line number Diff line number Diff line change @@ -27,13 +27,25 @@ <h1 class="p-heading--2">The app store for Linux</h1>
2727 {% endif %}
2828
2929 {% if popular_snaps %}
30- {% include "explore/_popular-snaps.html" %}
30+ {% with %}
31+ {% set snaps_list = popular_snaps %}
32+ {% set title = "Most popular snaps" %}
33+ {% include "explore/_snaps-list.html" %}
34+ {% endwith %}
3135 {% endif %}
3236
3337 {% if categories %}
3438 {% include "explore/_categories.html" %}
3539 {% endif %}
3640
41+ {% if top_rated_snaps %}
42+ {% with %}
43+ {% set snaps_list = top_rated_snaps %}
44+ {% set title = "Top rated snaps" %}
45+ {% include "explore/_snaps-list.html" %}
46+ {% endwith %}
47+ {% endif %}
48+
3749 {% if trending_snaps %}
3850 {% include "explore/_trending-snaps.html" %}
3951 {% endif %}
Original file line number Diff line number Diff line change @@ -150,6 +150,13 @@ def explore_view():
150150 except api_requests .exceptions .RequestException :
151151 trending_snaps = []
152152
153+ try :
154+ top_rated_snaps = api_requests .get (
155+ f"{ recommendations_api_url } /top_rated"
156+ ).json ()
157+ except api_requests .exceptions .RequestException :
158+ top_rated_snaps = []
159+
153160 try :
154161 categories_results = device_gateway .get_categories ()
155162 except StoreApiError :
@@ -166,6 +173,7 @@ def explore_view():
166173 popular_snaps = popular_snaps ,
167174 recent_snaps = recent_snaps ,
168175 trending_snaps = trending_snaps ,
176+ top_rated_snaps = top_rated_snaps ,
169177 )
170178
171179 @store .route ("/youtube" , methods = ["POST" ])
You can’t perform that action at this time.
0 commit comments