Files
eminuxandCursor b88f44ab1c Completa i18n IT/EN/FR/DE/ES su sito pubblico, area autenticata e admin.
Tutte le view marketing, legali, viewer, dashboard e admin usano t(); mailer utente-facing e flash localizzati; admin con LocaleResolver e selettore lingua.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 00:38:50 +02:00

176 lines
8.5 KiB
ERB

<% content_for :title, t("team_pages.show.title", team: @team.name, club: @club.name) %>
<% content_for :meta_description, team_page_meta_description(@team, @club) %>
<% content_for :canonical_url, seo_absolute_url(public_team_page_path(@team.slug)) %>
<% content_for :head do %>
<script type="application/ld+json">
<%= raw(team_page_structured_data(@team, @club).to_json) %>
</script>
<% end %>
<div class="wrap team-public-page">
<nav class="team-dashboard-nav" aria-label="Percorso">
<%= link_to t("team_pages.show.breadcrumb_all_teams"), public_team_pages_path, class: "team-dashboard-nav__club" %>
</nav>
<header class="roster-hero card team-public-hero" style="--club-primary:<%= @team.effective_primary_color %>;--club-secondary:<%= @team.effective_secondary_color %>">
<div class="roster-hero__intro">
<p class="roster-hero__club"><%= @club.name %></p>
<h1 class="roster-hero__title"><%= @team.name %></h1>
<p class="team-public-meta">
<%= @team.sport_label %>
<% if @live_sessions.any? %>
· <span class="hero-live-dot" aria-hidden="true"></span> <strong><%= t("team_pages.show.live_now_label") %></strong>
<% end %>
</p>
<% if @team.description.present? %>
<div class="roster-hero__desc"><%= simple_format @team.description %></div>
<% end %>
<div class="team-public-actions">
<% if @live_sessions.any? %>
<%= link_to t("team_pages.show.watch_live_link"), public_live_path(@live_sessions.first), class: "btn btn-primary" %>
<% end %>
<%= link_to t("team_pages.show.all_live_link"), public_live_index_path(club_id: @club.id), class: "btn btn-secondary" %>
<% if @recordings.any? %>
<%= link_to t("team_pages.show.replay_archive_link"), public_replay_index_path(team_id: @team.id), class: "btn btn-secondary" %>
<% end %>
</div>
</div>
<div class="roster-hero__media">
<% logo = @team.effective_logo_url.presence || @club.effective_logo_url %>
<% if @team.team_photo_url.present? %>
<%= image_tag @team.team_photo_url, alt: @team.name, class: "roster-hero__photo" %>
<% elsif logo.present? %>
<%= image_tag logo, alt: @team.name, class: "roster-hero__photo roster-hero__photo--logo" %>
<% else %>
<div class="roster-hero__photo roster-hero__photo--empty team-public-logo-fallback" aria-hidden="true">
<span><%= @team.name.first(2).upcase %></span>
</div>
<% end %>
</div>
</header>
<% if @live_sessions.any? %>
<section class="team-public-section" aria-labelledby="team-live-heading">
<h2 id="team-live-heading" class="section-heading"><%= t("team_pages.show.section_live_now") %></h2>
<div class="live-grid">
<% @live_sessions.each do |session| %>
<% match = session.match %>
<% on_air = @online_paths.include?(session.mediamtx_path_name) %>
<article class="live-card">
<%= live_match_card_heading(match, link_team: false) %>
<p class="meta">
<% if match.location.present? %><%= match.location %> · <% end %>
Match Live TV
</p>
<% if session.score_state %>
<p class="card-score">
<span class="card-sets"><%= live_score_sets_label(session.score_state, match) %></span>
<% if live_score_partials_label(session.score_state).present? %>
<span class="card-partials"><%= t("score.partials_prefix", value: live_score_partials_label(session.score_state)) %></span>
<% end %>
<span class="card-points"><%= session.score_state.home_points %> - <%= session.score_state.away_points %></span>
</p>
<% end %>
<div class="badges">
<% if on_air %>
<span class="badge badge-on-air"><%= t("live.index.badge_on_air") %></span>
<% elsif session.paused? %>
<span class="badge badge-connecting"><%= t("live.index.badge_paused") %></span>
<% else %>
<span class="badge badge-live"><%= t("live.index.badge_live") %></span>
<% end %>
</div>
<%= link_to t("live.index.watch_link"), public_live_path(session), class: "btn-watch" %>
</article>
<% end %>
</div>
</section>
<% end %>
<% if @upcoming_matches.any? %>
<section class="team-public-section" aria-labelledby="team-upcoming-heading">
<h2 id="team-upcoming-heading" class="section-heading<%= " section-heading--spaced" if @live_sessions.any? %>"><%= t("team_pages.show.section_upcoming") %></h2>
<p class="results-hint"><%= t("team_pages.show.upcoming_hint") %></p>
<div class="live-grid upcoming-grid">
<% @upcoming_matches.each do |match| %>
<article class="live-card live-card--upcoming">
<h3 class="live-card__title">
<span class="live-card__matchup"><%= @team.name %> vs <%= match.opponent_name %></span>
</h3>
<p class="meta">
<% if match.location.present? %><%= match.location %> · <% end %>
<%= match.category.presence || @team.sport_label %>
</p>
<p class="upcoming-when"><%= live_scheduled_relative(match.scheduled_at) %></p>
<div class="badges">
<span class="badge badge-scheduled"><%= t("live.index.badge_scheduled") %></span>
</div>
</article>
<% end %>
</div>
</section>
<% end %>
<% if @recordings.any? %>
<section class="team-public-section" aria-labelledby="team-replays-heading">
<h2 id="team-replays-heading" class="section-heading section-heading--spaced"><%= t("team_pages.show.section_replays") %></h2>
<div class="replay-grid">
<% @recordings.each do |rec| %>
<% match = rec.stream_session.match %>
<%= link_to public_replay_path(rec.stream_session_id), class: "replay-card" do %>
<div class="replay-card__media">
<% if rec.thumbnail_url %>
<img src="<%= rec.thumbnail_url %>" alt="" class="replay-card__thumb" loading="lazy" width="320" height="180">
<% else %>
<div class="replay-card__thumb replay-card__thumb--placeholder" aria-hidden="true">
<span class="replay-card__placeholder-icon"></span>
</div>
<% end %>
<span class="replay-card__duration"><%= rec.duration_label %></span>
<span class="replay-card__play" aria-hidden="true"></span>
</div>
<div class="replay-card__body">
<strong class="replay-card__title"><%= rec.title_or_default %></strong>
<p class="replay-card__meta"><%= l_local(rec.recorded_at_or_fallback) %></p>
</div>
<% end %>
<% end %>
</div>
<p class="team-public-more">
<%= link_to t("team_pages.show.replays_more_link", team: @team.name), public_replay_index_path(team_id: @team.id) %>
</p>
</section>
<% end %>
<% if @roster_by_category %>
<section class="team-public-section" aria-labelledby="team-roster-heading">
<h2 id="team-roster-heading" class="section-heading section-heading--spaced"><%= t("team_pages.show.section_roster") %></h2>
<div class="team-public-roster">
<% TeamRosterMember::DISPLAY_ORDER.each do |category| %>
<% members = @roster_by_category[category] %>
<% next if members.blank? %>
<section class="roster-section card">
<header class="roster-section__head">
<h3 class="roster-section__title"><%= TeamRosterMember.category_label(category) %></h3>
<span class="roster-section__count"><%= members.size %></span>
</header>
<div class="roster-list">
<% members.each do |person| %>
<%= render "shared/roster_person_card", person: person, team: @team, editable: false, compact: true %>
<% end %>
</div>
</section>
<% end %>
</div>
</section>
<% end %>
<% if @live_sessions.empty? && @upcoming_matches.empty? && @recordings.empty? %>
<div class="empty-state empty-state--soft team-public-empty">
<p><strong><%= t("team_pages.show.empty_title") %></strong></p>
<p><%= t("team_pages.show.empty_body") %></p>
<%= link_to t("team_pages.show.empty_link"), public_live_index_path, class: "btn btn-secondary" %>
</div>
<% end %>
</div>