diff --git a/app/Http/Controllers/VideoController.php b/app/Http/Controllers/VideoController.php index 711df84..eccd69b 100644 --- a/app/Http/Controllers/VideoController.php +++ b/app/Http/Controllers/VideoController.php @@ -201,7 +201,7 @@ class VideoController extends Controller } // Load comments with user relationship - $video->load(['comments.user', 'comments.replies.user']); + $video->load(['comments.user', 'comments.replies.user', 'matchRounds.points', 'coachReviews']); // Handle playlist navigation if playlist parameter is provided $playlist = null; @@ -236,6 +236,19 @@ class VideoController extends Controller return view($view, compact('video', 'playlist', 'nextVideo', 'previousVideo', 'recommendedVideos', 'playlistVideos')); } + public function matchData(Video $video) + { + if (! $video->canView(Auth::user())) { + abort(403); + } + + return response()->json([ + 'success' => true, + 'rounds' => $video->matchRounds()->with('points')->orderBy('round_number')->get(), + 'reviews' => $video->coachReviews()->orderBy('start_time_seconds')->get(), + ]); + } + public function edit(Video $video, Request $request) { // Check if user owns the video diff --git a/resources/views/videos/types/match.blade.php b/resources/views/videos/types/match.blade.php index eab25c0..c6dcc91 100644 --- a/resources/views/videos/types/match.blade.php +++ b/resources/views/videos/types/match.blade.php @@ -507,6 +507,7 @@ } .action-btn, + .action-btn a, .comment-section .action-btn { border: none; border-radius: 8px; @@ -521,12 +522,15 @@ align-items: center; gap: 6px; transition: all 0.2s ease; + text-decoration: none; } .action-btn:hover, + .action-btn a:hover, .comment-section .action-btn:hover { background: var(--border-color); transform: translateY(-1px); + text-decoration: none; } .action-btn:active, @@ -1186,6 +1190,100 @@ color: white; } + /* ===== Coach Review Tab Specific Styles ===== */ + #tab-review .event-item { + display: flex; + gap: 12px; + width: 100%; + } + + #tab-review .event-time-container { + flex: 0 0 33.333%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; + gap: 2px; + line-height: 1.2; + min-height: 60px; + } + + #tab-review .event-time { + font-weight: 600; + color: #3ea6ff; + font-size: 13px; + } + + #tab-review .event-label { + font-size: 15px; + font-weight: 600; + margin-bottom: 6px; + color: var(--text-primary); + } + + #tab-review .event-meta { + display: flex; + align-items: flex-start; + gap: 8px; + font-size: 13px; + line-height: 1.4; + color: var(--text-secondary); + } + + .comment-avatar { + width: 28px; + height: 28px; + border-radius: 50%; + overflow: hidden; + flex-shrink: 0; + background: var(--bg-secondary); + border: 1px solid var(--border-color); + } + + .comment-avatar img { + width: 100%; + height: 100%; + object-fit: cover; + } + + #tab-review .event-meta-text { + flex: 1; + } + + #tab-review .event-meta-text .coach-name { + font-weight: 600; + color: var(--text-primary); + margin-bottom: 2px; + } + + #tab-review .event-meta-text .review-note { + color: var(--text-secondary); + font-size: 12.5px; + } + + /* Review item hover improvements */ + #tab-review .event-item:hover { + background: rgba(255, 255, 255, 0.05); + border-radius: 10px; + padding: 12px; + margin: -2px 0 -2px -8px; + border-left: 3px solid var(--brand-red); + } + + /* Ensure consistency with points tab on mobile */ + @media (max-width: 768px) { + #tab-review .event-item { + flex-direction: column; + gap: 8px; + } + + #tab-review .event-time { + align-self: flex-start; + order: -1; + } + } + /* ===== Match Modal Styles ===== */ .match-modal-overlay { display: none; @@ -1919,15 +2017,32 @@ }); } - // Match Highlights Toggle + // Match Highlights Toggle with localStorage persistence document.addEventListener('DOMContentLoaded', function() { const toggleBtn = document.getElementById('matchHighlightsToggle'); const sidebar = document.querySelector('.events-sidebar'); + const videoId = {{ isset($video) ? $video->id : 0 }}; if (toggleBtn && sidebar) { + // Load saved state on page load + const savedState = localStorage.getItem(`highlights_${videoId}`); + if (savedState === 'open') { + sidebar.classList.add('show'); + toggleBtn.classList.add('expanded'); + toggleBtn.textContent = 'Highlights'; + } + toggleBtn.addEventListener('click', function() { - sidebar.classList.toggle('show'); + const isOpen = sidebar.classList.toggle('show'); toggleBtn.classList.toggle('expanded'); + + // Save state to localStorage + if (isOpen) { + localStorage.setItem(`highlights_${videoId}`, 'open'); + toggleBtn.textContent = 'Highlights'; + } else { + localStorage.removeItem(`highlights_${videoId}`); + } }); } }); @@ -2294,20 +2409,21 @@