From 665bad76bfdb5169d560b9d2f28bbe49959eed67 Mon Sep 17 00:00:00 2001 From: ghassan Date: Tue, 11 Aug 2026 09:14:25 +0300 Subject: [PATCH] Match cards: composed title, header stage from match title, equal-sized grid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SportsMatchController syncs Video.title with SportsMatch.title on store/update so the "Match title" field drives the video's display title everywhere. - headerData(): "championship" now prefers event_name (event title) and adds a dedicated "stage" key sourced from SportsMatch.title (shown between the yellow lines above the weight class in both the in-player VS overlay and the vs-mini gallery card). - Video cards render match titles with flags + corner colours ("FINALS – 🇧🇭 Blue vs 🇧🇭 Red (-61 kg)"), matching the video page header, and clip long titles to one line. - Video gallery grid uses repeat(N, minmax(0, 1fr)) + grid-auto-rows:1fr so every card thumbnail renders at exactly the same size; hover-preview videos use object-fit:cover to stop portrait sources looking smaller. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Controllers/SportsMatchController.php | 13 +++++ app/Models/SportsMatch.php | 9 +++- .../components/partials/card-styles.blade.php | 52 +++++++++++++++---- .../components/partials/vs-mini.blade.php | 2 +- .../views/components/video-card.blade.php | 38 +++++++++++++- resources/views/videos/index.blade.php | 47 ++++++++--------- .../videos/partials/match/vs/index.blade.php | 4 +- 7 files changed, 128 insertions(+), 37 deletions(-) diff --git a/app/Http/Controllers/SportsMatchController.php b/app/Http/Controllers/SportsMatchController.php index 3313224..beabeed 100644 --- a/app/Http/Controllers/SportsMatchController.php +++ b/app/Http/Controllers/SportsMatchController.php @@ -34,6 +34,11 @@ class SportsMatchController extends Controller $this->handleImages($match, $request, $nas); $match->save(); + if ($match->video && $match->video->title !== $match->title) { + $match->video->title = $match->title; + $match->video->save(); + } + return response()->json([ 'ok' => true, 'message' => 'Match saved as draft.', @@ -51,6 +56,14 @@ class SportsMatchController extends Controller $this->handleImages($sportsMatch, $request, $nas); $sportsMatch->save(); + // Keep the parent Video's display title in sync with the match title + // so the match page header, share metadata, and search results all + // reflect the edited value. + if ($sportsMatch->video && $sportsMatch->video->title !== $sportsMatch->title) { + $sportsMatch->video->title = $sportsMatch->title; + $sportsMatch->video->save(); + } + return response()->json([ 'ok' => true, 'message' => 'Match updated.', diff --git a/app/Models/SportsMatch.php b/app/Models/SportsMatch.php index 0c89f34..1ebf185 100644 --- a/app/Models/SportsMatch.php +++ b/app/Models/SportsMatch.php @@ -68,7 +68,14 @@ class SportsMatch extends Model ], 'weight_category' => $trim($p['weight_class'] ?? null), 'division' => $trim($c['division'] ?? null), - 'championship' => $trim($c['championship_name'] ?? null) ?? $trim($this->event_name), + // Sub-header "stage" shown between the two yellow lines above + // the weight class (e.g. "Finals", "SEMI FINAL"). Sourced from + // the SportsMatch->title column — the form's "Match title" input. + 'stage' => $trim($this->title), + // "Event title" = the championship / tournament name shown above the + // fighters. Prefer the SportsMatch->event_name column (the field the + // uploader labels "Event title"), fall back to competition.championship_name. + 'championship' => $trim($this->event_name) ?? $trim($c['championship_name'] ?? null), 'match_number' => $trim(($c['match_number'] ?? null) !== null ? (string) $c['match_number'] : null), 'court' => $trim($c['court'] ?? null), 'format' => $trim($c['format'] ?? null), // "3 min", "Best of 3", … diff --git a/resources/views/components/partials/card-styles.blade.php b/resources/views/components/partials/card-styles.blade.php index 91cc47b..2e1af3e 100644 --- a/resources/views/components/partials/card-styles.blade.php +++ b/resources/views/components/partials/card-styles.blade.php @@ -3,9 +3,16 @@ /videos?filter=playlists. Wrapped in @once so it emits only once. --}} @once