mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 21:33:19 +00:00
feat(notices): 5.2.0 release modal and Patreon for monthly support
The release modal now shows 5.2.0: booking mails that land in the trip, live flight status and the new trip PDF, each with its own drawn card, and links the 5.2.0 release notes. The maintainer note and the support block are rewritten, shorter and without the sponsor wording. Patreon joins Buy Me a Coffee and Ko-fi as the monthly way to support TREK: a full-width button in the release and thank-you notices (a new optional tertiaryCta on the notice contract), a tile in About and in the admin GitHub panel on desktop and phone, the README badges and FUNDING.yml. Like the other donation links it stays hidden inside the native apps.
This commit is contained in:
@@ -15,6 +15,7 @@ describe('isDonationLink', () => {
|
||||
it('knows the donation pages, their subdomains too', () => {
|
||||
expect(isDonationLink('https://ko-fi.com/mauriceboe')).toBe(true);
|
||||
expect(isDonationLink('https://www.BuyMeACoffee.com/mauriceboe')).toBe(true);
|
||||
expect(isDonationLink('https://www.patreon.com/cw/mauriceboe')).toBe(true);
|
||||
});
|
||||
|
||||
it('is false for anything else, a missing href or one that is no URL', () => {
|
||||
@@ -41,9 +42,10 @@ describe('in the native app', () => {
|
||||
});
|
||||
|
||||
describe('noticeAsksForDonation', () => {
|
||||
it('looks at both buttons', () => {
|
||||
it('looks at all three buttons', () => {
|
||||
expect(noticeAsksForDonation({ cta: { kind: 'link', href: 'https://ko-fi.com/x' } })).toBe(true);
|
||||
expect(noticeAsksForDonation({ secondaryCta: { kind: 'link', href: 'https://buymeacoffee.com/x' } })).toBe(true);
|
||||
expect(noticeAsksForDonation({ tertiaryCta: { kind: 'link', href: 'https://www.patreon.com/x' } })).toBe(true);
|
||||
expect(noticeAsksForDonation({ cta: { kind: 'nav', href: '/settings' }, secondaryCta: null })).toBe(false);
|
||||
expect(noticeAsksForDonation({ cta: { kind: 'action' } })).toBe(false);
|
||||
expect(noticeAsksForDonation({})).toBe(false);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { isNativeApp } from '../native/platform';
|
||||
|
||||
/** Where the project takes donations. */
|
||||
const DONATION_HOSTS = ['ko-fi.com', 'buymeacoffee.com'];
|
||||
const DONATION_HOSTS = ['ko-fi.com', 'buymeacoffee.com', 'patreon.com'];
|
||||
|
||||
/** Whether `href` points at one of the project's donation pages. */
|
||||
export function isDonationLink(href: string | undefined): boolean {
|
||||
@@ -33,6 +33,10 @@ export function withoutDonationsInApp<T extends { href: string }>(links: T[]): T
|
||||
type NoticeButton = { kind: string; href?: string } | null | undefined;
|
||||
|
||||
/** Whether a system notice asks for a donation through one of its buttons. */
|
||||
export function noticeAsksForDonation(notice: { cta?: NoticeButton; secondaryCta?: NoticeButton }): boolean {
|
||||
return isDonationLink(notice.cta?.href) || isDonationLink(notice.secondaryCta?.href);
|
||||
export function noticeAsksForDonation(notice: {
|
||||
cta?: NoticeButton;
|
||||
secondaryCta?: NoticeButton;
|
||||
tertiaryCta?: NoticeButton;
|
||||
}): boolean {
|
||||
return [notice.cta, notice.secondaryCta, notice.tertiaryCta].some((cta) => isDonationLink(cta?.href));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user