Restore share section with QR code and Share the Show button
This commit is contained in:
+47
@@ -746,6 +746,40 @@ function DownloadDetailPage({ content }: { content: SiteContent }) {
|
||||
)
|
||||
}
|
||||
|
||||
function ShareShowButton() {
|
||||
const [feedback, setFeedback] = useState('')
|
||||
|
||||
async function handleShare() {
|
||||
const shareUrl = window.location.origin
|
||||
const shareTitle = 'Verse by Verse with Nate'
|
||||
const shareText = 'Check out Verse by Verse with Nate.'
|
||||
try {
|
||||
if (navigator.share) {
|
||||
await navigator.share({ title: shareTitle, text: shareText, url: shareUrl })
|
||||
setFeedback('Shared successfully.')
|
||||
return
|
||||
}
|
||||
if (navigator.clipboard?.writeText) {
|
||||
await navigator.clipboard.writeText(shareUrl)
|
||||
setFeedback('Link copied. Share it with a friend.')
|
||||
return
|
||||
}
|
||||
setFeedback(`Copy this link: ${shareUrl}`)
|
||||
} catch {
|
||||
setFeedback('Share canceled.')
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="share-show-wrap">
|
||||
<button type="button" className="btn-primary btn-share-show" onClick={handleShare}>
|
||||
Share the Show
|
||||
</button>
|
||||
{feedback && <p className="share-feedback">{feedback}</p>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function CustomBlocksSection({ content, page }: { content: SiteContent; page: string }) {
|
||||
const blocks = (content.customBlocks ?? []).filter(block => {
|
||||
const blockPage = block.page ?? 'downloads'
|
||||
@@ -856,6 +890,19 @@ function LandingPage({ content }: { content: SiteContent }) {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="section-share" aria-label="Share the show">
|
||||
<div className="section-inner section-share-inner">
|
||||
<div className="share-text">
|
||||
<h2 className="section-heading" style={{ textAlign: 'left', marginBottom: '0.75rem' }}>
|
||||
{content.shareHeading || 'Help one more person hear the Word this week.'}
|
||||
</h2>
|
||||
<p className="share-p">{content.shareP || 'Scan the QR code or text the show link to a friend who needs encouragement today.'}</p>
|
||||
<ShareShowButton />
|
||||
</div>
|
||||
<img src="/images/qr-code.jpg" alt="QR code to share the show" className="share-qr" />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<SiteFooter content={content} />
|
||||
|
||||
<AnalyticsConsentBanner content={content} />
|
||||
|
||||
Reference in New Issue
Block a user