Files

105 lines
4.9 KiB
ERB

<% content_for :title, t("club.dashboard.title", name: @club.name) %>
<% content_for :robots, "noindex, nofollow" %>
<div class="wrap club-dashboard" style="padding-top:20px">
<header class="club-header" style="--club-primary:<%= @club.effective_primary_color %>;--club-secondary:<%= @club.effective_secondary_color %>">
<% if @club.effective_logo_url.present? %>
<%= image_tag @club.effective_logo_url, alt: "", class: "club-header-logo", width: 56, height: 56 %>
<% end %>
<div>
<h1><%= @club.name %></h1>
<% if @entitlements %>
<p class="club-meta">
<%= t("club.dashboard.plan_label") %> <strong><%= @entitlements.plan.name %></strong>
· <%= t("club.dashboard.teams_count_label") %> <strong><%= @teams.size %></strong>
</p>
<% end %>
</div>
</header>
<div style="display:flex;gap:12px;flex-wrap:wrap;margin:20px 0">
<%= link_to t("club.dashboard.edit_club"), public_edit_club_path(@club), class: "btn btn-secondary" %>
<%= link_to t("club.dashboard.subscription"), public_club_billing_path(@club), class: "btn btn-primary" %>
<%= link_to t("club.dashboard.new_team"), public_new_club_team_path(@club), class: "btn btn-secondary" %>
<% if Tournaments::Entitlements.new(@club).premium_full? %>
<%= link_to t("club.dashboard.tournaments"), public_club_tournaments_path(@club), class: "btn btn-secondary" %>
<% else %>
<%= link_to public_club_billing_path(@club), class: "btn btn-secondary btn-gated",
title: t("club.dashboard.tournaments_locked_hint") do %>
<%= t("club.dashboard.tournaments") %>
<span class="btn-gated__ribbon" aria-hidden="true"><%= t("club.dashboard.tournaments_full_badge") %></span>
<% end %>
<% end %>
<%= link_to t("club.dashboard.live_streams"), public_live_index_path(club_id: @club.id), class: "btn btn-secondary" %>
<% if @entitlements&.can_access_recordings? %>
<%= link_to t("club.dashboard.replay_archive"), public_club_recordings_path(@club), class: "btn btn-secondary" %>
<% end %>
</div>
<%= render "public/clubs/youtube",
club: @club,
entitlements: @entitlements,
entitlements_team: @entitlements_team %>
<% if @replay_stats %>
<h2><%= t("club.dashboard.replay_heading") %></h2>
<div class="card" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:16px;padding:16px;margin-bottom:24px">
<div>
<div style="font-size:1.6rem;font-weight:700"><%= @replay_stats[:available_count] %></div>
<div class="muted"><%= t("club.dashboard.available") %></div>
</div>
<div>
<div style="font-size:1.6rem;font-weight:700"><%= @replay_stats[:expiring_soon_count] %></div>
<div class="muted"><%= t("club.dashboard.expiring_soon") %></div>
</div>
<div>
<div style="font-size:1.6rem;font-weight:700"><%= number_to_human_size(@replay_stats[:total_bytes]) %></div>
<div class="muted"><%= t("club.dashboard.space_used") %></div>
</div>
<div>
<div style="font-size:1.6rem;font-weight:700"><%= @replay_stats[:total_views] %></div>
<div class="muted"><%= t("club.dashboard.views") %></div>
</div>
</div>
<% end %>
<h2><%= t("club.dashboard.teams_heading") %></h2>
<div class="card">
<% if @teams.any? %>
<table class="data">
<thead><tr><th><%= t("club.dashboard.team_col") %></th><th><%= t("club.dashboard.branding_col") %></th><th></th></tr></thead>
<tbody>
<% @teams.each do |team| %>
<tr>
<td>
<span class="team-swatch" style="background:<%= team.effective_primary_color %>"></span>
<strong><%= team.name %></strong>
</td>
<td style="color:#888;font-size:0.88rem">
<% if team.logo_url.present? || team.logo_file.attached? || team.primary_color.present? %>
<%= t("club.dashboard.branding_custom") %>
<% else %>
<%= t("club.dashboard.branding_inherited") %>
<% end %>
</td>
<td style="white-space:nowrap">
<%= link_to t("club.dashboard.public_page"), public_team_page_path(team.slug), target: "_blank", rel: "noopener" %>
·
<%= link_to t("club.dashboard.details"), public_team_details_path(team) %>
·
<%= link_to t("club.dashboard.matches"), public_team_matches_path(team) %>
·
<%= link_to t("club.dashboard.edit"), public_edit_team_path(team) %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p style="color:#888"><%= raw t("club.dashboard.no_teams_html", link: link_to(t("club.dashboard.add_first_team"), public_new_club_team_path(@club))) %></p>
<% end %>
</div>
<p style="color:#888;margin-top:24px"><%= t("club.dashboard.footer_note") %></p>
</div>