- if @game.in_progress? && @game.can_be_modified_by?(current_user)
.flex.flex-col
.card.warning
.card-title Game in progress.
%p
This game is currently in progress.
%br/
If the game is finished but the data could not be synced for whatever reason, you can now manually end it.
= link_to "Complete game", edit_game_path(@game), class: "button inline-block mt-2"
.flex.flex-row.w-full.max-w-screen-xl.w-full.mx-auto.mt-6.px-3.md:px-0.justify-between
.flex.flex-col
.font-normal.text-3xl.pb-2=@game.playgroup.name
.flex.flex-col.md:flex-row.gap-x-2
- if @game.events.any?
.flex
%span Game started on:
%span= l @game.started_at, format: :custom
- if @game.is_finished?
.flex.md:border-l.border-pg_secondary.md:pl-2
%span Game ended on: 
%span= l @game.ended_at, format: :custom
-if @game.is_finished?
.flex.md:border-l.border-pg_secondary.md:pl-2
%span Total duration: 
%span=distance_of_time_in_words(@game.duration)
.flex.md:border-l.border-pg_secondary.md:pl-2
%span Total number of rounds: 
%span= @game.latest_round
=link_to "Game Log", timeline_playgroup_game_path(@game.playgroup, @game), class: "button w-fit h-fit self-end text-center"
.flex.flex-col.gap-6.w-full.max-w-screen-xl.mx-auto.px-3.md:p-0.mt-6
- if @game.participations.count == 3 || @game.participations.count >=5
.flex.flex-col.md:grid.grid-cols-3.gap-6.h-fit.w-full
- else
.flex.flex-col.md:flex-row.gap-6.h-fit.w-full
- @game.participations.each_with_index do |p, i|
.card.h-fit.bg-left-top.w-full{:style => "background-image: linear-gradient(to right, rgba(42, 45, 49, 0.8) 100%, rgba(24, 27, 42, 0)), url('#{p.deck.commander.art_crop_url}'); background-repeat: no-repeat; background-size:cover;"}
.card-title.uppercase= p.deck.user.username
.font-oswald.uppercase.text-pg_red.text-lg.font-bold= p.deck.name.capitalize
.font-oswald.text-gray-500= p.deck.commander.artist
.grid.grid-flow-cols.grid-cols-3.my-0.lg:my-3.gap-x-0.max-w-fit.h-14
/ ranking pg_p<haml_loud> i+1</haml_loud>
-if !@game.in_progress?
.grid.grid-flow-col.grid-rows-2.items-center.gap-x-3
%span.row-span-2
%i{:class => "fa-solid fa-2xl #{arrow_class(p.deck)}"}
%span.-mb-3.text-xs.text-pg_lightgraytext.w-20 Ranking
%span.-mt-3= p.deck.current_ranking_for_game(@game)
/ winner / killed by
- if p.winner?
.flex.flex-row.items-center.space-x-2
%span
%i.fa-solid.fa-crown.fa-2xl.text-gold
%span Winner
- if p.who_killed_me.present?
.grid.grid-flow-col.grid-rows-2.items-center.w-fit.gap-x-3
%span.row-span-2
%i.fa-solid.fa-skull.fa-2xl
%span.-mb-3.text-xs.text-pg_lightgraytext Killed by
%span.-mt-3= p.who_killed_me.deck.user.username
.md:grid.hidden.grid-flow-cols.grid-cols-2.grid-rows-2.gap-y-3.gap-x-3.max-w-fit
.flex.flex-col.h-fit.p-2.bg-gradient-to-r.border-l-8.border-pg_primary{:class => "from-pg_primary/25"}
%span.text-xs.text-pg_lightgraytext Total Damage
%span.font-bold= p.all_damage_done
.flex.flex-col.h-fit.p-2.bg-gradient-to-r.border-l-8.border-pg_primary{:class => "from-pg_p1/25"}
%span.text-xs.text-pg_lightgraytext Healing Done
%span.font-bold= p.total_damage_done(:healing)
.flex.flex-col.h-fit.p-2.bg-gradient-to-r.border-l-8.border-pg_primary{:class => "from-pg_p1/25"}
%span.text-xs.text-pg_lightgraytext Avg. Turn
%span.font-bold= distance_of_time_in_words p.average_time_in_seconds
.flex.flex-col.h-fit.p-2.bg-gradient-to-r.border-l-8.border-pg_primary{:class => "from-pg_primary/25"}
%span.text-xs.text-pg_lightgraytext Time Played
%span.font-bold= distance_of_time_in_words p.total_time_in_seconds
.flex
.card.bg-pg_gray2
.card-title STATISTICS
%ul#myTab.flex.mb-6.mt-2.space-x-1{"data-tabs-toggle" => "#matrix-tables", :role => "tablist"}
%li{:role => "presentation"}
%button#total-tab.buttonsmall{"data-tabs-target" => "#total", :role => "tab", :type => "button"} Total Damage
%li{:role => "presentation"}
%button#commander-tab.buttonsmall{"data-tabs-target" => "#commander", :role => "tab", :type => "button"} CMDR Damage
%li{:role => "presentation"}
%button#healing-tab.buttonsmall{"data-tabs-target" => "#healing", :role => "tab", :type => "button"} Healing
%li{:role => "presentation"}
%button#healing-tab.buttonsmall{"data-tabs-target" => "#poison", :role => "tab", :type => "button"} Poison
#matrix-tables
#total
%table.default-table
%tr
%th
- @game.participations.each do |p|
%th.uppercase.text-xs= p.user.username
- @game.participations.each do |p|
%tr
%th.uppercase.text-xs.flex.flex-row.space-x-3.items-center
= image_tag p.deck.commander.art_crop_url, class: "object-cover h-16 w-16 rounded-full opacity-75 border-2"
%span
= p.user.username
- @game.participation_ids.each do |id|
=damage_column(p, id, [:commander, :normal, :poison])
#commander
%table.default-table
%tr
%th
- @game.participations.each do |p|
%th.uppercase.text-xs= p.user.username
- @game.participations.each do |p|
%tr
%th.uppercase.text-xs.flex.flex-row.space-x-3.items-center
= image_tag p.deck.commander.art_crop_url, class: "object-cover h-16 w-16 rounded-full opacity-75 border-2"
%span= p.user.username
- @game.participation_ids.each do |id|
=damage_column(p, id,:commander)
#healing
%table.default-table
%tr
%th
- @game.participations.each do |p|
%th.uppercase.text-xs= p.user.username
- @game.participations.each do |p|
%tr
%th.uppercase.text-xs.flex.flex-row.space-x-3.items-center
= image_tag p.deck.commander.art_crop_url, class: "object-cover h-16 w-16 rounded-full opacity-75 border-2"
%span= p.user.username
- @game.participation_ids.each do |id|
=damage_column(p, id,:healing)
#poison
%table.default-table
%tr
%th
- @game.participations.each do |p|
%th.uppercase.text-xs= p.user.username
- @game.participations.each do |p|
%tr
%th.uppercase.text-xs.flex.flex-row.space-x-3.items-center
= image_tag p.deck.commander.art_crop_url, class: "object-cover h-16 w-16 rounded-full opacity-75 border-2"
%span= p.user.username
- @game.participation_ids.each do |id|
=damage_column(p, id,:poison)
.flex.flex-col.gap-y-3{:class => "lg:w-2/5"}
.card.space-y-2.max-h-fit.w-full
.card-title MATCH HIGHLIGHTS
.flex.flex-row.text-sm
.bg-gradient-to-tl.border-r-8.border-pg_lightblue.p-4.rounded-l-lg.font-medium{:class => "from-pg_lightblue/25 w-1/4"}
Most damage done
%br/
%br/
%i.fa-solid.fa-explosion.fa-2xl
.flex.flex-row.items-center.px-6.space-x-6.bg-gradient-to-r{:class => "w-3/4 from-pg_lightblue/25"}
.flex.flex-col.items-center
= image_tag @game.highest_total_damage_done.deck.commander.art_crop_url, class: "relative object-cover h-16 w-16 rounded-full"
%span.uppercase.text-xs.font-black= @game.highest_total_damage_done.deck.user.username
.text-center
dealt
%span.font-bold.text-lg= @game.highest_total_damage_done.all_damage_done
damage in total
- if @game.events.any? && @game.biggest_hit
.flex.flex-row.text-sm
.bg-gradient-to-tl.border-r-8.border-pg_lightblue.p-4.rounded-l-lg.font-medium{:class => "from-pg_lightblue/25 w-1/4"}
Biggest swing
%br/
%br/
%i.fa-solid.fa-explosion.fa-2xl
.flex.flex-row.items-center.px-6.space-x-6.bg-gradient-to-r{:class => "w-3/4 from-pg_lightblue/25"}
.flex.flex-col.items-center
= image_tag @game.biggest_hit.participation.deck.commander.art_crop_url, class: "relative object-cover h-16 w-16 rounded-full"
%span.uppercase.text-xs.font-black= @game.biggest_hit.participation.deck.user.username
.text-center
dealt
%span.font-bold.text-lg= @game.biggest_hit.amount
damage to
.flex.flex-col.items-center
= image_tag @game.biggest_hit.receiver.deck.commander.art_crop_url, class: "relative object-cover h-16 w-16 rounded-full"
%span.uppercase.text-xs.font-black= @game.biggest_hit.receiver.deck.user.username
- if @game.longest_turn.present?
.flex.flex-row.text-sm.grow
.bg-gradient-to-tl.border-r-8.border-pg_lightblue.p-4.rounded-l-lg.font-medium{:class => "from-pg_lightblue/25 w-1/4"}
Longest Turn
%br/
%br/
%i.fa-solid.fa-hourglass-half.fa-2xl
.flex.flex-row.items-center.px-6.space-x-6.bg-gradient-to-r{:class => "w-3/4 from-pg_lightblue/25"}
.flex.flex-col.items-center
= image_tag @game.longest_turn.participation.deck.commander.art_crop_url, class: "relative object-cover h-16 w-16 rounded-full"
%span.uppercase.text-xs.font-black= @game.longest_turn.participation.deck.user.username
.text-center
spent
%span.font-bold.text-lg
= distance_of_time_in_words(@game.longest_turn.duration)
on one turn
.card
.card-title DAMAGE GRAPH
.p-2
= bar_chart @game.participations.order(deck_id: :asc).collect{|x| [x.deck.name, x.all_damage_done ] }, colors: ["#FF4655"], download: true, adapter: "chartjs"
.card
.card-title HEALING GRAPH
.p-2
= bar_chart @game.participations.order(deck_id: :asc).collect{|x| [x.deck.name, x.total_damage_done(:healing) ] }, colors: ["#FF4655"], download: true, adapter: "chartjs"
- if @game.round_times.any?
.card
.card-title Round timing
.p-2
= line_chart @game.round_times_for_chart, colors: ["#2490B2","#57DDC4","#FF4655","#222A5C"]
- if @game.events.any?
.card
.card-title Damage per turn
= column_chart @game.damage_per_turn_for_chart, colors: ["#2490B2","#57DDC4","#FF4655","#222A5C"]