Aggiunge i18n IT/EN/FR/DE/ES, pagine pubbliche squadre e UX archivio.

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>
This commit is contained in:
2026-07-23 19:30:44 +02:00
co-authored by Cursor
parent 7d5d66840f
commit 1d97271555
71 changed files with 3509 additions and 197 deletions
@@ -0,0 +1,129 @@
<% content_for :title, "Squadre su Match Live TV — Dirette e replay sport giovanili" %>
<% content_for :meta_description, "Scopri le squadre sportive giovanili che trasmettono su Match Live TV. Cerca per nome, filtra per sport, trova dirette in corso e archivi replay." %>
<% content_for :canonical_url, seo_absolute_url(public_team_pages_path(filter_params_for_canonical)) %>
<div class="wrap team-directory">
<h1>Squadre su Match Live TV</h1>
<p class="results-hint">
Società e squadre con dirette, replay pubblici o partite in programma.
Cerca la tua squadra e apri la pagina per seguire calendario e archivio.
</p>
<%= form_with url: public_team_pages_path, method: :get, local: true, class: "team-directory-filters" do %>
<div class="search-form team-directory-filters__search">
<input
type="search"
name="q"
value="<%= @query %>"
placeholder="Nome squadra, società, città o palestra…"
aria-label="Cerca squadra"
autocomplete="off"
/>
<button type="submit" class="btn btn-primary">Cerca</button>
</div>
<div class="team-directory-filters__row">
<div class="team-directory-filters__field">
<label for="sport" class="team-directory-filters__label">Sport</label>
<select name="sport" id="sport" class="team-directory-filters__select" onchange="this.form.requestSubmit()">
<option value="">Tutti gli sport</option>
<% @sport_options.each do |sport| %>
<option value="<%= sport[:key] %>"<%= " selected" if @sport == sport[:key] %>><%= sport[:label] %></option>
<% end %>
</select>
</div>
<div class="team-directory-filters__field team-directory-filters__field--chips">
<span class="team-directory-filters__label" id="team-filter-chips-label">Mostra</span>
<div class="team-directory-chips" role="group" aria-labelledby="team-filter-chips-label">
<label class="filter-chip<%= " is-active" if @live_filter %>">
<%= check_box_tag :live, "1", @live_filter, id: "filter_live", class: "filter-chip__input", onchange: "this.form.requestSubmit()" %>
<span class="filter-chip__face" aria-hidden="true">
<span class="filter-chip__dot filter-chip__dot--live"></span>
In diretta
</span>
</label>
<label class="filter-chip<%= " is-active" if @replays_filter %>">
<%= check_box_tag :replays, "1", @replays_filter, id: "filter_replays", class: "filter-chip__input", onchange: "this.form.requestSubmit()" %>
<span class="filter-chip__face" aria-hidden="true">
<span class="filter-chip__icon"></span>
Con replay
</span>
</label>
</div>
</div>
<% if @query.present? || @sport.present? || @live_filter || @replays_filter %>
<div class="team-directory-filters__actions">
<span class="team-directory-filters__label team-directory-filters__label--spacer" aria-hidden="true">&nbsp;</span>
<%= link_to "Azzera", public_team_pages_path, class: "btn btn-secondary team-directory-filters__reset" %>
</div>
<% end %>
</div>
<% end %>
<% if @query.present? || @sport.present? || @live_filter || @replays_filter %>
<p class="results-hint">
<%= @entries.size %> squadre trovate
<% if @query.present? %> per «<%= h @query %>»<% end %>
<% if @sport.present? %> · <%= Sports::Catalog.find_optional(@sport)&.dig(:label) || @sport %><% end %>
</p>
<% else %>
<p class="results-hint"><%= @entries.size %> squadre attive</p>
<% end %>
<% if @entries.any? %>
<div class="team-directory-grid">
<% @entries.each do |entry| %>
<% team = entry.team %>
<% club = team.club %>
<% logo = team.effective_logo_url.presence || club.effective_logo_url %>
<%= link_to public_team_page_path(team.slug), class: "team-directory-card" do %>
<div class="team-directory-card__media">
<% if team.team_photo_url.present? %>
<%= image_tag team.team_photo_url, alt: "", class: "team-directory-card__photo", loading: "lazy" %>
<% elsif logo.present? %>
<%= image_tag logo, alt: "", class: "team-directory-card__photo team-directory-card__photo--logo", loading: "lazy" %>
<% else %>
<div class="team-directory-card__photo team-directory-card__photo--fallback" aria-hidden="true">
<%= team.name.first(2).upcase %>
</div>
<% end %>
</div>
<div class="team-directory-card__body">
<p class="team-directory-card__club"><%= club.name %></p>
<h2 class="team-directory-card__name"><%= team.name %></h2>
<p class="team-directory-card__meta"><%= team.sport_label %></p>
<div class="team-directory-card__badges">
<% if entry.live_now %>
<span class="badge badge-on-air">In diretta</span>
<% end %>
<% if entry.upcoming_count.positive? %>
<span class="badge badge-scheduled"><%= entry.upcoming_count %> in programma</span>
<% end %>
<% if entry.replay_count.positive? %>
<span class="badge badge-wait"><%= entry.replay_count %> replay</span>
<% end %>
</div>
</div>
<% end %>
<% end %>
</div>
<% else %>
<div class="empty-state">
<% if @query.present? || @sport.present? || @live_filter || @replays_filter %>
<p><strong>Nessuna squadra trovata</strong> con i filtri selezionati.</p>
<p><%= link_to "Mostra tutte le squadre attive", public_team_pages_path, class: "btn btn-secondary" %></p>
<% else %>
<p><strong>Nessuna squadra attiva al momento.</strong></p>
<p>Quando una società avvierà dirette o pubblicherà replay, comparirà qui.</p>
<%= link_to "Vai alle dirette live", public_live_index_path, class: "btn btn-secondary", style: "margin-top:12px;display:inline-block" %>
<% end %>
</div>
<% end %>
<p class="team-directory-footer muted">
<%= link_to "Dirette in corso", public_live_index_path %> ·
<%= link_to "Archivio replay", public_replay_index_path %>
</p>
</div>
@@ -0,0 +1,175 @@
<% 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>