// Button Box Tile // Purpose: Defines the Button Box Tile module and the local helpers/components used in this file. // Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. export default function ButtonBoxTile({ buttonId, count, goal, rewardNumber, rewardName, rewardDescription, dailyCount, dailyLimit, limited = false, className = '', }) { /* The server owns the actual cap decision, but the tile still derives a display-only "limit reached" state so normal session snapshots and immediate capped press toasts render the same daily status text. */ const hasDailyLimit = Number.isFinite(dailyLimit) && dailyLimit > 0; const safeDailyCount = Number.isFinite(dailyCount) ? dailyCount : 0; const limitReached = Boolean(limited) || (hasDailyLimit && safeDailyCount >= dailyLimit); const cleanDescription = typeof rewardDescription === 'string' && rewardDescription.trim() ? rewardDescription.trim() : null; return (

Button {buttonId}

{count} / {goal}

#{rewardNumber} {rewardName}

{cleanDescription ? (

{cleanDescription}

) : null} {hasDailyLimit ? (

{limitReached ? 'Daily limit reached' : `Today ${safeDailyCount} / ${dailyLimit}`}

) : null}
); }