22 lines
874 B
JavaScript
22 lines
874 B
JavaScript
// Guidance presets for the contribution amount input.
|
|
// These are NOT tiers — just suggested amounts with matching guidance copy.
|
|
export const CONTRIBUTION_PRESETS = [
|
|
{ amount: 0, label: "I need support right now" },
|
|
{ amount: 5, label: "I can contribute" },
|
|
{ amount: 15, label: "I can sustain the community" },
|
|
{ amount: 30, label: "I can support others too" },
|
|
{ amount: 50, label: "I want to sponsor multiple members" },
|
|
]
|
|
|
|
export const requiresPayment = (amount) => amount > 0
|
|
|
|
export const isValidContributionAmount = (amount) =>
|
|
Number.isInteger(amount) && amount >= 0
|
|
|
|
export const getGuidanceLabel = (amount) => {
|
|
if (amount === null || amount === undefined) return null
|
|
const n = Number(amount)
|
|
if (!Number.isFinite(n) || n < 0) return null
|
|
const match = CONTRIBUTION_PRESETS.findLast(p => p.amount <= n)
|
|
return match?.label ?? null
|
|
}
|