mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add benchmark and performance links to search
This commit is contained in:
parent
f1a772b905
commit
f62f33d98c
4 changed files with 138 additions and 33 deletions
|
|
@ -3,6 +3,9 @@ import gameList from '~/static/game-list.json'
|
||||||
import homebrewList from '~/static/homebrew-list.json'
|
import homebrewList from '~/static/homebrew-list.json'
|
||||||
|
|
||||||
import { byTimeThenNull } from '~/helpers/sort-list.js'
|
import { byTimeThenNull } from '~/helpers/sort-list.js'
|
||||||
|
import { videosRelatedToApp } from '~/helpers/related.js'
|
||||||
|
import { getAppEndpoint } from '~/helpers/app-derived.js'
|
||||||
|
|
||||||
|
|
||||||
export const allVideoAppsList = [
|
export const allVideoAppsList = [
|
||||||
...appList.sort(byTimeThenNull),
|
...appList.sort(byTimeThenNull),
|
||||||
|
|
@ -16,3 +19,54 @@ export const allList = [
|
||||||
...homebrewList,
|
...homebrewList,
|
||||||
...gameList,
|
...gameList,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
export function makeAppSearchLinks (app) {
|
||||||
|
|
||||||
|
const videos = videosRelatedToApp(app)
|
||||||
|
|
||||||
|
// If there are no videos
|
||||||
|
// then skip
|
||||||
|
if (videos.length === 0) return []
|
||||||
|
|
||||||
|
const searchLinks = []
|
||||||
|
|
||||||
|
const appBenchmarksUrl = `${getAppEndpoint(app)}/benchmarks`
|
||||||
|
|
||||||
|
let hasPerformanceVideo = false
|
||||||
|
|
||||||
|
for (const video of videos) {
|
||||||
|
// If there are no video tags
|
||||||
|
// then skip
|
||||||
|
if (video.tags.length === 0) continue
|
||||||
|
|
||||||
|
// If there's any benchmark video then add
|
||||||
|
if (video.tags.includes('benchmark')) {
|
||||||
|
// Add a benchmark link
|
||||||
|
searchLinks.push({
|
||||||
|
href: appBenchmarksUrl,
|
||||||
|
label: 'Benchmarks'
|
||||||
|
})
|
||||||
|
|
||||||
|
// then stop looking
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if (video.tags.includes('performance')) {
|
||||||
|
hasPerformanceVideo = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there was no bechmark video found
|
||||||
|
// but there was a performance video found
|
||||||
|
// then push Performance link
|
||||||
|
if (searchLinks.length === 0 && hasPerformanceVideo) {
|
||||||
|
// Add a performance link
|
||||||
|
searchLinks.push({
|
||||||
|
href: appBenchmarksUrl,
|
||||||
|
label: 'Performance'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return searchLinks
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,29 @@ import ThomasCredit from '~/components/thomas-credit.vue'
|
||||||
import gameList from '~/static/game-list.json'
|
import gameList from '~/static/game-list.json'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
async asyncData () {
|
||||||
|
const { sortedAppList, allList, allVideoAppsList, makeAppSearchLinks } = await import('~/helpers/get-list.js')
|
||||||
|
const { default: gameList } = await import('~/static/game-list.json')
|
||||||
|
|
||||||
|
return {
|
||||||
|
// Map game list
|
||||||
|
gameList: gameList.map( app => {
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: app.name,
|
||||||
|
status: app.status,
|
||||||
|
slug: app.slug,
|
||||||
|
// endpoint: app.endpoint,
|
||||||
|
text: app.text,
|
||||||
|
lastUpdated: app.lastUpdated,
|
||||||
|
category: app.category,
|
||||||
|
searchLinks: makeAppSearchLinks(app)
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
// allAppSearchLinks,
|
||||||
|
// customSummaryNumbers: getListSummaryNumbers(allList)
|
||||||
|
}
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
Search,
|
Search,
|
||||||
LinkButton,
|
LinkButton,
|
||||||
|
|
@ -59,9 +82,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
gameList() {
|
// gameList() {
|
||||||
return gameList
|
// return gameList
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
head() {
|
head() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -71,13 +71,33 @@ export default {
|
||||||
// const { default: appList } = await import('~/static/app-list.json')
|
// const { default: appList } = await import('~/static/app-list.json')
|
||||||
// const { default: gamelist } = await import('~/static/game-list.json')
|
// const { default: gamelist } = await import('~/static/game-list.json')
|
||||||
|
|
||||||
const { sortedAppList, allList } = await import('~/helpers/get-list.js')
|
const { sortedAppList, allList, allVideoAppsList, makeAppSearchLinks } = await import('~/helpers/get-list.js')
|
||||||
|
|
||||||
|
const allAppSearchLinks = {}
|
||||||
|
|
||||||
|
// console.log('allVideoAppsList', allVideoAppsList)
|
||||||
|
|
||||||
|
allVideoAppsList.forEach( app => {
|
||||||
|
// Make the search links
|
||||||
|
const searchLinks = makeAppSearchLinks(app)
|
||||||
|
|
||||||
|
// If there are more than zero
|
||||||
|
// add them to our list
|
||||||
|
if (searchLinks.length > 0) {
|
||||||
|
allAppSearchLinks[app.slug] = searchLinks
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// Filter app list to leave out data not needed for search
|
// Filter app list to leave out data not needed for search
|
||||||
initialAppList: sortedAppList.map( app => {
|
initialAppList: sortedAppList.map( app => {
|
||||||
|
|
||||||
|
let searchLinks = []
|
||||||
|
|
||||||
|
if (typeof allAppSearchLinks[app.slug] !== 'undefined') {
|
||||||
|
searchLinks = allAppSearchLinks[app.slug]
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: app.name,
|
name: app.name,
|
||||||
status: app.status,
|
status: app.status,
|
||||||
|
|
@ -86,8 +106,10 @@ export default {
|
||||||
text: app.text,
|
text: app.text,
|
||||||
lastUpdated: app.lastUpdated,
|
lastUpdated: app.lastUpdated,
|
||||||
category: app.category,
|
category: app.category,
|
||||||
|
searchLinks
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
allAppSearchLinks,
|
||||||
customSummaryNumbers: getListSummaryNumbers(allList)
|
customSummaryNumbers: getListSummaryNumbers(allList)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -163,6 +185,8 @@ export default {
|
||||||
// then stop
|
// then stop
|
||||||
if (this.fetchedAppList.length !== 0 || this.query.trim().length === 0) return
|
if (this.fetchedAppList.length !== 0 || this.query.trim().length === 0) return
|
||||||
|
|
||||||
|
// console.log('this.allAppSearchLinks', this.allAppSearchLinks)
|
||||||
|
|
||||||
const fetchedListUrls = [
|
const fetchedListUrls = [
|
||||||
'/game-list.json',
|
'/game-list.json',
|
||||||
'/homebrew-list.json'
|
'/homebrew-list.json'
|
||||||
|
|
@ -179,7 +203,19 @@ export default {
|
||||||
|
|
||||||
// console.log('fetchedLists', fetchedLists)
|
// console.log('fetchedLists', fetchedLists)
|
||||||
|
|
||||||
this.fetchedAppList = fetchedLists.flat(1)
|
this.fetchedAppList = fetchedLists.flat(1).map( app => {
|
||||||
|
|
||||||
|
let searchLinks = []
|
||||||
|
|
||||||
|
if (typeof this.allAppSearchLinks[app.slug] !== 'undefined') {
|
||||||
|
searchLinks = this.allAppSearchLinks[app.slug]
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...app,
|
||||||
|
searchLinks
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,26 +55,32 @@
|
||||||
import Search from '~/components/search.vue'
|
import Search from '~/components/search.vue'
|
||||||
import LinkButton from '~/components/link-button.vue'
|
import LinkButton from '~/components/link-button.vue'
|
||||||
|
|
||||||
import { byTimeThenNull } from '~/helpers/sort-list.js'
|
|
||||||
|
|
||||||
import { categories, getAppCategory } from '~/helpers/categories.js'
|
import { categories, getAppCategory } from '~/helpers/categories.js'
|
||||||
|
|
||||||
import appList from '~/static/app-list.json'
|
|
||||||
import gamelist from '~/static/game-list.json'
|
|
||||||
import homebrewList from '~/static/homebrew-list.json'
|
|
||||||
|
|
||||||
const allList = [
|
|
||||||
...appList.sort(byTimeThenNull),
|
|
||||||
...homebrewList,
|
|
||||||
...gamelist,
|
|
||||||
]
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
async asyncData ({ params: { slug } }) {
|
async asyncData ({ params: { slug } }) {
|
||||||
// Maybe I could import() here to reduce client script size
|
const { sortedAppList, allList, allVideoAppsList, makeAppSearchLinks } = await import('~/helpers/get-list.js')
|
||||||
|
const { default: gameList } = await import('~/static/game-list.json')
|
||||||
|
|
||||||
|
const filteredList = allList.filter(app => {
|
||||||
|
return app.category.slug === slug
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
slug,
|
slug,
|
||||||
// app: appList.find(app => (app.slug === slug))
|
categoryAppList: filteredList.map( app => {
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: app.name,
|
||||||
|
status: app.status,
|
||||||
|
slug: app.slug,
|
||||||
|
// endpoint: app.endpoint,
|
||||||
|
text: app.text,
|
||||||
|
lastUpdated: app.lastUpdated,
|
||||||
|
category: app.category,
|
||||||
|
searchLinks: makeAppSearchLinks(app)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -104,20 +110,6 @@ export default {
|
||||||
category () {
|
category () {
|
||||||
return categories[this.slug]
|
return categories[this.slug]
|
||||||
},
|
},
|
||||||
categoryAppList () {
|
|
||||||
|
|
||||||
const filteredList = allList.filter(app => {
|
|
||||||
return app.category.slug === this.slug
|
|
||||||
})
|
|
||||||
|
|
||||||
// const sortedList = list.sort(byTimeThenNull)
|
|
||||||
|
|
||||||
// if (this.category.slug === 'homebrew') {
|
|
||||||
// return filteredList.slice(0, 300)
|
|
||||||
// }
|
|
||||||
|
|
||||||
return filteredList
|
|
||||||
},
|
|
||||||
supportedAppList () {
|
supportedAppList () {
|
||||||
return this.categoryAppList.filter(app => {
|
return this.categoryAppList.filter(app => {
|
||||||
return app.status.includes('yes')
|
return app.status.includes('yes')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue