fix(portal): recognize legacy lineup report links as resource buttons
This commit is contained in:
1 parent
95c5f229f5
commit
16a72caa00
1 file changed
+7
-2
@@ -1,8 +1,13 @@
|
||||
/** Translate a narrow presentation vocabulary; never copy arbitrary classes/styles. */
|
||||
export function portalLinkPresentation(classes: string[], background: string, protocol: string): string | undefined {
|
||||
export function portalLinkPresentation(classes: string[], background: string, protocol: string, label = ''): string | undefined {
|
||||
if (protocol === 'mailto:' || protocol === 'tel:') return 'portal-contact-link';
|
||||
// The legacy portal's operational lineup-report anchors are styled by HubSpot
|
||||
// rules that do not survive the sanitized render. Recognize their visible
|
||||
// label, not arbitrary source classes, CSS, destinations or executable markup.
|
||||
const lineupReport = /\b(?:daily|monthly)\s+lineup\s+report\b/i.test(label.replace(/\s+/g, ' ').trim());
|
||||
if (classes.some((name) => ['hs-button', 'content-button', 'portal-resource-button'].includes(name)) ||
|
||||
['rgb(255, 189, 89)', 'rgb(255, 145, 77)', '#ffbd59', '#ff914d'].includes(background.toLowerCase())) {
|
||||
['rgb(255, 189, 89)', 'rgb(255, 145, 77)', '#ffbd59', '#ff914d'].includes(background.toLowerCase()) ||
|
||||
lineupReport) {
|
||||
return 'portal-resource-button';
|
||||
}
|
||||
return undefined;
|
||||
|
||||
Reference in new issue
Block a user