Documentation Index
Fetch the complete documentation index at: https://grantmaster.dev/llms.txt
Use this file to discover all available pages before exploring further.
Engineering reference: For service contracts, EventBus events, and data-layer details see src/features/mission/mission.md.
Mission
Overview
The mission feature combines two distinct sub-concerns:
-
Mission Alignment — tools for defining organizational mission pillars, measuring strategic alignment of projects/grants against those pillars, and visualizing coverage via a radar chart.
-
Gamification & Referral Credits — a peer referral program where users earn credits for inviting others to the platform, can redeem credits, and can track their activity history. Credits are transacted via
CreditTransaction records through ReferralCreditService.
Entry point: MissionPage with tabs for alignment, gamification, referrals, and credit redemption.
Data Model
Firestore Collections
| Collection | Document type | Description |
|---|
creditTransactions | CreditTransaction | Ledger of credit earned/redeemed per user |
missionPillars | MissionPillar | Org-defined strategic pillars (configured in Settings) |
Referral and partner data is managed via shared/partnerships/ReferralCreditService and shared/partnerships/PartnerService.
Key TypeScript Types
// Credit transaction record
interface CreditTransaction {
id: string;
userId: string;
organizationId: string;
type: 'earned' | 'redeemed';
amount: number;
description: string;
balanceBefore: number;
balanceAfter: number;
createdAt: string;
}
// Filter for activity history
type ActivityHistoryFilterType = 'all' | 'earned' | 'redeemed';
MissionPillar types (name, description, weight) are defined in the shared types and managed via settings/MissionPillarsSettings.
Key Behaviors
Mission Alignment Radar
MissionAlignmentRadar renders a radar/spider chart showing how the organization’s current projects and grants score against each mission pillar. Configuration targets can be set via ConfigureTargetsDialog. MissionAnalytics provides supporting metric cards.
Peer Referral Program
Users invite peers using a unique referral link or by sharing directly. When a referred user signs up and activates, the referrer earns credits. ReferPeersTab provides the sharing interface. ReferralDashboard and ReferralOverviewTab show referral progress and conversion metrics.
Credit Activity History
useActivityHistoryState loads all credit transactions for the current user from ReferralCreditService.getTransactionHistory(userId). Transactions can be filtered by type (all | earned | redeemed) and exported to CSV (headers: Date, Type, Description, Amount, Balance Before, Balance After).
Credit Redemption
RedeemCreditsTab allows users to redeem earned credits for platform benefits (e.g., AI credit top-ups, subscription discounts). Redemption is processed through ReferralCreditService.
Share Impact
ShareImpactModal allows users to generate a shareable impact summary card based on their project contributions and M&E indicator results.
Service Contract
No service files within the feature directory. Logic delegates to shared services.
| Hook/Component | Owns | Key interface |
|---|
useActivityHistoryState | Credit transaction loading and filtering | transactions, filteredTransactions, filter, setFilter, exportToCSV |
| Shared service | Location | Methods used |
|---|
ReferralCreditService | src/shared/partnerships/ | getTransactionHistory(userId) |
PartnerService | src/shared/partnerships/ | Referral analytics and partner metrics |
Events
Emitted
None directly. Credit transactions are written by ReferralCreditService which may emit CREDITS_CONSUMED or CREDITS_PURCHASED events (see billing feature events).
Consumed
None.
Dependencies
Depends on:
shared/partnerships/ReferralCreditService — credit transaction history and redemption
shared/partnerships/PartnerService — referral and partner analytics
features/settings — MissionPillarsSettings (for configuring pillar definitions)
features/impact — M&E data for impact sharing
Depended on by: None — terminal feature.
File Structure
mission/
├── components/
│ ├── ConfigureTargetsDialog.tsx # Set alignment targets per pillar
│ ├── MissionAlignmentRadar.tsx # Radar chart visualization
│ ├── MissionAnalytics.tsx # Supporting metric cards
│ ├── MissionPillarCard.tsx # Single pillar card
│ └── pages/
│ ├── ActivityHistoryTab.tsx # Credit transaction history
│ ├── GamificationTab.tsx # Achievements and badges
│ ├── MissionPage.tsx # Top-level page with tabs
│ ├── RedeemCreditsTab.tsx # Credit redemption UI
│ ├── ReferPeersTab.tsx # Referral link sharing
│ ├── ReferralDashboard.tsx # Referral stats overview
│ ├── ReferralOverviewTab.tsx # Referral conversion metrics
│ └── ShareImpactModal.tsx # Shareable impact card
├── hooks/
│ └── useActivityHistoryState.ts # Credit history state and CSV export
└── index.ts