Merge branch 'feat/smarter-naming'

This commit is contained in:
Sam Carlton 2021-05-14 17:37:09 -05:00
commit 2a69e27bc5
2 changed files with 23 additions and 0 deletions

View file

@ -14,6 +14,9 @@
"generate-eleventy": "node --max-old-space-size=60000 -r esm node_modules/.bin/eleventy --quiet",
"generate-postcss": "ENV=production postcss assets/css/tailwind.css --o static/tailwind.css",
"dev-eleventy": "node --max-old-space-size=60000 -r esm node_modules/.bin/eleventy --quiet --watch --serve",
"dev-eleventy-debug": "DEBUG=Eleventy* node --max-old-space-size=60000 -r esm node_modules/.bin/eleventy --quiet --watch --serve",
"dev-eleventy-benchmark": "DEBUG=Eleventy:Benchmark* node --max-old-space-size=60000 -r esm node_modules/.bin/eleventy --quiet --watch --serve",
"dev-eleventy-computed": "DEBUG=Eleventy:ComputedData* node --max-old-space-size=60000 -r esm node_modules/.bin/eleventy --quiet --watch --serve",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"lint:fix": "eslint --fix --ext .js,.vue --ignore-path .gitignore .",
"precommit": "npm run lint",

View file

@ -23,6 +23,20 @@ export const makeDescription = function ( app ) {
return `Latest reported support status of ${ app.name } on Apple Silicon and Apple M1 Processors.`
}
// https://stackoverflow.com/a/15069646/1397641
function makeEnglishList ( array, conjunction = 'and' ) {
const total = array.length
if ( total < 3 ) return array.join(` ${conjunction} `)
array = array.slice()
// Prepend conjunction to final part
array[ total-1 ] = `${ conjunction } ${ array[ total-1 ] }`
return array.join(', ')
}
export function renderPageLinksHtml ( links ) {
return links.map( (link, i) => {
@ -94,6 +108,8 @@ export class AppTemplate {
// console.log('video.payload', Object.keys(video.payload))
const hasMultipleAliases = !!app.aliases && app.aliases.length > 1
const appDeviceSupport = deviceList.map( device => {
const supportsApp = deviceSupportsApp( device, app )
return {
@ -117,6 +133,10 @@ export class AppTemplate {
${ app.text }
</h2>
${ hasMultipleAliases ? /* html */`
<small class="text-xs opacity-75">May also be known as ${ makeEnglishList( app.aliases, 'or' ) }</small>
` : '' }
<div class="subscribe">
<iframe src="/embed-subscribe" loading="lazy" style="width: 350px; height: 150px;" class="-my-10"></iframe>
</div>