diff --git a/assets/app/view/game/pass.rb b/assets/app/view/game/pass.rb index 20e8759ec1..44334a87d8 100644 --- a/assets/app/view/game/pass.rb +++ b/assets/app/view/game/pass.rb @@ -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 diff --git a/assets/app/view/game/pass_auto_button.rb b/assets/app/view/game/pass_auto_button.rb new file mode 100644 index 0000000000..02ea1cbfe2 --- /dev/null +++ b/assets/app/view/game/pass_auto_button.rb @@ -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