Add per-download Amazon button settings for current and archived downloads

This commit is contained in:
nmemmert
2026-05-07 07:49:02 -04:00
parent 9f0aa8bd65
commit bc3d906e64
4 changed files with 55 additions and 2 deletions
+12 -1
View File
@@ -281,6 +281,8 @@ interface DownloadPageResource {
tags: string[]
buttonText: string
resourceId: string
amazonUrl?: string
amazonLabel?: string
}
function resolveDownloadPageResource(content: SiteContent, pageId: string | undefined): DownloadPageResource | null {
@@ -299,6 +301,8 @@ function resolveDownloadPageResource(content: SiteContent, pageId: string | unde
tags: resource.tags ?? [],
buttonText: `Download ${resource.label}`,
resourceId: buildCustomResourceDownloadId(resource.id),
amazonUrl: resource.amazonUrl,
amazonLabel: resource.amazonLabel,
}
}
@@ -316,6 +320,8 @@ function resolveDownloadPageResource(content: SiteContent, pageId: string | unde
tags: [],
buttonText: `Download ${link.label || series.title || 'Resource'}`,
resourceId: buildArchivedResourceDownloadId(series.id, link.id),
amazonUrl: link.amazonUrl,
amazonLabel: link.amazonLabel,
}
}
@@ -587,7 +593,7 @@ function StudyGuideSection({ content }: { content: SiteContent }) {
rel="noreferrer"
className="btn-secondary"
>
Get Printed Copy on Amazon
{content.studyGuideAmazonButtonLabel || 'Get it on Amazon'}
</a>
</div>
)}
@@ -819,6 +825,11 @@ function DownloadDetailPage({ content }: { content: SiteContent }) {
</div>
<div className="download-detail-actions">
{resource.amazonUrl && (
<a href={resource.amazonUrl} target="_blank" rel="noreferrer" className="btn-secondary">
{resource.amazonLabel || 'Get it on Amazon'}
</a>
)}
<Link to="/resources" className="btn-secondary">Back to Downloads</Link>
</div>
</div>