Tiered goals: ordered milestones with unlocks, tier-aware goal bar, TIER UNLOCKED alerts, next-unlock line
- Tiers\TierPolicy (pure), TierRepository (atomic reached marking), Tiers\Recorder hooked before close-at-target - Admin tiers screen; goal target derived from the final tier - Overlay goal widget shows Tier N of M and fills within the tier; alert pill; donate form 'Next unlock' - Installer DB_VERSION 4 (sg_goal_tiers) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
39840a20d7
commit
4c379a0245
20 files changed
+1089
-14
No files matched your search
@@ -31,7 +31,8 @@ final class OverlayService {
|
||||
$gid = $goal ? (int) $goal['id'] : 0;
|
||||
switch ( $widget ) {
|
||||
case 'goal':
|
||||
return Payloads::goal( $goal, $goal ? $this->source->raisedMinor( $goal ) : 0 );
|
||||
$tiers = ( $gid && $this->source instanceof TiersSource ) ? $this->source->tiersFor( $gid ) : array();
|
||||
return Payloads::goal( $goal, $goal ? $this->source->raisedMinor( $goal ) : 0, $tiers ?: null );
|
||||
case 'timer':
|
||||
return Payloads::timer(
|
||||
$gid ? $this->source->stateValue( $gid, 'timer_ends_at' ) : null,
|
||||
@@ -55,9 +56,11 @@ final class OverlayService {
|
||||
$ids = array_values( array_filter( array_map( static fn( $r ) => (int) ( $r['id'] ?? 0 ), $rows ) ) );
|
||||
$bonuses = ( ( $recent || null !== $since ) && $ids ) ? $this->source->bonusesFor( $ids ) : array();
|
||||
$actions = ( ( $recent || null !== $since ) && $ids && $this->source instanceof ActionsSource ) ? $this->source->actionsFor( $ids ) : array();
|
||||
$tiers = ( ( $recent || null !== $since ) && $ids && $this->source instanceof TiersSource ) ? $this->source->tiersReachedFor( $ids ) : array();
|
||||
foreach ( $rows as $i => $r ) {
|
||||
$rows[ $i ]['bonuses'] = $bonuses[ (int) ( $r['id'] ?? 0 ) ] ?? array();
|
||||
$rows[ $i ]['actions'] = $actions[ (int) ( $r['id'] ?? 0 ) ] ?? array();
|
||||
$rows[ $i ]['tiers'] = $tiers[ (int) ( $r['id'] ?? 0 ) ] ?? array();
|
||||
}
|
||||
$mediaFor = null;
|
||||
$defs = ( $recent || null !== $since ) ? $this->defs() : array();
|
||||
|
||||
Reference in new issue
Block a user