List app aliases

This commit is contained in:
Sam Carlton 2021-05-14 17:36:46 -05:00
parent f8e750dc2a
commit 6bf7c71465

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.` 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 ) { export function renderPageLinksHtml ( links ) {
return links.map( (link, i) => { return links.map( (link, i) => {
@ -94,6 +108,8 @@ export class AppTemplate {
// console.log('video.payload', Object.keys(video.payload)) // console.log('video.payload', Object.keys(video.payload))
const hasMultipleAliases = !!app.aliases && app.aliases.length > 1
const appDeviceSupport = deviceList.map( device => { const appDeviceSupport = deviceList.map( device => {
const supportsApp = deviceSupportsApp( device, app ) const supportsApp = deviceSupportsApp( device, app )
return { return {
@ -117,6 +133,10 @@ export class AppTemplate {
${ app.text } ${ app.text }
</h2> </h2>
${ hasMultipleAliases ? /* html */`
<small class="text-xs opacity-75">May also be known as ${ makeEnglishList( app.aliases, 'or' ) }</small>
` : '' }
<div class="subscribe"> <div class="subscribe">
<iframe src="/embed-subscribe" loading="lazy" style="width: 350px; height: 150px;" class="-my-10"></iframe> <iframe src="/embed-subscribe" loading="lazy" style="width: 350px; height: 150px;" class="-my-10"></iframe>
</div> </div>