feat: add all 5 polish features (stewardship breakdown, tangible impact cards, 1-click check copy, native share, and sticky rebuilding pill)
This commit is contained in:
+99
@@ -250,7 +250,106 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
}
|
||||
|
||||
// Global Floating Toast
|
||||
function showToast(message) {
|
||||
const toast = document.getElementById('global-toast');
|
||||
if (!toast) return;
|
||||
toast.textContent = message;
|
||||
toast.classList.add('active');
|
||||
setTimeout(() => {
|
||||
toast.classList.remove('active');
|
||||
}, 3500);
|
||||
}
|
||||
|
||||
// 1-Click Copy Mailing Info
|
||||
const btnCopyCheck = document.getElementById('btn-copy-check');
|
||||
const btnCopyText = document.getElementById('btn-copy-check-text');
|
||||
if (btnCopyCheck) {
|
||||
btnCopyCheck.addEventListener('click', () => {
|
||||
const checkInfo = "Payee: Macedonia World Baptist Missions, Inc.\nMemo: Pastor Victor Paez — Venezuela Rebuilding Fund\nMail to: P.O. Box 519, Braselton, GA 30517";
|
||||
navigator.clipboard.writeText(checkInfo).then(() => {
|
||||
btnCopyCheck.classList.add('copied');
|
||||
if (btnCopyText && translations[currentLang]) {
|
||||
btnCopyText.textContent = translations[currentLang]['giving.copied'] || 'Copied to Clipboard! ✓';
|
||||
}
|
||||
showToast(translations[currentLang]['giving.copied'] || 'Copied to Clipboard! ✓');
|
||||
setTimeout(() => {
|
||||
btnCopyCheck.classList.remove('copied');
|
||||
if (btnCopyText && translations[currentLang]) {
|
||||
btnCopyText.textContent = translations[currentLang]['giving.btn_copy'] || 'Copy Mailing Info to Clipboard';
|
||||
}
|
||||
}, 3000);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Interactive Impact Metric Cards
|
||||
const impactMetricCards = document.querySelectorAll('.impact-metric-card');
|
||||
impactMetricCards.forEach(card => {
|
||||
card.addEventListener('click', () => {
|
||||
const amount = card.getAttribute('data-amount');
|
||||
if (amount) {
|
||||
updateTierDisplay(amount);
|
||||
const targetChip = document.querySelector(`.tier-chip[data-amount="${amount}"]`);
|
||||
if (targetChip) {
|
||||
document.querySelectorAll('.tier-chip').forEach(c => c.classList.remove('active'));
|
||||
targetChip.classList.add('active');
|
||||
}
|
||||
openModal();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Native Mobile 1-Tap Share Button
|
||||
const btnShareHero = document.getElementById('btn-share-hero');
|
||||
if (btnShareHero) {
|
||||
btnShareHero.addEventListener('click', async (e) => {
|
||||
e.preventDefault();
|
||||
const shareData = {
|
||||
title: currentLang === 'es' ? 'Pastor Víctor Páez — Iglesia Bíblica Bautista Caracas' : 'Pastor Víctor Páez — Caracas, Venezuela Rebuilding Mission',
|
||||
text: currentLang === 'es' ? 'Apoye la reconstrucción y el ministerio del evangelio en Caracas, Venezuela.' : 'Preaching Christ, training pastors, and rebuilding hope in Caracas, Venezuela.',
|
||||
url: 'https://ibbcaracas.org/'
|
||||
};
|
||||
if (navigator.share) {
|
||||
try {
|
||||
await navigator.share(shareData);
|
||||
} catch (err) {
|
||||
// User closed share sheet
|
||||
}
|
||||
} else {
|
||||
navigator.clipboard.writeText('https://ibbcaracas.org/').then(() => {
|
||||
showToast(translations[currentLang]['share.copied'] || 'Website link copied to clipboard! ✓');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Sticky Rebuilding Progress Floating Pill
|
||||
const stickyPill = document.getElementById('sticky-rebuilding-pill');
|
||||
const stickyPillClose = document.getElementById('sticky-pill-close');
|
||||
let pillDismissed = false;
|
||||
|
||||
if (stickyPill) {
|
||||
window.addEventListener('scroll', () => {
|
||||
if (pillDismissed) return;
|
||||
if (window.scrollY > 500) {
|
||||
stickyPill.classList.add('visible');
|
||||
} else {
|
||||
stickyPill.classList.remove('visible');
|
||||
}
|
||||
}, { passive: true });
|
||||
|
||||
if (stickyPillClose) {
|
||||
stickyPillClose.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
pillDismissed = true;
|
||||
stickyPill.classList.remove('visible');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Initial Language Load
|
||||
setLanguage(currentLang);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user