Skip to content

Commit

Permalink
Merge pull request #6561 from magnusrk-ch/autopass_button
Browse files Browse the repository at this point in the history
Add "Auto pass" button in stock rounds.
  • Loading branch information
tobymao authored Dec 5, 2021
2 parents c2584d3 + 708d5a9 commit 39d8306
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
5 changes: 4 additions & 1 deletion assets/app/view/game/pass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ class Pass < Snabberb::Component

def render
children = []
children << h(PassButton, before_process_pass: @before_process_pass) if @actions.include?('pass')
if @actions.include?('pass')
children << h(PassButton, before_process_pass: @before_process_pass)
children << h(PassAutoButton) if @game.round.stock? && @game.active_players_id.index(@user['id'])
end
h(:div, children.compact)
end
end
Expand Down
23 changes: 23 additions & 0 deletions assets/app/view/game/pass_auto_button.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

require 'view/game/actionable'

module View
module Game
class PassAutoButton < Snabberb::Component
include Actionable

def render
props = {
on: {
click: lambda do
process_action(Engine::Action::ProgramSharePass.new(@game.current_entity))
end,
},
}

h(:button, props, 'Auto pass')
end
end
end
end

0 comments on commit 39d8306

Please sign in to comment.