mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
List app categories from single file
This commit is contained in:
parent
64e681b4a3
commit
e578118bab
7 changed files with 120 additions and 30 deletions
|
|
@ -76,7 +76,7 @@
|
||||||
style="transition-property: border;"
|
style="transition-property: border;"
|
||||||
>
|
>
|
||||||
<template v-if="seenItems[app.slug] === false && hasStartedAnyQuery === false">
|
<template v-if="seenItems[app.slug] === false && hasStartedAnyQuery === false">
|
||||||
{{ app.section.icon.length !== 0 ? `${app.section.icon} ${app.name}` : app.name }}
|
{{ getAppCategory(app).icon ? `${getAppCategory(app).icon} ${app.name}` : app.name }}
|
||||||
<div class="text-sm leading-5 font-bold">
|
<div class="text-sm leading-5 font-bold">
|
||||||
{{ app.text }}
|
{{ app.text }}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -89,7 +89,7 @@
|
||||||
</div>
|
</div>
|
||||||
</client-only>
|
</client-only>
|
||||||
|
|
||||||
{{ app.section.icon.length !== 0 ? `${app.section.icon} ${app.name}` : app.name }}
|
{{ getAppCategory(app).icon ? `${getAppCategory(app).icon} ${app.name}` : app.name }}
|
||||||
<div class="text-sm leading-5 font-bold">
|
<div class="text-sm leading-5 font-bold">
|
||||||
{{ app.text }}
|
{{ app.text }}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -163,19 +163,13 @@
|
||||||
<script>
|
<script>
|
||||||
import scrollIntoView from 'scroll-into-view-if-needed'
|
import scrollIntoView from 'scroll-into-view-if-needed'
|
||||||
|
|
||||||
|
import { getAppCategory } from '~/helpers/categories.js'
|
||||||
// import appList from '~/static/app-list.json'
|
// import appList from '~/static/app-list.json'
|
||||||
|
|
||||||
// import EmailSubscribe from '~/components/email-subscribe.vue'
|
// import EmailSubscribe from '~/components/email-subscribe.vue'
|
||||||
// import RelativeTime from '~/components/relative-time.vue'
|
// import RelativeTime from '~/components/relative-time.vue'
|
||||||
import ListSummary from '~/components/list-summary.vue'
|
import ListSummary from '~/components/list-summary.vue'
|
||||||
|
|
||||||
// import overlayStore from './mixins/store'
|
|
||||||
// import modalRouter from '~/components/modals/mixins/router'
|
|
||||||
// import Card from '~/components/cards/Default.vue'
|
|
||||||
// import CardsRow from '~/components/cards/Row.vue'
|
|
||||||
// import ComingSoonImage from '~/components/partials/ComingSoonImage.vue'
|
|
||||||
// import InfoCircle from '~/assets/svg/info-circle.svg?inline'
|
|
||||||
// import PlayCircle from '~/assets/svg/play-circle.svg?inline'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -316,6 +310,7 @@ export default {
|
||||||
console.log('appList', this.appList.length)
|
console.log('appList', this.appList.length)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAppCategory,
|
||||||
// Search priorities
|
// Search priorities
|
||||||
titleStartsWith (query, app) {
|
titleStartsWith (query, app) {
|
||||||
const matches = app.name.toLowerCase().startsWith(query)
|
const matches = app.name.toLowerCase().startsWith(query)
|
||||||
|
|
@ -332,7 +327,7 @@ export default {
|
||||||
return matches
|
return matches
|
||||||
},
|
},
|
||||||
sectionContains (query, app) {
|
sectionContains (query, app) {
|
||||||
const matches = app.section.label.toLowerCase().includes(query)
|
const matches = getAppCategory(app).label.toLowerCase().includes(query)
|
||||||
if (matches) {
|
if (matches) {
|
||||||
this.sectionContainsResults.push(app)
|
this.sectionContainsResults.push(app)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -193,9 +193,7 @@ export default async function () {
|
||||||
slug: appSlug,
|
slug: appSlug,
|
||||||
endpoint,
|
endpoint,
|
||||||
section: {
|
section: {
|
||||||
label: sectionTitle,
|
slug: sectionSlug
|
||||||
slug: sectionSlug,
|
|
||||||
icon: ''
|
|
||||||
},
|
},
|
||||||
content: token.content,
|
content: token.content,
|
||||||
relatedLinks
|
relatedLinks
|
||||||
|
|
|
||||||
|
|
@ -124,9 +124,7 @@ export default async function () {
|
||||||
slug,
|
slug,
|
||||||
endpoint: `/game/${slug}`,
|
endpoint: `/game/${slug}`,
|
||||||
section: {
|
section: {
|
||||||
label: 'Games',
|
slug: 'games'
|
||||||
slug: 'games',
|
|
||||||
icon: '🎮'
|
|
||||||
},
|
},
|
||||||
content: '',
|
content: '',
|
||||||
relatedLinks: [
|
relatedLinks: [
|
||||||
|
|
|
||||||
|
|
@ -150,9 +150,7 @@ export default async function () {
|
||||||
slug,
|
slug,
|
||||||
endpoint: `/formula/${slug}`,
|
endpoint: `/formula/${slug}`,
|
||||||
section: {
|
section: {
|
||||||
label: 'Homebrew',
|
slug: 'homebrew'
|
||||||
slug: 'homebrew',
|
|
||||||
icon: '🍺'
|
|
||||||
},
|
},
|
||||||
content: formulae.comments,
|
content: formulae.comments,
|
||||||
relatedLinks: [
|
relatedLinks: [
|
||||||
|
|
|
||||||
90
helpers/categories.js
Normal file
90
helpers/categories.js
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
|
||||||
|
// Contains all types of properies to keep data consistent
|
||||||
|
export const categoryTemplate = {
|
||||||
|
label: null,
|
||||||
|
pluralLabel: null,
|
||||||
|
itemSuffixLabel: null,
|
||||||
|
icon: null,
|
||||||
|
requestLinks: null
|
||||||
|
}
|
||||||
|
|
||||||
|
export const categories = {
|
||||||
|
|
||||||
|
// App lists
|
||||||
|
'developer-tools': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: 'Developer Tools',
|
||||||
|
pluralLabel: 'Developer Tools',
|
||||||
|
slug: 'developer-tools',
|
||||||
|
},
|
||||||
|
'productivity-tools': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: 'Productivity Tools',
|
||||||
|
pluralLabel: 'Productivity Tools',
|
||||||
|
slug: 'developer-tools',
|
||||||
|
},
|
||||||
|
'video-and-motion-tools': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: 'Video and Motion Tools',
|
||||||
|
pluralLabel: 'Video and Motion Tools',
|
||||||
|
slug: 'video-and-motion-tools',
|
||||||
|
},
|
||||||
|
'social-and-communication': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: 'Social and Communication',
|
||||||
|
pluralLabel: 'Social and Communication Apps',
|
||||||
|
slug: 'social-and-communication',
|
||||||
|
},
|
||||||
|
'entertainment-and-media-apps': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: 'Entertainment and Media Apps',
|
||||||
|
pluralLabel: 'Entertainment and Media Apps',
|
||||||
|
slug: 'entertainment-and-media-apps',
|
||||||
|
},
|
||||||
|
'music-and-audio-tools': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: 'Music and Audio Tools',
|
||||||
|
pluralLabel: 'Music and Audio Tools',
|
||||||
|
slug: 'music-and-audio-tools',
|
||||||
|
},
|
||||||
|
'photo-and-graphic-tools': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: 'Photo and Graphic Tools',
|
||||||
|
pluralLabel: 'Photo and Graphic Tools',
|
||||||
|
slug: 'photo-and-graphic-tools',
|
||||||
|
},
|
||||||
|
'science-and-research-software': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: 'Science and Research Software',
|
||||||
|
pluralLabel: 'Science and Research Software',
|
||||||
|
slug: 'science-and-research-software',
|
||||||
|
},
|
||||||
|
'3d-and-architecture': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: '3D and Architecture',
|
||||||
|
pluralLabel: '3D and Architecture Applications',
|
||||||
|
slug: '3d-and-architecture',
|
||||||
|
},
|
||||||
|
|
||||||
|
// Special Lists
|
||||||
|
'games': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: 'Games',
|
||||||
|
pluralLabel: 'Games',
|
||||||
|
slug: 'games',
|
||||||
|
icon: '🎮'
|
||||||
|
},
|
||||||
|
'homebrew': {
|
||||||
|
...categoryTemplate,
|
||||||
|
label: 'Homebrew',
|
||||||
|
pluralLabel: 'Homebrew Formulae',
|
||||||
|
itemSuffixLabel: 'via Homebrew',
|
||||||
|
slug: 'homebrew',
|
||||||
|
icon: '🍺'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getAppCategory (app) {
|
||||||
|
return categories[app.section.slug]
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
<div class="line-separator border-white border-t-2 mb-12" />
|
<div class="line-separator border-white border-t-2 mb-12" />
|
||||||
|
|
||||||
|
<!-- sectionList: {{ sectionList }} -->
|
||||||
|
|
||||||
<ul class="categories-list space-y-3">
|
<ul class="categories-list space-y-3">
|
||||||
<li
|
<li
|
||||||
v-for="(section, i) in sectionList"
|
v-for="(section, i) in sectionList"
|
||||||
|
|
@ -22,7 +24,7 @@
|
||||||
>
|
>
|
||||||
<div class="font-hairline">
|
<div class="font-hairline">
|
||||||
<div>{{ section.label }}</div>
|
<div>{{ section.label }}</div>
|
||||||
<div class="text-xs opacity-75 mb-3">{{ section.appNames.slice(0, 25).join(', ') }}, etc...</div>
|
<div class="text-xs opacity-75 mb-3">{{ section.appNames }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div>➔</div>
|
<div>➔</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -48,6 +50,7 @@ export default {
|
||||||
// const { default: gamelist } = await import('~/static/game-list.json')
|
// const { default: gamelist } = await import('~/static/game-list.json')
|
||||||
|
|
||||||
const { allList } = await import('~/helpers/get-list.js')
|
const { allList } = await import('~/helpers/get-list.js')
|
||||||
|
const { categories } = await import('~/helpers/categories.js')
|
||||||
|
|
||||||
const sectionList = {}
|
const sectionList = {}
|
||||||
|
|
||||||
|
|
@ -57,17 +60,26 @@ export default {
|
||||||
// console.log('app.section.slug', app.section.slug)
|
// console.log('app.section.slug', app.section.slug)
|
||||||
|
|
||||||
if (sectionList.hasOwnProperty(app.section.slug)) {
|
if (sectionList.hasOwnProperty(app.section.slug)) {
|
||||||
sectionList[app.section.slug].appNames.push(app.name)
|
sectionList[app.section.slug].appNamesList.push(app.name)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
sectionList[app.section.slug] = {
|
sectionList[app.section.slug] = {
|
||||||
...app.section,
|
...categories[app.section.slug],
|
||||||
appNames: [ app.name ]
|
appNamesList: [ app.name ]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Add App Names Text into sectionList
|
||||||
|
Object.keys(sectionList).map(function(key, index) {
|
||||||
|
const section = sectionList[key]
|
||||||
|
sectionList[key] = {
|
||||||
|
...section,
|
||||||
|
appNames: section.appNamesList.slice(0, 25).join(', ') + ', etc...'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sectionList
|
sectionList
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
<section class="container py-24">
|
<section class="container py-24">
|
||||||
<div class="flex flex-col items-center">
|
<div class="flex flex-col items-center">
|
||||||
<h1 class="title text-3xl md:text-5xl font-hairline leading-tight text-center pb-4">
|
<h1 class="title text-3xl md:text-5xl font-hairline leading-tight text-center pb-4">
|
||||||
{{ section.label }} that are reported to support Apple Silicon
|
{{ section.pluralLabel || section.label }} that are reported to support Apple Silicon
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<h2
|
<h2
|
||||||
v-if="supportedAppList.length !== 0"
|
v-if="supportedAppList.length !== 0"
|
||||||
class="subtitle md:text-xl font-light text-center"
|
class="subtitle md:text-xl font-light text-center"
|
||||||
|
|
@ -43,6 +44,8 @@ import LinkButton from '~/components/link-button.vue'
|
||||||
|
|
||||||
import { byTimeThenNull } from '~/helpers/sort-list.js'
|
import { byTimeThenNull } from '~/helpers/sort-list.js'
|
||||||
|
|
||||||
|
import { categories } from '~/helpers/categories.js'
|
||||||
|
|
||||||
import appList from '~/static/app-list.json'
|
import appList from '~/static/app-list.json'
|
||||||
import gamelist from '~/static/game-list.json'
|
import gamelist from '~/static/game-list.json'
|
||||||
import homebrewList from '~/static/homebrew-list.json'
|
import homebrewList from '~/static/homebrew-list.json'
|
||||||
|
|
@ -72,9 +75,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
section () {
|
section () {
|
||||||
return allList.find(app => {
|
return categories[this.slug]
|
||||||
return app.section.slug === this.slug
|
|
||||||
}).section
|
|
||||||
},
|
},
|
||||||
sectionAppList () {
|
sectionAppList () {
|
||||||
|
|
||||||
|
|
@ -92,9 +93,7 @@ export default {
|
||||||
}).map(app => app.name)
|
}).map(app => app.name)
|
||||||
},
|
},
|
||||||
title () {
|
title () {
|
||||||
if (!this.section.label.includes('Tools')) return `List of ${this.section.label} Apps that work on Apple Silicon?`
|
return `List of ${this.section.pluralLabel || this.section.label} that work on Apple Silicon?`
|
||||||
|
|
||||||
return `List of ${this.section.label} that work on Apple Silicon?`
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
head() {
|
head() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue