diff --git a/etc/config/sponsors.yaml b/etc/config/sponsors.yaml index 1f35b97a9..171caa81b 100644 --- a/etc/config/sponsors.yaml +++ b/etc/config/sponsors.yaml @@ -21,7 +21,9 @@ levels: sideBySide: true statsId: intel - name: Backtrace - description: Deliver uninterrupted experiences by automating your response to player-impacting errors. Get started for free. + description: + - Deliver uninterrupted experiences by automating your response to player-impacting errors. Get started for free. + - Capture, prioritize, and resolve errors and crashes automatically for uninterrupted user experiences. Get started for free. icon: https://static.ce-cdn.net/bt/Black-BT-Logo-A.svg icon_dark: https://static.ce-cdn.net/bt/White-BT-Logo-A.svg img: https://static.ce-cdn.net/bt/BT-logo (1).png diff --git a/lib/sponsors.interfaces.ts b/lib/sponsors.interfaces.ts index 2b0a01949..d0904a375 100644 --- a/lib/sponsors.interfaces.ts +++ b/lib/sponsors.interfaces.ts @@ -24,7 +24,7 @@ export type Sponsor = { name: string; - description?: string; + description?: string[]; img?: string; icon?: string; icon_dark?: string; diff --git a/lib/sponsors.ts b/lib/sponsors.ts index 80dbf7a19..feaafcb34 100644 --- a/lib/sponsors.ts +++ b/lib/sponsors.ts @@ -30,7 +30,7 @@ export function parse(mapOrString: Record | string): Sponsor { if (typeof mapOrString == 'string') mapOrString = {name: mapOrString}; return { name: mapOrString.name, - description: mapOrString.description, + description: typeof mapOrString.description === 'string' ? [mapOrString.description] : mapOrString.description, url: mapOrString.url, onclick: mapOrString.url ? `window.onSponsorClick(${JSON.stringify(mapOrString.url)});` : '', img: mapOrString.img, diff --git a/test/sponsors-test.js b/test/sponsors-test.js index 6bf29e7ef..84e67ae25 100644 --- a/test/sponsors-test.js +++ b/test/sponsors-test.js @@ -45,8 +45,11 @@ describe('Sponsors', () => { obj.sideBySide.should.be.false; should.equal(obj.statsId, undefined); }); + it('should make descriptions always one-sized arrays', () => { + parse({name: 'moo', description: 'desc'}).description.should.deep.eq(['desc']); + }); it('should pass through descriptions', () => { - parse({name: 'moo', description: 'desc'}).description.should.eq('desc'); + parse({name: 'moo', description: ['desc1', 'desc2']}).description.should.deep.eq(['desc1', 'desc2']); }); it('should pass through icons', () => { parse({name: 'bob', icon: 'icon'}).icon.should.eq('icon'); diff --git a/views/bits/sponsors-content.pug b/views/bits/sponsors-content.pug index 421ed283f..f3ba78662 100644 --- a/views/bits/sponsors-content.pug +++ b/views/bits/sponsors-content.pug @@ -31,7 +31,7 @@ block content .ces-item-title img.ces-logo-large(src=sponsor.img alt=sponsor.name) .ces-item-description - != sponsor.description + != sponsor.description[Math.floor(Math.random() * sponsor.description.length)] else .ces-item-title if sponsor.img @@ -39,4 +39,4 @@ block content = sponsor.name if sponsor.description .ces-item-description - = sponsor.description + = sponsor.description[Math.floor(Math.random() * sponsor.description.length)]