diff --git a/interfaces/faq.ts b/interfaces/faq.ts index e06277e..9958a1d 100644 --- a/interfaces/faq.ts +++ b/interfaces/faq.ts @@ -5,5 +5,6 @@ export interface ICardFAQEntry { export interface ICardFAQ { card: string; + cardDisplay?: string; faq: ICardFAQEntry[]; } diff --git a/src/app/_shared/pipes/faq.pipe.ts b/src/app/_shared/pipes/faq.pipe.ts index 3109c4c..91d09ab 100644 --- a/src/app/_shared/pipes/faq.pipe.ts +++ b/src/app/_shared/pipes/faq.pipe.ts @@ -10,7 +10,7 @@ export class FaqPipe implements PipeTransform { private cardsService = inject(CardsService); transform(value: string, ...args: (string | undefined)[]): string { - const [productId] = args; + const [productId, cardDisplay] = args; if (!productId) return value ?? ''; const ruleRegex = /\$rule:([\d.]+)\$/gm; @@ -20,7 +20,9 @@ export class FaqPipe implements PipeTransform { const rulesUrl = this.metaService.getRulesByProductId(productId); if (!rulesUrl) return p1; - return `${p1}`; + return `${ + cardDisplay || p1 + }`; }); const linkRegex = /\$link:([\w'"\-& ]+)\$/gm; @@ -32,7 +34,7 @@ export class FaqPipe implements PipeTransform { return `${foundCard.name}`; + )}" target="_blank">${cardDisplay || foundCard.name}`; }); value = value.replace('\n', '
'); diff --git a/src/app/faq.service.ts b/src/app/faq.service.ts index b6caba0..ce75934 100644 --- a/src/app/faq.service.ts +++ b/src/app/faq.service.ts @@ -51,7 +51,7 @@ export class FAQService { Object.keys(faqData[productId]).forEach((locale) => { baseFAQs[productId][locale] = sortBy( faqData[productId][locale], - 'card' + (cardFAQ) => cardFAQ.cardDisplay || cardFAQ.card ); faqData[productId][locale].forEach((cardFAQ) => { diff --git a/src/app/faq/faq.page.html b/src/app/faq/faq.page.html index 6103e65..f1f3a26 100644 --- a/src/app/faq/faq.page.html +++ b/src/app/faq/faq.page.html @@ -25,7 +25,7 @@ - +