Add donation actions (rewards): menu editor + queue, donate-form buttons, overlay menu widget, alert lines
- Actions\Matcher (exact / every), ActionRepository, Recorder (idempotent via unique key) - Admin: Rewards screen with live preview, queue with Mark done, menu badge - Donate form shows actions as payment buttons; overlay 'actions' widget; alerts list triggered actions - Installer DB_VERSION 2 (sg_actions, sg_action_events) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c62ac06b27
commit
b0b5012698
25 files changed
+1227
-7
No files matched your search
@@ -6,7 +6,7 @@ namespace StreamGoals\Overlay;
|
||||
/** Maps a widget name to its payload using a data source. */
|
||||
final class OverlayService {
|
||||
|
||||
public const WIDGETS = array( 'goal', 'timer', 'counter', 'alerts' );
|
||||
public const WIDGETS = array( 'goal', 'timer', 'counter', 'alerts', 'actions' );
|
||||
|
||||
public function __construct( private OverlayDataSource $source ) {}
|
||||
|
||||
@@ -38,10 +38,15 @@ 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();
|
||||
foreach ( $rows as $i => $r ) {
|
||||
$rows[ $i ]['bonuses'] = $bonuses[ (int) ( $r['id'] ?? 0 ) ] ?? array();
|
||||
$rows[ $i ]['actions'] = $actions[ (int) ( $r['id'] ?? 0 ) ] ?? array();
|
||||
}
|
||||
return Payloads::alerts( $rows, $since, $recent ? 20 : 10, $recent );
|
||||
case 'actions':
|
||||
$rows = ( $gid && $this->source instanceof ActionsSource ) ? $this->source->menuActions( $gid ) : array();
|
||||
return Payloads::actionsMenu( $goal, $rows );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user