From f850f40f7803b52fa3e91de759a450369f5f5793 Mon Sep 17 00:00:00 2001 From: ghassan Date: Sun, 15 Mar 2026 04:06:35 +0300 Subject: [PATCH] all is working great --- app/Http/Controllers/VideoController.php | 6 +- .../views/emails/video-uploaded.blade.php | 77 +- .../partials/confirm-delete-modal.blade.php | 29 + resources/views/videos/index.blade.php | 298 +- resources/views/videos/shorts.blade.php | 609 +- resources/views/videos/show.blade.php | 89 +- .../views/videos/types/generic.blade.php | 317 +- .../views/videos/types/match.blade-old.php | 2276 ------- resources/views/videos/types/match.blade.php | 5348 ++++++++++------- resources/views/videos/types/music.blade.php | 797 ++- .../types/music.blade.php-script-append | 45 + 11 files changed, 4609 insertions(+), 5282 deletions(-) create mode 100644 resources/views/layouts/partials/confirm-delete-modal.blade.php delete mode 100644 resources/views/videos/types/match.blade-old.php create mode 100644 resources/views/videos/types/music.blade.php-script-append diff --git a/app/Http/Controllers/VideoController.php b/app/Http/Controllers/VideoController.php index cae07d0..711df84 100644 --- a/app/Http/Controllers/VideoController.php +++ b/app/Http/Controllers/VideoController.php @@ -23,7 +23,7 @@ class VideoController extends Controller public function index() { - $videos = Video::public()->latest()->paginate(12); + $videos = Video::public()->latest()->get(); return view('videos.index', compact('videos')); } @@ -42,7 +42,7 @@ class VideoController extends Controller ->orWhere('description', 'like', "%{$query}%"); }) ->latest() - ->paginate(12); + ->get(); return view('videos.index', compact('videos', 'query')); } @@ -491,7 +491,7 @@ class VideoController extends Controller ->where('status', 'ready') ->with('user') ->latest() - ->paginate(12); + ->get(); return view('videos.shorts', compact('videos')); } diff --git a/resources/views/emails/video-uploaded.blade.php b/resources/views/emails/video-uploaded.blade.php index 2ef248b..82a2240 100644 --- a/resources/views/emails/video-uploaded.blade.php +++ b/resources/views/emails/video-uploaded.blade.php @@ -1,14 +1,41 @@ + +
@@ -19,16 +46,44 @@

Hi {{ $userName }},

Your video "{{ $video->title }}" has been uploaded successfully!

Your video is now being processed and will be available shortly.

-

Video Details:

-
    -
  • Size: {{ round($video->size / 1024 / 1024, 2) }} MB
  • -
  • Orientation: {{ $video->orientation }}
  • -
-

View Video

+ +

Check out your uploaded video:

+
+ @if ($video->thumbnail) + + {{ $video->title }} + + @else +
+ + {{ Str::limit($video->title, 30) }} +
+

Thumbnail generating...

+ @endif +
+ +
+

Video Details:

+
    +
  • Title: {{ $video->title }}
  • +
  • Size: {{ round($video->size / 1024 / 1024, 2) }} MB
  • +
  • Orientation: {{ $video->orientation ?? 'Horizontal' }}
  • +
+
+ +

+ ▶️ + Watch Video +

+
+ diff --git a/resources/views/layouts/partials/confirm-delete-modal.blade.php b/resources/views/layouts/partials/confirm-delete-modal.blade.php new file mode 100644 index 0000000..2d5bc51 --- /dev/null +++ b/resources/views/layouts/partials/confirm-delete-modal.blade.php @@ -0,0 +1,29 @@ + diff --git a/resources/views/videos/index.blade.php b/resources/views/videos/index.blade.php index dd65722..9cb64e3 100644 --- a/resources/views/videos/index.blade.php +++ b/resources/views/videos/index.blade.php @@ -1,6 +1,7 @@ @extends('layouts.app') -@section('title', isset($query) ? 'Search: ' . $query . ' | ' . config('app.name') : 'Video Gallery | ' . config('app.name')) +@section('title', isset($query) ? 'Search: ' . $query . ' | ' . config('app.name') : 'Video Gallery | ' . + config('app.name')) @section('extra_styles') @endsection @@ -203,118 +210,129 @@

Search results for "{{ $query }}"

{{ $videos->total() }} videos found

- @endif - - @if($videos->isEmpty()) -
- - @isset($query) -

No results found

-

Try different keywords or browse all videos.

- @else -

No videos yet

-

Be the first to upload a video!

- @endisset - @auth - - - Upload Video - - @else - - - Login to Upload - - @endauth -
- @else -
- @foreach($videos as $video) - - @endforeach -
- -
{{ $videos->links() }}
- @endif - - @include('layouts.partials.share-modal') -@endsection + @endif + + @if ($videos->isEmpty()) +
+ + @isset($query) +

No results found

+

Try different keywords or browse all videos.

+ @else +

No videos yet

+

Be the first to upload a video!

+ @endisset + @auth + + + Upload Video + + @else + + + Login to Upload + + @endauth +
+ @else +
+ @foreach ($videos as $video) + + @endforeach +
+ + @endif + + @include('layouts.partials.share-modal') + @endsection @section('scripts') - + function stopVideo(card) { + const video = card.querySelector('video'); + if (video) { + video.pause(); + video.currentTime = 0; + video.classList.remove('active'); + } + } + + // Mobile touch support for hover-like behavior + document.addEventListener('touchstart', function(e) { + const card = e.target.closest('.yt-video-card'); + if (card) { + // Stop any other playing videos first + document.querySelectorAll('.yt-video-card').forEach(function(otherCard) { + if (otherCard !== card) { + stopVideo(otherCard); + } + }); + playVideo(card); + } + }, { + passive: true + }); + + document.addEventListener('touchend', function(e) { + const card = e.target.closest('.yt-video-card'); + if (card) { + stopVideo(card); + } + }, { + passive: true + }); + @endsection - - + + .yt-video-thumb { + border-radius: 8px; + } + + .yt-video-info { + gap: 8px; + margin-top: 8px; + } + + .yt-channel-icon { + width: 28px; + height: 28px; + } + + .yt-video-title { + font-size: 13px; + } + + .yt-channel-name, + .yt-video-meta { + font-size: 11px; + } + + .search-info { + padding: 12px; + } + + .search-info h2 { + font-size: 16px; + } + } + diff --git a/resources/views/videos/shorts.blade.php b/resources/views/videos/shorts.blade.php index 0486101..7617e44 100644 --- a/resources/views/videos/shorts.blade.php +++ b/resources/views/videos/shorts.blade.php @@ -3,351 +3,348 @@ @section('title', 'Shorts - ' . config('app.name')) @section('content') -
-
- -
-
-
- -
-

Shorts

-
-
- - -
- @forelse($videos as $video) - - @empty -
-
- +
+
+ +
+
+
+
-

No Shorts yet

-

Be the first to upload a Short!

- @auth - - Upload Short - - @else - - Login to Upload - - @endauth +

Shorts

- @endforelse -
+
+ + + + - - @if($videos->hasPages()) -
- {{ $videos->links() }}
- @endif
-
- + @media (max-width: 600px) { + .shorts-container { + grid-template-columns: 1fr; + max-width: 320px; + margin: 0 auto; + } + + .shorts-header { + text-align: center; + } + + .shorts-brand { + justify-content: center; + } + } + @endsection - diff --git a/resources/views/videos/show.blade.php b/resources/views/videos/show.blade.php index 85074f3..f900bcb 100644 --- a/resources/views/videos/show.blade.php +++ b/resources/views/videos/show.blade.php @@ -492,7 +492,8 @@ @auth -
+ @csrf - {{ Str::limit($previousVideo->title, 20) }} - @else - - @endif + @if ($nextVideo || $previousVideo) +
+ + @if ($previousVideo) + + {{ Str::limit($previousVideo->title, 20) }} + @else + + @endif - -
- - + +
+ + +
+ + + @if ($nextVideo) + {{ Str::limit($nextVideo->title, 20) }} + + @else + + @endif +
+
+
- - - @if($nextVideo) - {{ Str::limit($nextVideo->title, 20) }} - - @else - - @endif -
-
- -
@endif
@@ -530,8 +571,9 @@ @if (Auth::id() !== $video->user_id) @else - @endif @else @@ -543,7 +585,7 @@ action="{{ $video->isLikedBy(Auth::user()) ? route('videos.unlike', $video->id) : route('videos.like', $video->id) }}" class="d-inline"> @csrf - @endif + + + + +
@@ -646,15 +699,20 @@
{{ Auth::user()->name }} -
- -
- - -
+
+ + +
@else @@ -690,29 +748,69 @@ }) }) .then(response => response.json()) + .catch(error => { + console.error('Error:', error); + alert('Failed to post comment: ' + error); + }) .then(data => { - if (data.success) { + if (data && data.success) { document.getElementById('commentBody').value = ''; - location.reload(); + addCommentToList(data.comment); + } else { + alert('Failed to post comment'); } }); } - function deleteComment(commentId) { - if (!confirm('Are you sure you want to delete this comment?')) return; + function addCommentToList(comment) { + const commentsList = document.getElementById('commentsList'); + const commentHtml = ` +
+ ${comment.user.name} +
+
+ ${comment.user.name} + just now +
+
+ ${comment.body.replace(/@(\\w+)/g, '@$1')} +
+
+ +
+
+
+ `; + commentsList.insertAdjacentHTML('afterbegin', commentHtml); + const commentCount = document.querySelector('h3 span'); + if (commentCount) { + const count = parseInt(commentCount.textContent.match(/\\((\\d+)\\)/)?.[2] || 0) + 1; + commentCount.textContent = `(${count})`; + } + } - fetch(`/comments/${commentId}`, { - method: 'DELETE', - headers: { - 'X-CSRF-TOKEN': '{{ csrf_token() }}' - } - }) - .then(response => response.json()) - .then(data => { - if (data.success) { - location.reload(); - } - }); + function deleteComment(commentId) { + if (confirm('Are you sure you want to delete this comment?')) { + fetch(`/comments/${commentId}`, { + method: 'DELETE', + headers: { + 'X-CSRF-TOKEN': '{{ csrf_token() }}' + } + }) + .then(response => response.json()) + .then(data => { + if (data.success) { + document.getElementById('comment-' + commentId).remove(); + const commentCount = document.querySelector('h3 span'); + if (commentCount) { + const count = parseInt(commentCount.textContent.match(/\\((\\d+)\\)/)?.[2] || 0) - 1; + commentCount.textContent = `(${count})`; + } + } + }); + } } document.addEventListener('DOMContentLoaded', function() { @@ -752,57 +850,62 @@
- @if($playlist && $playlistVideos && $playlistVideos->count() > 0) + @if ($playlist && $playlistVideos && $playlistVideos->count() > 0)

{{ $playlist->name }} - ({{ $playlistVideos->count() }} videos) + ({{ $playlistVideos->count() }} + videos)