feat: add stickiness round — daily Sadaqah tracker + Family Tree social loop
Two features scoped from the stickiness brainstorm, sharing one digest notification pipeline: Sadaqah tracker (new tab): a private daily giving journal, not a payment processor — the app logs, it never moves money. Streak tracking follows the proven pattern from dedicated apps (Sidq, Daily Sadaqa). Family visibility is strictly limited to streak counts via a SECURITY DEFINER RPC (nf_family_sadaqah_streaks) — amounts, causes, and notes never cross the member boundary, respecting the Islamic preference for giving privately. Entries can be dedicated 'in memory of' a deceased person from the Family Tree, with a memorial count (nf_memorial_sadaqah_count, count only) surfacing on that person's card. Family Tree social loop: a 'give sadaqah in memory of' link on every deceased person's card (cross-tab jump via a small requestedTab store in nav.js), plus completeness hints (missing birth date, missing photo, no relationships linked) feeding directly into the existing Coverage Dashboard recommendations engine rather than a new UI surface. Daily digest Edge Function + pg_cron (07:00 UTC): batches into one email per family member per day, sent only when there's real content — tree activity in the last 24h, a birthday/death-anniversary today, or a weekly sadaqah recap on Sundays. An empty day sends nothing, deliberately avoiding the notification-spam failure mode the research flagged. Protected by a shared secret header since it's cron-invoked, not user-triggered. Verified with a live manual invocation before relying on the schedule. Found and fixed two real bugs in nf_family_sadaqah_streaks during E2E testing: an ambiguous unqualified 'member_id' column reference colliding with the function's OUT parameter (42702), and a bigint/int type mismatch from count(*) (42804) — both would have 400'd on every call in production. Covered by e2e-sadaqah-tree.cjs (12/12). Full regression: 280/280 across all suites.
This commit is contained in:
+21
-12
@@ -13,6 +13,7 @@
|
||||
import InfoPanel from './lib/InfoPanel.svelte';
|
||||
import { session, authLoading, signOut } from './lib/auth.js';
|
||||
import { activeFamilyId, listMyFamilies } from './lib/family.js';
|
||||
import { requestedTab } from './lib/nav.js';
|
||||
import AuthScreen from './lib/AuthScreen.svelte';
|
||||
import FamilySwitcher from './lib/FamilySwitcher.svelte';
|
||||
import FamilyManagement from './lib/FamilyManagement.svelte';
|
||||
@@ -21,6 +22,7 @@
|
||||
import InsurancePolicies from './lib/InsurancePolicies.svelte';
|
||||
import ZakatCalculator from './lib/ZakatCalculator.svelte';
|
||||
import JurisdictionSetting from './lib/JurisdictionSetting.svelte';
|
||||
import SadaqahTracker from './lib/SadaqahTracker.svelte';
|
||||
|
||||
let currentLang = $state('en');
|
||||
lang.subscribe(v => currentLang = v);
|
||||
@@ -44,9 +46,15 @@
|
||||
}
|
||||
});
|
||||
|
||||
const tabs = ['Coverage', 'Faraid', 'Assets', 'Insurance', 'Zakat', 'Wassiyah', 'Hibah', 'Family Waqf', 'Nominate', 'Trigger', 'Mutawalli', 'Tree', 'Claims (H2)', 'Family', 'Settings'];
|
||||
const icons = ['🎯', '📊', '📁', '🛡️', '🌙', '📜', '🎁', '⛲', '📇', '⚡', '🕋', '🌳', '🔗', '👥', '⚙️'];
|
||||
const tabs = ['Coverage', 'Faraid', 'Assets', 'Insurance', 'Zakat', 'Sadaqah', 'Wassiyah', 'Hibah', 'Family Waqf', 'Nominate', 'Trigger', 'Mutawalli', 'Tree', 'Claims (H2)', 'Family', 'Settings'];
|
||||
const icons = ['🎯', '📊', '📁', '🛡️', '🌙', '🤲', '📜', '🎁', '⛲', '📇', '⚡', '🕋', '🌳', '🔗', '👥', '⚙️'];
|
||||
let activeTab = $state(0);
|
||||
requestedTab.subscribe(name => {
|
||||
if (!name) return;
|
||||
const idx = tabs.indexOf(name);
|
||||
if (idx >= 0) activeTab = idx;
|
||||
requestedTab.set(null);
|
||||
});
|
||||
|
||||
function handleKeydown(e) {
|
||||
if (e.key === 'ArrowRight') activeTab = (activeTab + 1) % tabs.length;
|
||||
@@ -104,16 +112,17 @@
|
||||
{:else if activeTab === 2}<AssetRegistry />
|
||||
{:else if activeTab === 3}<InsurancePolicies />
|
||||
{:else if activeTab === 4}<ZakatCalculator />
|
||||
{:else if activeTab === 5}<WassiyahGenerator />
|
||||
{:else if activeTab === 6}<HibahTracker />
|
||||
{:else if activeTab === 7}<FamilyWaqfDesignator />
|
||||
{:else if activeTab === 8}<NominationRegistry />
|
||||
{:else if activeTab === 9}<DeathTrigger />
|
||||
{:else if activeTab === 10}<MutawalliDashboard />
|
||||
{:else if activeTab === 11}<FamilyTree />
|
||||
{:else if activeTab === 12}<DigitalClaims />
|
||||
{:else if activeTab === 13}<FamilyManagement />
|
||||
{:else if activeTab === 14}
|
||||
{:else if activeTab === 5}<SadaqahTracker />
|
||||
{:else if activeTab === 6}<WassiyahGenerator />
|
||||
{:else if activeTab === 7}<HibahTracker />
|
||||
{:else if activeTab === 8}<FamilyWaqfDesignator />
|
||||
{:else if activeTab === 9}<NominationRegistry />
|
||||
{:else if activeTab === 10}<DeathTrigger />
|
||||
{:else if activeTab === 11}<MutawalliDashboard />
|
||||
{:else if activeTab === 12}<FamilyTree />
|
||||
{:else if activeTab === 13}<DigitalClaims />
|
||||
{:else if activeTab === 14}<FamilyManagement />
|
||||
{:else if activeTab === 15}
|
||||
<div class="module">
|
||||
<div class="module-header">
|
||||
<h2>Settings</h2>
|
||||
|
||||
Reference in New Issue
Block a user