diff --git a/helpers/app-derived.js b/helpers/app-derived.js index e473ff6..4beb2cd 100644 --- a/helpers/app-derived.js +++ b/helpers/app-derived.js @@ -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 +}