Render a crowd-funded pool panel -- generic shape for any "escrowed funding with a target, deadline, and refund fallback" mechanism.
Use cases:
The structural pattern is universal:
Three lifecycle states swap the primary CTA:
Open -- collecting pledges, deadline ahead.Funded -- target reached, awaiting release.Closed -- released (with deliverable URL) or expired (refunds).The panel title, status pill copy, CTA verbs, and disclaimer are all
configurable via Labels so the panel can speak in the
voice of whichever mechanism the caller is exposing.
Web3.Ui.FundingPool.view []
{ pool =
Web3.Ui.FundingPool.pool
{ target = "25.0"
, balance = "14.75"
, unit = "PLS"
, deadline = "6 days"
, pledgerCount = 47
, topPledgers = [ { label = "alice.eth", amount = "2.5" } ]
, status = Open
, reportUrl = Nothing
}
, labels = Web3.Ui.FundingPool.defaultLabels
, onPledge = Just PledgeStandard
, onPledgeCustom = Just PledgeCustom
, onRefund = Nothing
, onViewReport = Nothing
}Stateless -- caller owns the Pool and emits the appropriate msg.
CSS classes follow BEM: web3-funding-pool,
web3-funding-pool__head, web3-funding-pool__title,
web3-funding-pool__subtitle, web3-funding-pool__stats,
web3-funding-pool__stat, web3-funding-pool__stat-label,
web3-funding-pool__stat-value, web3-funding-pool__progress,
web3-funding-pool__progress-fill, web3-funding-pool__pledgers,
web3-funding-pool__pledger, web3-funding-pool__actions,
web3-funding-pool__cta,
web3-funding-pool__cta--primary / --secondary,
web3-funding-pool__report, web3-funding-pool__disclaimer.
Configuration for view. Each onXxx is optional -- pass Nothing
to disable that affordance.
The pool's current observable state. Values are pre-formatted strings because amount/unit/precision is the caller's concern -- this primitive is rendering, not arithmetic.
One pledger row in the "top pledgers" list.
A pool's lifecycle state.
Configurable strings rendered inside the panel. Override per pool mechanism: an audit pool reads "Community-funded audit" / "Pledge" / "View audit report"; a feature-funding pool reads "Community-funded feature" / "Back" / "View deliverable".
statusLabels maps each Status to its status-pill text.
Generic defaults. Caller overrides any field with mechanism-specific copy (e.g. forge.intrepiddev uses audit-pool framing on top of this).
Construct a Pool. Progress is derived from target+balance by parsing both
decimal strings into scaled integers and dividing in BigInt space, so a pool
denominated in wei-sized numbers is placed as accurately as one denominated in
whole units. Unparseable input reads as 0. The result clamps to [0, 100].
Render the panel.