diff --git a/astro-church-website/public/icons/app-icon.svg b/astro-church-website/public/icons/app-icon.svg new file mode 100644 index 0000000..9828bfc --- /dev/null +++ b/astro-church-website/public/icons/app-icon.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/astro-church-website/public/manifest.json b/astro-church-website/public/manifest.json new file mode 100644 index 0000000..e61e935 --- /dev/null +++ b/astro-church-website/public/manifest.json @@ -0,0 +1,63 @@ +{ + "name": "Rockville Tolland SDA Church", + "short_name": "RTSDA Church", + "description": "Official website and app for Rockville Tolland Seventh-day Adventist Church", + "start_url": "/", + "display": "standalone", + "background_color": "#1a1a1a", + "theme_color": "#d4af37", + "orientation": "portrait-primary", + "categories": ["religion", "lifestyle", "education"], + "lang": "en-US", + "scope": "/", + "icons": [ + { + "src": "/favicon.svg", + "sizes": "72x72", + "type": "image/svg+xml", + "purpose": "any" + }, + { + "src": "/favicon.svg", + "sizes": "96x96", + "type": "image/svg+xml", + "purpose": "any" + }, + { + "src": "/favicon.svg", + "sizes": "128x128", + "type": "image/svg+xml", + "purpose": "any" + }, + { + "src": "/favicon.svg", + "sizes": "144x144", + "type": "image/svg+xml", + "purpose": "any" + }, + { + "src": "/favicon.svg", + "sizes": "152x152", + "type": "image/svg+xml", + "purpose": "any" + }, + { + "src": "/favicon.svg", + "sizes": "192x192", + "type": "image/svg+xml", + "purpose": "any maskable" + }, + { + "src": "/favicon.svg", + "sizes": "384x384", + "type": "image/svg+xml", + "purpose": "any" + }, + { + "src": "/favicon.svg", + "sizes": "512x512", + "type": "image/svg+xml", + "purpose": "any maskable" + } + ] +} \ No newline at end of file diff --git a/astro-church-website/public/sw.js b/astro-church-website/public/sw.js new file mode 100644 index 0000000..2939e13 --- /dev/null +++ b/astro-church-website/public/sw.js @@ -0,0 +1,43 @@ +const CACHE_NAME = 'rtsda-church-v1'; +const urlsToCache = [ + '/', + '/about', + '/contact', + '/sermons', + '/events', + '/live', + '/manifest.json' +]; + +self.addEventListener('install', (event) => { + event.waitUntil( + caches.open(CACHE_NAME) + .then((cache) => { + return cache.addAll(urlsToCache); + }) + ); +}); + +self.addEventListener('fetch', (event) => { + event.respondWith( + caches.match(event.request) + .then((response) => { + // Return cached version or fetch from network + return response || fetch(event.request); + }) + ); +}); + +self.addEventListener('activate', (event) => { + event.waitUntil( + caches.keys().then((cacheNames) => { + return Promise.all( + cacheNames.map((cacheName) => { + if (cacheName !== CACHE_NAME) { + return caches.delete(cacheName); + } + }) + ); + }) + ); +}); \ No newline at end of file diff --git a/astro-church-website/src/components/Footer.astro b/astro-church-website/src/components/Footer.astro index 9497b12..d4ca144 100644 --- a/astro-church-website/src/components/Footer.astro +++ b/astro-church-website/src/components/Footer.astro @@ -149,7 +149,11 @@ const currentYear = new Date().getFullYear(); {address && (
- {address} +
+ {address.split('\n').map(line => ( +
{line}
+ ))} +
)} {phone && ( @@ -222,17 +226,15 @@ const currentYear = new Date().getFullYear(); - - @@ -279,8 +281,71 @@ const currentYear = new Date().getFullYear(); \ No newline at end of file diff --git a/astro-church-website/src/layouts/BaseLayout.astro b/astro-church-website/src/layouts/BaseLayout.astro index b62db4a..ad1957c 100644 --- a/astro-church-website/src/layouts/BaseLayout.astro +++ b/astro-church-website/src/layouts/BaseLayout.astro @@ -16,6 +16,29 @@ const { title, description = 'Proclaiming the Three Angels\' Message with love a {title} + + + + + + + + + + + + + + + + + + + + + + + @@ -117,6 +140,19 @@ const { title, description = 'Proclaiming the Three Angels\' Message with love a document.querySelectorAll('[data-animate]').forEach(el => { observer.observe(el); }); + + // Register Service Worker for PWA + if ('serviceWorker' in navigator) { + window.addEventListener('load', () => { + navigator.serviceWorker.register('/sw.js') + .then((registration) => { + console.log('SW registered: ', registration); + }) + .catch((registrationError) => { + console.log('SW registration failed: ', registrationError); + }); + }); + } }); diff --git a/astro-church-website/src/pages/contact.astro b/astro-church-website/src/pages/contact.astro index 6f9c497..3dec930 100644 --- a/astro-church-website/src/pages/contact.astro +++ b/astro-church-website/src/pages/contact.astro @@ -18,6 +18,7 @@ try { address = getChurchAddress(); phone = getContactPhone(); + // Get the base email from church-core and make it dynamic based on current domain const baseEmail = getContactEmail(); const currentUrl = Astro.url.hostname; @@ -152,7 +153,11 @@ try {

Visit Us

-

{address}

+
+ {address.split('\n').map(line => ( +

{line}

+ ))} +
)} diff --git a/church-core/src/uniffi_wrapper.rs b/church-core/src/uniffi_wrapper.rs index 6dc5a1a..de830bb 100644 --- a/church-core/src/uniffi_wrapper.rs +++ b/church-core/src/uniffi_wrapper.rs @@ -893,11 +893,31 @@ pub fn get_donation_url() -> String { .unwrap_or_else(|| "https://adventistgiving.org/donate/ANRTOL".to_string()) } -/// Get church address with fallback +/// Get church address with fallback - includes PO BOX if available pub fn get_church_address() -> String { - get_cached_config() - .and_then(|config| config.church_address) - .unwrap_or_else(|| "115 Snipsic Lake Road, Tolland, CT 06084".to_string()) + // Get the raw config JSON and parse it directly + let config_json = fetch_config_json(); + + if let Ok(config_value) = serde_json::from_str::(&config_json) { + let mut address_lines = Vec::new(); + + // Add physical address if available + if let Some(church_address) = config_value.get("church_address").and_then(|v| v.as_str()) { + address_lines.push(church_address.to_string()); + } + + // Add PO BOX as second line if available + if let Some(po_box) = config_value.get("po_box").and_then(|v| v.as_str()) { + address_lines.push(po_box.to_string()); + } + + if !address_lines.is_empty() { + return address_lines.join("\n"); + } + } + + // Fallback if no config available + "9 Hartford Tpke Tolland CT 06084".to_string() } /// Get coordinates from config coordinates object or return empty vector