Match highlights: DB-backed rounds/points, draggable point capture, sports sheet Edit

Match highlights sidebar (videos/types/match.blade.php)
- Replaced hardcoded 3-round/5-point/3-review mock with server-rendered loops
  over $video->matchRounds (with points) and $video->coachReviews. Owner-only
  buttons carry real DB ids to the existing JS handlers.
- Fixed savePoint create branch: was doing parseInt(rawMmSs) which truncated
  "1.15" -> 1 second. Now sends the parsed value that edit already used.
- Added a point-capture bar: clicking + on a round pauses the video and shows a
  bottom bar with a big draggable red marker + nudge buttons. Dragging seeks
  the video live; Confirm reads video.currentTime and opens the Add Point modal
  with mm.ss pre-filled and Action focused. Fixed both server- and JS-rendered
  round buttons so dynamic reloads keep the new flow.

Edit → sports sheet routing
- Added sports_match_id to /videos/{video}/edit JSON.
- openEditVideoModal delegates type=match videos to openSportsMatchModal —
  edit mode when a SportsMatch is linked, create-with-attached-video mode
  when the video is match-typed but has no SportsMatch row yet.
- Sports sheet gained attachExistingVideo() so create-mode can be seeded with
  a video that's already in the library (skips the upload dropzone).

Upload chooser mobile bottom-nav
- Bottom nav "Upload" now opens the type chooser (bottom sheet on mobile,
  centred modal on desktop) instead of hard-navigating to /videos/create.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
ghassanandClaude Opus 4.7 committed 2026-08-08 04:01:06 +03:00
1 parent 76f5ef0c84
commit ad6cbaf742
5 files changed
+384 -229

No files matched your search

@@ -233,12 +233,8 @@ window._editCurrentVideoId = null;
// ── Modal open / close ────────────────────────────────────────────────────────
function openEditVideoModal(videoId) {
if (window.innerWidth < 992) {
window.location.href = `/videos/${videoId}/edit`;
return;
}
window._editCurrentVideoId = videoId;
// Always resolve type first so a match video opens the sports-match sheet
// instead of the generic video-edit modal — same for mobile.
fetch(`/videos/${videoId}/edit`, {
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
@@ -251,6 +247,25 @@ function openEditVideoModal(videoId) {
if (!data.success) { showToast('Failed to load video data', 'error'); return; }
const v = data.video;
// Match videos always route to the sports-match sheet — edit the existing
// match if one is linked, otherwise open create-mode with the video already
// attached so the user can add the match details.
if (v.type === 'match' && typeof window.openSportsMatchModal === 'function') {
if (v.sports_match_id) {
window.openSportsMatchModal(v.sports_match_id);
} else {
window.openSportsMatchModal({ videoId: v.id, videoTitle: v.title });
}
return;
}
// Mobile fallback for non-match videos: full-page edit view
if (window.innerWidth < 992) {
window.location.href = `/videos/${videoId}/edit`;
return;
}
window._editCurrentVideoId = videoId;
document.getElementById('edit-form').action = `/videos/${videoId}`;
// Header