Add getIconForListing helper

This commit is contained in:
Sam Carlton 2022-05-18 12:51:12 -05:00
parent e8a34741bc
commit 251938a782

View file

@ -1,5 +1,10 @@
// App Data that is derived from other app data
import {
categories,
categoryTemplate
} from '~/helpers/categories.js'
export function isDevice ( listing ) {
if ( !listing.hasOwnProperty('endpoint') ) return false
@ -71,3 +76,18 @@ export function getRouteType ( routeString ) {
return routeType
}
export function getIconForListing ( listing ) {
const routeType = getRouteType( listing.endpoint )
if ( routeType === 'tv' || routeType === 'benchmarks' ) return '📺'
if ( routeType === 'device' ) return '🖥'
if ( routeType === 'formula' ) return categories.homebrew.icon
if ( routeType === 'game' ) return categories.games.icon
// Just use default icon
return categoryTemplate.icon
}