- if policy(@table).update?
  .owner-controls
    = link_to 'Edit', edit_table_path(@table)
    = link_to 'Destroy', game, :method => :delete, :data => { :confirm => 'Are you sure?' }

-# #table-component-container-container= react_component 'Table', props = {url: "#{table_path @table}"}, html_options = {id: "table-component-container"}
#table-component
  - unless current_user.soft_token == @game.controlling_player.try("soft_token")
    = javascript_include_tag 'table-loader'

  %p= @table.title

  - if @game.already_has?(current_user)
    - if @game.startable? 
      = button_to 'Start', start_game_path(@game)

    - if @game.winner_player_id || @game.nil?
      = button_to 'New Game', new_game_table_path(@table)

  -# .players
    %b Players:
    %ol
      - @game.players.each do |player|
        %li
          = player.display_name
          // Show the user which player they are
          = "Me" if player.soft_token == current_user.soft_token
          // Show whose turn it is
          - if @game.controlling_player_id
            %strong= "Taking Turn " if @game.controlling_player == player
        // Show the players' cards
        - if player.user == current_user && player.inventory.empty? == false
          -##inventory

  -# TODO better logic, not in view
  - unless @game.status == nil
    .table
      -# TODO better logic, not in view. Set play to beat = nil; instead of view logic
      -# - if @game.play_to_beat && @game.player_to_beat != @game.controlling_player
        - if @game.play_to_beat.play
          %h1
            Hand to beat
          %span.hand-type= @game.play_to_beat.play.hand_type
          %div= @game.play_to_beat.play.to_s
          - @game.play_to_beat.play.player_cards.each do |card|
            = card.to_s
          %span.player= @game.play_to_beat.play.player.display_name
      -# - else
        %h1 Open table

  #game-component
    - if @game.winner_player_id
      %h1= @game.status

    #playerList
      #top
        = render "seat", seat: @seats[0]
      #mid
        = render "seat", seat: @seats[1]

        = render "play_to_beat"

        = render "seat", seat: @seats[2]

      #bot
        = render "seat", seat: @seats[3]
