Il selettore lingua funziona sul web e sulle app native; su Android la preferenza è persistita e applicata al riavvio. Incluse anche eliminazione replay a scope e campi pagina pubblica squadra. Co-authored-by: Cursor <cursoragent@cursor.com>
176 lines
8.2 KiB
ERB
176 lines
8.2 KiB
ERB
<% content_for :title, "#{@team.name} — #{@club.name} | Match Live TV" %>
|
|
<% 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 "← Tutte le squadre", 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>In diretta ora</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 "Guarda la diretta", public_live_path(@live_sessions.first), class: "btn btn-primary" %>
|
|
<% end %>
|
|
<%= link_to "Tutte le dirette", public_live_index_path(club_id: @club.id), class: "btn btn-secondary" %>
|
|
<% if @recordings.any? %>
|
|
<%= link_to "Archivio replay", 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">In diretta adesso</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">Parziali: <%= 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">In onda</span>
|
|
<% elsif session.paused? %>
|
|
<span class="badge badge-connecting">In pausa</span>
|
|
<% else %>
|
|
<span class="badge badge-live">Live</span>
|
|
<% end %>
|
|
</div>
|
|
<%= link_to "Guarda diretta →", 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? %>">Prossime partite</h2>
|
|
<p class="results-hint">Programmate dal club: la diretta partirà quando lo staff avvierà la trasmissione.</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">In programma</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">Replay recenti</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 "Vedi tutti i replay di #{@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">Organico</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_LABELS[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>Nessuna diretta o replay al momento.</strong></p>
|
|
<p>Torna a controllare prima delle prossime gare: qui compariranno dirette, calendario e archivio della squadra.</p>
|
|
<%= link_to "Vedi tutte le dirette", public_live_index_path, class: "btn btn-secondary" %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|