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;"
|
||||
>
|
||||
<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">
|
||||
{{ app.text }}
|
||||
</div>
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
</div>
|
||||
</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">
|
||||
{{ app.text }}
|
||||
</div>
|
||||
|
|
@ -163,19 +163,13 @@
|
|||
<script>
|
||||
import scrollIntoView from 'scroll-into-view-if-needed'
|
||||
|
||||
import { getAppCategory } from '~/helpers/categories.js'
|
||||
// import appList from '~/static/app-list.json'
|
||||
|
||||
// import EmailSubscribe from '~/components/email-subscribe.vue'
|
||||
// import RelativeTime from '~/components/relative-time.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 {
|
||||
components: {
|
||||
|
|
@ -316,6 +310,7 @@ export default {
|
|||
console.log('appList', this.appList.length)
|
||||
},
|
||||
methods: {
|
||||
getAppCategory,
|
||||
// Search priorities
|
||||
titleStartsWith (query, app) {
|
||||
const matches = app.name.toLowerCase().startsWith(query)
|
||||
|
|
@ -332,7 +327,7 @@ export default {
|
|||
return matches
|
||||
},
|
||||
sectionContains (query, app) {
|
||||
const matches = app.section.label.toLowerCase().includes(query)
|
||||
const matches = getAppCategory(app).label.toLowerCase().includes(query)
|
||||
if (matches) {
|
||||
this.sectionContainsResults.push(app)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,9 +193,7 @@ export default async function () {
|
|||
slug: appSlug,
|
||||
endpoint,
|
||||
section: {
|
||||
label: sectionTitle,
|
||||
slug: sectionSlug,
|
||||
icon: ''
|
||||
slug: sectionSlug
|
||||
},
|
||||
content: token.content,
|
||||
relatedLinks
|
||||
|
|
|
|||
|
|
@ -124,9 +124,7 @@ export default async function () {
|
|||
slug,
|
||||
endpoint: `/game/${slug}`,
|
||||
section: {
|
||||
label: 'Games',
|
||||
slug: 'games',
|
||||
icon: '🎮'
|
||||
slug: 'games'
|
||||
},
|
||||
content: '',
|
||||
relatedLinks: [
|
||||
|
|
|
|||
|
|
@ -150,9 +150,7 @@ export default async function () {
|
|||
slug,
|
||||
endpoint: `/formula/${slug}`,
|
||||
section: {
|
||||
label: 'Homebrew',
|
||||
slug: 'homebrew',
|
||||
icon: '🍺'
|
||||
slug: 'homebrew'
|
||||
},
|
||||
content: formulae.comments,
|
||||
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" />
|
||||
|
||||
<!-- sectionList: {{ sectionList }} -->
|
||||
|
||||
<ul class="categories-list space-y-3">
|
||||
<li
|
||||
v-for="(section, i) in sectionList"
|
||||
|
|
@ -22,7 +24,7 @@
|
|||
>
|
||||
<div class="font-hairline">
|
||||
<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>
|
||||
</a>
|
||||
|
|
@ -48,6 +50,7 @@ export default {
|
|||
// const { default: gamelist } = await import('~/static/game-list.json')
|
||||
|
||||
const { allList } = await import('~/helpers/get-list.js')
|
||||
const { categories } = await import('~/helpers/categories.js')
|
||||
|
||||
const sectionList = {}
|
||||
|
||||
|
|
@ -57,17 +60,26 @@ export default {
|
|||
// console.log('app.section.slug', 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
|
||||
}
|
||||
|
||||
sectionList[app.section.slug] = {
|
||||
...app.section,
|
||||
appNames: [ app.name ]
|
||||
...categories[app.section.slug],
|
||||
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 {
|
||||
sectionList
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
<section class="container py-24">
|
||||
<div class="flex flex-col items-center">
|
||||
<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>
|
||||
|
||||
<h2
|
||||
v-if="supportedAppList.length !== 0"
|
||||
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 { categories } 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'
|
||||
|
|
@ -72,9 +75,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
section () {
|
||||
return allList.find(app => {
|
||||
return app.section.slug === this.slug
|
||||
}).section
|
||||
return categories[this.slug]
|
||||
},
|
||||
sectionAppList () {
|
||||
|
||||
|
|
@ -92,9 +93,7 @@ export default {
|
|||
}).map(app => app.name)
|
||||
},
|
||||
title () {
|
||||
if (!this.section.label.includes('Tools')) return `List of ${this.section.label} Apps that work on Apple Silicon?`
|
||||
|
||||
return `List of ${this.section.label} that work on Apple Silicon?`
|
||||
return `List of ${this.section.pluralLabel || this.section.label} that work on Apple Silicon?`
|
||||
}
|
||||
},
|
||||
head() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue