diff --git a/package-lock.json b/package-lock.json index c701a21..7ada3a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "siteforge", - "version": "2.36.0", + "version": "2.36.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "siteforge", - "version": "2.36.0", + "version": "2.36.1", "dependencies": { "@aws-sdk/client-s3": "^3.1135.0", "@dnd-kit/core": "^6.3.1", diff --git a/package.json b/package.json index 6fd8b77..1646bec 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "siteforge", "private": true, - "version": "2.36.0", + "version": "2.36.1", "type": "module", "scripts": { "dev": "vite", diff --git a/src/content.ts b/src/content.ts index 92fdcd1..b41dcb0 100644 --- a/src/content.ts +++ b/src/content.ts @@ -710,6 +710,8 @@ export interface StudyGuideLink { // Page id under /downloads/ (primary-guide, second-guide, book-guide--) pageId: string title: string + // Direct file link, when the guide has one; otherwise the button opens the guide's page (store links) + downloadUrl?: string } // The companion guide a study offers, either chosen explicitly in admin or found through the @@ -723,13 +725,13 @@ export function getStudyGuideLink( const primary = (): StudyGuideLink | null => content.studyGuideTitle && (content.studyGuideUrl || content.studyGuideDownloadUrl || content.studyGuideAppleBooksUrl) - ? { pageId: 'primary-guide', title: content.studyGuideTitle } + ? { pageId: 'primary-guide', title: content.studyGuideTitle, downloadUrl: content.studyGuideDownloadUrl || undefined } : null const second = (): StudyGuideLink | null => - content.secondSeries?.guide?.title ? { pageId: 'second-guide', title: content.secondSeries.guide.title } : null + content.secondSeries?.guide?.title ? { pageId: 'second-guide', title: content.secondSeries.guide.title, downloadUrl: content.secondSeries.guide.downloadUrl || undefined } : null const book = (id: string): StudyGuideLink | null => { const found = (content.finishedBooks ?? []).find(b => b.id === id) - return found?.guide?.title ? { pageId: `book-guide--${found.id}`, title: found.guide.title } : null + return found?.guide?.title ? { pageId: `book-guide--${found.id}`, title: found.guide.title, downloadUrl: found.guide.downloadUrl || undefined } : null } if (source === 'primary') return primary() diff --git a/src/studyPages.tsx b/src/studyPages.tsx index 8f987c0..c8e27ff 100644 --- a/src/studyPages.tsx +++ b/src/studyPages.tsx @@ -1743,7 +1743,9 @@ export function ColossiansStudyIndexPage({ content }: Props) { {enrolling ? 'Enrolling...' : 'Enroll in This Study'} )} - {studyGuide && 📄 Download Study Guide} + {studyGuide && (studyGuide.downloadUrl + ? 📄 Download Study Guide + : 📄 Get the Study Guide)} {allLessonsDone && 🏅 My Certificate} {enrolled && My Notes} {enrolled && studyStatus !== 'planned' && Community}