-
-
Notifications
You must be signed in to change notification settings - Fork 8
Price Filters #7
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
66797c7
f3d5c70
d821066
9a480d4
2718ce3
b7af198
ec27318
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| TURNSTILE_PUBLIC=1x00000000000000000000AA | ||
| DEV_API_TARGET=http://localhost:8000 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,14 +99,17 @@ export default defineNuxtConfig({ | |
| name: 'Blueprint', | ||
| }, | ||
| nitro: { | ||
| // Allow switching dev API target via DEV_API_TARGET (https://blueprint.zip) | ||
| // Falls back to local backend when unset. | ||
| devProxy: { | ||
| '/api': { | ||
| // Change to https://blueprint.zip/api to use the production API | ||
| // Local API is http://localhost:8000/api | ||
| target: 'http://localhost:8000/api', | ||
| target: process.env.DEV_API_TARGET?.replace(/\/$/, '') || 'http://localhost:8000', | ||
| changeOrigin: true, | ||
|
Comment on lines
+106
to
+107
|
||
| }, | ||
| '/browse/sitemap.xml': { | ||
| target: process.env.DEV_API_TARGET?.replace(/\/$/, '') || 'http://localhost:8000', | ||
| changeOrigin: true, | ||
| }, | ||
| '/browse/sitemap.xml': 'http://localhost:8000/browse/sitemap.xml', | ||
| '/yay': 'https://blueprint.zip/yay', | ||
| }, | ||
| routeRules: { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,8 +151,20 @@ const form = ref({ | |
| sortBy: 'popularity', | ||
| showExtensions: true, | ||
| showThemes: true, | ||
|
darkzmaj marked this conversation as resolved.
|
||
| maxPrice: 0, | ||
| }) | ||
|
|
||
| const getMinPrice = (extension: Extension): number => { | ||
| const prices = Object.values(extension.platforms) | ||
| .map(p => p.price) | ||
| .filter(p => p >= 0) | ||
| return prices.length > 0 ? Math.min(...prices) : 0 | ||
| } | ||
|
|
||
| const isFree = (extension: Extension): boolean => { | ||
| return getMinPrice(extension) === 0 | ||
| } | ||
|
Comment on lines
+166
to
+168
|
||
|
|
||
| const filteredAndSortedExtensions = computed(() => { | ||
| if (!extensions.value) return [] | ||
|
|
||
|
|
@@ -178,6 +190,15 @@ const filteredAndSortedExtensions = computed(() => { | |
| return true | ||
| }) | ||
|
|
||
| filtered = filtered.filter((extension) => { | ||
| const minPrice = getMinPrice(extension) | ||
| if (form.value.maxPrice === 0) { | ||
| return minPrice === 0 | ||
| } | ||
| // any non-zero becomes paid-only | ||
| return minPrice > 0 | ||
|
darkzmaj marked this conversation as resolved.
Outdated
|
||
| }) | ||
|
|
||
| switch (form.value.sortBy) { | ||
| case 'popularity': | ||
| filtered.sort((a, b) => b.stats.panels - a.stats.panels) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.