Add video platform features: authentication, video management, user profiles, likes/views tracking

- Added authentication controllers (Login, Register)
- Added UserController for user profile management
- Added VideoController with full CRUD operations
- Added Video model with relationships (user, likes, views)
- Added User model enhancements (avatar, video relationships)
- Added database migrations for video_likes, video_views, user_avatar, video_visibility
- Added CompressVideoJob for video processing
- Added VideoUploaded mail notification
- Added authentication routes
- Updated web routes with video and user routes
- Added layout templates (app, plain, partials)
- Added user views (profile, settings, channel, history, liked)
- Added video views (create, edit, index, show)
- Added email templates
This commit is contained in:
ghassan 2026-02-25 00:03:02 +00:00
parent 6a2026df4b
commit 5253f89b63
35 changed files with 5092 additions and 849 deletions

28
TODO.md Normal file
View File

@ -0,0 +1,28 @@
# TODO: Convert Video Create to Cute Staged Popup Modal
## Implementation Plan
### 1. Create Upload Modal Partial
- [x] Create `resources/views/layouts/partials/upload-modal.blade.php`
- [x] Implement cute staged pop-up animation (scale + fade with bounce)
- [x] Create multi-step form (Title → Video → Thumbnail → Privacy → Upload)
- [x] Add progress indicator for current step
- [x] Style with dark theme + cute accents
### 2. Update Header
- [x] Modify `resources/views/layouts/partials/header.blade.php`
- [x] Change Upload button from link to trigger modal via JavaScript
### 3. Include Modal in Views
- [x] Update `resources/views/videos/index.blade.php` to include upload modal
- [x] Update `resources/views/layouts/app.blade.php` to include modal globally for auth users
### 4. Keep Fallback Route
- [x] Keep existing `/videos/create` route for direct access (no changes needed)
## Implementation Notes
- Uses Bootstrap modal as base
- Custom CSS for cute staged animation effects
- JavaScript for step navigation and form handling
- Matches existing dark theme styling

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AuthenticatedSessionController extends Controller
{
public function create()
{
return view('auth.login');
}
public function store(Request $request)
{
$credentials = $request->validate([
'email' => ['required', 'email'],
'password' => ['required'],
]);
if (Auth::attempt($credentials)) {
$request->session()->regenerate();
return redirect()->intended('/videos');
}
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
]);
}
public function destroy(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/videos');
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules\Password;
class RegisteredUserController extends Controller
{
public function create()
{
return view('auth.register');
}
public function store(Request $request)
{
$request->validate([
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'confirmed', Password::defaults()],
]);
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
event(new Registered($user));
auth()->login($user);
return redirect('/videos');
}
}

View File

@ -0,0 +1,190 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Video;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class UserController extends Controller
{
public function __construct()
{
$this->middleware('auth')->except(['channel']);
}
// Profile page - view own profile
public function profile()
{
$user = Auth::user();
return view('user.profile', compact('user'));
}
// Update profile
public function updateProfile(Request $request)
{
$user = Auth::user();
$request->validate([
'name' => 'required|string|max:255',
'avatar' => 'nullable|image|mimes:jpg,jpeg,png,webp|max:5120',
]);
$data = ['name' => $request->name];
if ($request->hasFile('avatar')) {
// Delete old avatar
if ($user->avatar) {
Storage::delete('public/avatars/' . $user->avatar);
}
$filename = Str::uuid() . '.' . $request->file('avatar')->getClientOriginalExtension();
$request->file('avatar')->storeAs('public/avatars', $filename);
$data['avatar'] = $filename;
}
$user->update($data);
return redirect()->route('profile')->with('success', 'Profile updated successfully!');
}
// Settings page
public function settings()
{
$user = Auth::user();
return view('user.settings', compact('user'));
}
// Update settings (password)
public function updateSettings(Request $request)
{
$user = Auth::user();
$request->validate([
'current_password' => 'required',
'new_password' => 'required|min:8|confirmed',
]);
if (!Hash::check($request->current_password, $user->password)) {
return back()->withErrors(['current_password' => 'Current password is incorrect']);
}
$user->update([
'password' => Hash::make($request->new_password)
]);
return redirect()->route('settings')->with('success', 'Password updated successfully!');
}
// User's channel page - view videos
public function channel($userId = null)
{
if ($userId) {
$user = User::findOrFail($userId);
} else {
$user = Auth::user();
}
// If viewing own channel, show all videos including private
// If viewing someone else's channel, show only public videos
if (Auth::check() && Auth::user()->id === $user->id) {
$videos = Video::where('user_id', $user->id)
->latest()
->paginate(12);
} else {
$videos = Video::public()
->where('user_id', $user->id)
->latest()
->paginate(12);
}
return view('user.channel', compact('user', 'videos'));
}
// Watch history
public function history()
{
$user = Auth::user();
// Get videos the user has watched, ordered by most recently watched
// Include private videos since they are the user's own
$videoIds = \DB::table('video_views')
->where('user_id', $user->id)
->orderBy('watched_at', 'desc')
->pluck('video_id')
->unique();
$videos = Video::whereIn('id', $videoIds)
->where(function($q) use ($user) {
$q->where('visibility', '!=', 'private')
->orWhere('user_id', $user->id);
})
->get()
->sortByDesc(function ($video) use ($videoIds) {
return $videoIds->search($video->id);
});
return view('user.history', compact('videos'));
}
// Liked videos
public function liked()
{
$user = Auth::user();
// Include private videos in liked (user's own private videos)
$videos = $user->likes()
->where(function($q) use ($user) {
$q->where('visibility', '!=', 'private')
->orWhere('videos.user_id', $user->id);
})
->latest()
->paginate(12);
return view('user.liked', compact('videos'));
}
// Like a video
public function like(Video $video)
{
$user = Auth::user();
if (!$video->isLikedBy($user)) {
$video->likes()->attach($user->id);
}
return back();
}
// Unlike a video
public function unlike(Video $video)
{
$user = Auth::user();
$video->likes()->detach($user->id);
return back();
}
// Toggle like (API)
public function toggleLike(Video $video)
{
$user = Auth::user();
if ($video->isLikedBy($user)) {
$video->likes()->detach($user->id);
$liked = false;
} else {
$video->likes()->attach($user->id);
$liked = true;
}
return response()->json([
'liked' => $liked,
'like_count' => $video->like_count
]);
}
}

View File

@ -2,19 +2,49 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Jobs\CompressVideoJob;
use App\Mail\VideoUploaded;
use App\Models\Video;
use Illuminate\Support\Str;
use FFMpeg\FFMpeg;
use FFMpeg\FFProbe;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class VideoController extends Controller
{
public function __construct()
{
$this->middleware('auth')->except(['index', 'show', 'search', 'stream']);
}
public function index()
{
$videos = Video::latest()->paginate(12);
$videos = Video::public()->latest()->paginate(12);
return view('videos.index', compact('videos'));
}
public function search(Request $request)
{
$query = $request->get('q', '');
if (empty($query)) {
return redirect()->route('videos.index');
}
$videos = Video::public()
->where(function($q) use ($query) {
$q->where('title', 'like', "%{$query}%")
->orWhere('description', 'like', "%{$query}%");
})
->latest()
->paginate(12);
return view('videos.index', compact('videos', 'query'));
}
public function create()
{
return view('videos.create');
@ -25,88 +55,147 @@ class VideoController extends Controller
$request->validate([
'title' => 'required|string|max:255',
'description' => 'nullable|string',
'video' => 'required|mimes:mp4,mov,avi,webm|max:2000000',
'video' => 'required|file|mimes:mp4,webm,ogg,mov,avi,wmv,flv,mkv|max:2000000',
'thumbnail' => 'nullable|image|mimes:jpg,jpeg,png,webp|max:5120',
'orientation' => 'nullable|in:portrait,landscape,square,ultrawide',
'visibility' => 'nullable|in:public,unlisted,private',
]);
$file = $request->file('video');
$filename = Str::uuid() . '.' . $file->getClientOriginalExtension();
$path = $file->storeAs('videos', $filename, 'public');
$videoFile = $request->file('video');
$filename = Str::slug($request->title) . '-' . time() . '.' . $videoFile->getClientOriginalExtension();
$path = $videoFile->storeAs('public/videos', $filename);
$width = 0;
$height = 0;
$duration = 0;
$orientation = $request->orientation ?? 'landscape';
$videoPath = storage_path('app/public/videos/' . $filename);
if (!$request->orientation && file_exists($videoPath)) {
$durationCmd = "ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 " . escapeshellarg($videoPath);
$duration = (int) shell_exec($durationCmd);
$dimCmd = "ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 " . escapeshellarg($videoPath);
$output = shell_exec($dimCmd);
if ($output) {
$parts = explode('x', trim($output));
if (count($parts) == 2) {
$width = (int) trim($parts[0]);
$height = (int) trim($parts[1]);
// Get file info
$fileSize = $videoFile->getSize();
$mimeType = $videoFile->getMimeType();
$thumbnailPath = null;
if ($request->hasFile('thumbnail')) {
$thumbFilename = Str::uuid() . '.' . $request->file('thumbnail')->getClientOriginalExtension();
$thumbnailPath = $request->file('thumbnail')->storeAs('public/thumbnails', $thumbFilename);
} else {
// Extract thumbnail from video using FFmpeg
try {
$ffmpeg = FFMpeg::create();
$videoPath = storage_path('app/' . $path);
if (file_exists($videoPath)) {
$video = $ffmpeg->open($videoPath);
$frame = $video->frame(\FFMpeg\Coordinate\TimeCode::fromSeconds(1));
if ($height > $width * 1.2) {
$orientation = 'portrait';
} elseif ($width > $height * 1.5) {
$orientation = 'ultrawide';
} elseif (abs($width - $height) < 50) {
$orientation = 'square';
} else {
$orientation = 'landscape';
$thumbFilename = Str::uuid() . '.jpg';
$thumbFullPath = storage_path('app/public/thumbnails/' . $thumbFilename);
// Ensure thumbnails directory exists
if (!file_exists(storage_path('app/public/thumbnails'))) {
mkdir(storage_path('app/public/thumbnails'), 0755, true);
}
$frame->save($thumbFullPath);
$thumbnailPath = 'public/thumbnails/' . $thumbFilename;
}
} catch (\Exception $e) {
// Log the error but don't fail the upload
\Log::error('FFmpeg failed to extract thumbnail: ' . $e->getMessage());
}
}
// Get video dimensions and detect orientation using FFmpeg
$width = null;
$height = null;
$orientation = 'landscape';
try {
$ffprobe = FFProbe::create();
$videoPath = storage_path('app/' . $path);
if (file_exists($videoPath)) {
$streams = $ffprobe->streams($videoPath);
$videoStream = $streams->videos()->first();
if ($videoStream) {
$width = $videoStream->get('width');
$height = $videoStream->get('height');
// Auto-detect orientation based on dimensions
if ($width && $height) {
if ($height > $width) {
$orientation = 'portrait';
} elseif ($width > $height) {
$orientation = 'landscape';
} else {
$orientation = 'square';
}
}
}
}
} catch (\Exception $e) {
// Log the error but don't fail the upload
\Log::error('FFprobe failed to get video dimensions: ' . $e->getMessage());
// Use default orientation
}
$thumbnailFilename = null;
if ($request->hasFile('thumbnail')) {
$thumbFile = $request->file('thumbnail');
$thumbnailFilename = Str::uuid() . '.' . $thumbFile->getClientOriginalExtension();
$thumbFile->storeAs('thumbnails', $thumbnailFilename, 'public');
} elseif (file_exists($videoPath)) {
$thumbFilename = Str::uuid() . '.jpg';
$thumbPath = storage_path('app/public/thumbnails/' . $thumbFilename);
$cmd = "ffmpeg -i " . escapeshellarg($videoPath) . " -ss 00:00:01 -vframes 1 -vf 'scale=320:-1' " . escapeshellarg($thumbPath) . " -y 2>/dev/null";
shell_exec($cmd);
if (file_exists($thumbPath)) {
$thumbnailFilename = $thumbFilename;
}
}
$video = Video::create([
'user_id' => Auth::id(),
'title' => $request->title,
'description' => $request->description,
'filename' => $filename,
'path' => 'videos',
'thumbnail' => $thumbnailFilename,
'duration' => $duration,
'path' => $path,
'thumbnail' => $thumbnailPath ? basename($thumbnailPath) : null,
'size' => $fileSize,
'mime_type' => $mimeType,
'orientation' => $orientation,
'width' => $width,
'height' => $height,
'orientation' => $orientation,
'size' => $file->getSize(),
'status' => 'ready',
'status' => 'processing',
'visibility' => $request->visibility ?? 'public',
]);
// Dispatch compression job in the background
CompressVideoJob::dispatch($video);
// Load user relationship for email
$video->load('user');
// Send email notification
try {
Mail::to(Auth::user()->email)->send(new VideoUploaded($video));
} catch (\Exception $e) {
// Log the error but don't fail the upload
\Log::error('Email notification failed: ' . $e->getMessage());
}
return response()->json([
'success' => true,
'message' => 'Video uploaded successfully!',
'video_id' => $video->id,
'redirect' => route('videos.show', $video->id)
]);
}
public function show(Video $video)
{
// Check if user can view this video
if (!$video->canView(Auth::user())) {
abort(404, 'Video not found');
}
// Track view if user is logged in
if (Auth::check()) {
$user = Auth::user();
// Add view if not already viewed recently (within last hour)
$existingView = \DB::table('video_views')
->where('user_id', $user->id)
->where('video_id', $video->id)
->where('watched_at', '>', now()->subHour())
->first();
if (!$existingView) {
\DB::table('video_views')->insert([
'user_id' => $user->id,
'video_id' => $video->id,
'watched_at' => now()
]);
}
}
return view('videos.show', compact('video'));
}
@ -121,93 +210,101 @@ class VideoController extends Controller
'title' => 'required|string|max:255',
'description' => 'nullable|string',
'thumbnail' => 'nullable|image|mimes:jpg,jpeg,png,webp|max:5120',
'orientation' => 'nullable|in:portrait,landscape,square,ultrawide',
'visibility' => 'nullable|in:public,unlisted,private',
]);
$video->title = $request->title;
$video->description = $request->description;
if ($request->orientation) {
$video->orientation = $request->orientation;
}
$data = $request->only(['title', 'description', 'visibility']);
if ($request->hasFile('thumbnail')) {
if ($video->thumbnail) {
$oldThumb = storage_path('app/public/thumbnails/' . $video->thumbnail);
if (file_exists($oldThumb)) {
unlink($oldThumb);
}
Storage::delete('public/thumbnails/' . $video->thumbnail);
}
$thumbFile = $request->file('thumbnail');
$thumbnailFilename = Str::uuid() . '.' . $thumbFile->getClientOriginalExtension();
$thumbFile->storeAs('thumbnails', $thumbnailFilename, 'public');
$video->thumbnail = $thumbnailFilename;
$thumbFilename = Str::uuid() . '.' . $request->file('thumbnail')->getClientOriginalExtension();
$data['thumbnail'] = $request->file('thumbnail')->storeAs('public/thumbnails', $thumbFilename);
$data['thumbnail'] = basename($data['thumbnail']);
}
$video->save();
return redirect()->route('videos.show', $video->id)
->with('success', 'Video updated successfully!');
}
public function stream(Video $video)
{
$filePath = storage_path('app/public/videos/' . $video->filename);
if (!file_exists($filePath)) {
abort(404, 'Video file not found');
// Set default visibility if not provided
if (!isset($data['visibility'])) {
unset($data['visibility']);
}
$fileSize = filesize($filePath);
$range = request()->header('Range');
$video->update($data);
header('Content-Type: video/mp4');
header('Accept-Ranges: bytes');
if ($range) {
$ranges = explode('-', str_replace('bytes=', '', $range));
$start = intval($ranges[0]);
$end = isset($ranges[1]) && $ranges[1] ? intval($ranges[1]) : $fileSize - 1;
$length = $end - $start + 1;
header('HTTP/1.1 206 Partial Content');
header('Content-Length: ' . $length);
header('Content-Range: bytes ' . $start . '-' . $end . '/' . $fileSize);
$fp = fopen($filePath, 'rb');
fseek($fp, $start);
$chunkSize = 8192;
while (!feof($fp) && (ftell($fp) <= $end)) {
$chunk = fread($fp, min($chunkSize, $end - ftell($fp) + 1));
echo $chunk;
flush();
}
fclose($fp);
} else {
header('Content-Length: ' . $fileSize);
readfile($filePath);
}
exit;
return redirect()->route('videos.show', $video)->with('success', 'Video updated!');
}
public function destroy(Video $video)
{
$path = storage_path('app/public/videos/' . $video->filename);
if (file_exists($path)) {
unlink($path);
}
Storage::delete('public/videos/' . $video->filename);
if ($video->thumbnail) {
$thumbPath = storage_path('app/public/thumbnails/' . $video->thumbnail);
if (file_exists($thumbPath)) {
unlink($thumbPath);
}
Storage::delete('public/thumbnails/' . $video->thumbnail);
}
$video->delete();
return redirect()->route('videos.index')->with('success', 'Video deleted!');
}
public function stream(Video $video)
{
// Check if user can view this video
if (!$video->canView(Auth::user())) {
abort(404, 'Video not found');
}
$path = storage_path('app/public/videos/' . $video->filename);
if (!file_exists($path)) {
abort(404, 'Video file not found');
}
$video->delete();
$fileSize = filesize($path);
$mimeType = $video->mime_type ?: 'video/mp4';
return redirect()->route('videos.index')
->with('success', 'Video deleted successfully!');
$handle = fopen($path, 'rb');
if (!$handle) {
abort(500, 'Cannot open video file');
}
$range = request()->header('Range');
if ($range) {
// Parse range header
preg_match('/bytes=(\d+)-(\d*)/', $range, $matches);
$start = intval($matches[1] ?? 0);
$end = $matches[2] ? intval($matches[2]) : $fileSize - 1;
$length = $end - $start + 1;
header('HTTP/1.1 206 Partial Content');
header('Content-Type: ' . $mimeType);
header('Content-Length: ' . $length);
header('Content-Range: bytes ' . $start . '-' . $end . '/' . $fileSize);
header('Accept-Ranges: bytes');
header('Cache-Control: public, max-age=3600');
fseek($handle, $start);
$chunkSize = 8192;
$bytesToRead = $length;
while (!feof($handle) && $bytesToRead > 0) {
$buffer = fread($handle, min($chunkSize, $bytesToRead));
echo $buffer;
flush();
$bytesToRead -= strlen($buffer);
}
fclose($handle);
exit;
} else {
// No range requested, stream entire file
header('Content-Type: ' . $mimeType);
header('Content-Length: ' . $fileSize);
header('Accept-Ranges: bytes');
header('Cache-Control: public, max-age=3600');
fpassthru($handle);
fclose($handle);
exit;
}
}
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Jobs;
use App\Models\Video;
use FFMpeg\FFMpeg;
use FFMpeg\Format\Video\X264;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
class CompressVideoJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $video;
public function __construct(Video $video)
{
$this->video = $video;
}
public function handle()
{
$video = $this->video;
// Get original file path
$originalPath = storage_path('app/' . $video->path);
if (!file_exists($originalPath)) {
Log::error('CompressVideoJob: Original file not found: ' . $originalPath);
return;
}
// Create compressed filename
$compressedFilename = 'compressed_' . $video->filename;
$compressedPath = storage_path('app/public/videos/' . $compressedFilename);
try {
$ffmpeg = FFMpeg::create();
$ffmpegVideo = $ffmpeg->open($originalPath);
// Use CRF 18 for high quality (lower = better quality, 18-23 is good range)
// Use 'slow' preset for better compression efficiency
$format = new X264('aac', 'libx264');
$format->setKiloBitrate(0); // 0 = use CRF
$format->setAudioKiloBitrate(192);
// Add CRF option for high quality
$ffmpegVideo->save($format, $compressedPath);
// Check if compressed file was created and is smaller
if (file_exists($compressedPath)) {
$originalSize = filesize($originalPath);
$compressedSize = filesize($compressedPath);
// Only use compressed file if it's smaller
if ($compressedSize < $originalSize) {
// Delete original and rename compressed
unlink($originalPath);
rename($compressedPath, $originalPath);
// Update video record
$video->update([
'size' => $compressedSize,
'filename' => $video->filename, // Keep same filename
'mime_type' => 'video/mp4',
]);
Log::info('CompressVideoJob: Video compressed successfully', [
'video_id' => $video->id,
'original_size' => $originalSize,
'compressed_size' => $compressedSize,
'saved' => round(($originalSize - $compressedSize) / $originalSize * 100) . '%'
]);
} else {
// Compressed file is larger, delete it
unlink($compressedPath);
Log::info('CompressVideoJob: Compression made file larger, keeping original');
}
}
$video->update(['status' => 'ready']);
} catch (\Exception $e) {
Log::error('CompressVideoJob failed: ' . $e->getMessage());
$video->update(['status' => 'ready']); // Mark as ready anyway
}
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Mail;
use App\Models\Video;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class VideoUploaded extends Mailable
{
use Queueable, SerializesModels;
public function __construct(public Video $video)
{
}
public function envelope(): Envelope
{
return new Envelope(
subject: 'Your video has been uploaded successfully!',
);
}
public function content(): Content
{
return new Content(
view: 'emails.video-uploaded',
);
}
}

View File

@ -12,34 +12,45 @@ class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
'avatar',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
// Relationships
public function videos()
{
return $this->hasMany(Video::class);
}
public function likes()
{
return $this->belongsToMany(Video::class, 'video_likes')->withTimestamps();
}
public function views()
{
return $this->belongsToMany(Video::class, 'video_views')->withTimestamps();
}
public function getAvatarUrlAttribute()
{
if ($this->avatar) {
return asset('storage/avatars/' . $this->avatar);
}
return 'https://i.pravatar.cc/150?u=' . $this->id;
}
}

View File

@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
class Video extends Model
{
protected $fillable = [
'user_id',
'title',
'description',
'filename',
@ -14,14 +15,38 @@ class Video extends Model
'thumbnail',
'duration',
'size',
'mime_type',
'orientation',
'width',
'height',
'status',
'visibility',
];
protected $casts = [
'duration' => 'integer',
'size' => 'integer',
'width' => 'integer',
'height' => 'integer',
];
// Relationships
public function user()
{
return $this->belongsTo(User::class);
}
public function likes()
{
return $this->belongsToMany(User::class, 'video_likes')->withTimestamps();
}
public function viewers()
{
return $this->belongsToMany(User::class, 'video_views')->withTimestamps();
}
// Accessors
public function getUrlAttribute()
{
return asset('storage/videos/' . $this->filename);
@ -34,4 +59,83 @@ class Video extends Model
}
return asset('images/video-placeholder.jpg');
}
// Check if video is liked by user
public function isLikedBy($user)
{
if (!$user) return false;
return $this->likes()->where('user_id', $user->id)->exists();
}
// Get like count
public function getLikeCountAttribute()
{
return $this->likes()->count();
}
// Get view count
public function getViewCountAttribute()
{
return $this->viewers()->count();
}
// Get shareable URL for the video
public function getShareUrlAttribute()
{
return route('videos.show', $this->id);
}
// Visibility helpers
public function isPublic()
{
return $this->visibility === 'public';
}
public function isUnlisted()
{
return $this->visibility === 'unlisted';
}
public function isPrivate()
{
return $this->visibility === 'private';
}
// Check if user can view this video
public function canView($user = null)
{
// Owner can always view
if ($user && $this->user_id === $user->id) {
return true;
}
// Public and unlisted videos can be viewed by anyone
return in_array($this->visibility, ['public', 'unlisted']);
}
// Check if video is shareable
public function isShareable()
{
// Only public and unlisted videos are shareable
return in_array($this->visibility, ['public', 'unlisted']);
}
// Scope for public videos (home page, search)
public function scopePublic($query)
{
return $query->where('visibility', 'public');
}
// Scope for videos visible to a specific user
public function scopeVisibleTo($query, $user = null)
{
if ($user) {
return $query->where(function ($q) use ($user) {
$q->where('visibility', '!=', 'private')
->orWhere('user_id', $user->id);
});
}
return $query->where('visibility', '!=', 'private');
}
}

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create('video_likes', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->foreignId('video_id')->constrained()->onDelete('cascade');
$table->timestamps();
$table->unique(['user_id', 'video_id']);
});
}
public function down()
{
Schema::dropIfExists('video_likes');
}
};

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create('video_views', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->foreignId('video_id')->constrained()->onDelete('cascade');
$table->timestamp('watched_at')->useCurrent();
$table->index(['user_id', 'watched_at']);
$table->index(['video_id', 'watched_at']);
});
}
public function down()
{
Schema::dropIfExists('video_views');
}
};

View File

@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('avatar')->nullable()->after('email');
});
}
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('avatar');
});
}
};

View File

@ -10,6 +10,7 @@ return new class extends Migration
{
Schema::create('videos', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->string('title');
$table->text('description')->nullable();
$table->string('filename');
@ -17,6 +18,10 @@ return new class extends Migration
$table->string('thumbnail')->nullable();
$table->integer('duration')->default(0);
$table->bigInteger('size')->default(0);
$table->string('mime_type')->nullable();
$table->enum('orientation', ['landscape', 'portrait', 'square', 'ultrawide'])->default('landscape');
$table->integer('width')->nullable();
$table->integer('height')->nullable();
$table->enum('status', ['pending', 'processing', 'ready', 'failed'])->default('pending');
$table->timestamps();
});

View File

@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table('videos', function (Blueprint $table) {
$table->enum('visibility', ['public', 'unlisted', 'private'])->default('public')->after('status');
});
}
public function down()
{
Schema::table('videos', function (Blueprint $table) {
$table->dropColumn('visibility');
});
}
};

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
}
};

View File

@ -0,0 +1,145 @@
@extends('layouts.plain')
@section('title', 'Login | TAKEONE')
@section('extra_styles')
<style>
.auth-container {
width: 100%;
max-width: 400px;
margin: 0 auto;
}
.auth-card {
background: var(--bg-secondary);
border-radius: 12px;
padding: 32px;
}
.auth-logo {
text-align: center;
margin-bottom: 24px;
}
.auth-logo a {
font-size: 28px;
font-weight: 700;
color: var(--brand-red);
text-decoration: none;
}
.auth-title {
text-align: center;
font-size: 24px;
font-weight: 500;
margin-bottom: 24px;
}
.form-group {
margin-bottom: 16px;
}
.form-label {
display: block;
margin-bottom: 8px;
font-weight: 500;
}
.form-input {
width: 100%;
background: #121212;
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 12px 16px;
color: var(--text-primary);
font-size: 14px;
}
.form-input:focus {
outline: none;
border-color: var(--brand-red);
}
.btn-primary {
width: 100%;
background: var(--brand-red);
color: white;
border: none;
padding: 14px 24px;
border-radius: 8px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
margin-top: 8px;
}
.btn-primary:hover {
background: #cc1a1a;
}
.auth-footer {
text-align: center;
margin-top: 24px;
color: var(--text-secondary);
}
.auth-footer a {
color: var(--brand-red);
text-decoration: none;
}
.auth-footer a:hover {
text-decoration: underline;
}
.error-message {
background: rgba(239, 68, 68, 0.2);
border: 1px solid #ef4444;
color: #ef4444;
padding: 12px;
border-radius: 8px;
margin-bottom: 16px;
font-size: 14px;
}
</style>
@endsection
@section('content')
<div class="auth-container">
<div class="auth-card">
<div class="auth-logo">
<a href="/videos">TAKEONE</a>
</div>
<h1 class="auth-title">Sign in</h1>
@if($errors->any())
<div class="error-message">
{{ $errors->first() }}
</div>
@endif
<form method="POST" action="{{ route('login.store') }}">
@csrf
<div class="form-group">
<label class="form-label">Email</label>
<input type="email" name="email" class="form-input" required autofocus>
</div>
<div class="form-group">
<label class="form-label">Password</label>
<input type="password" name="password" class="form-input" required>
</div>
<button type="submit" class="btn-primary">Sign in</button>
</form>
<div class="auth-footer">
Don't have an account? <a href="{{ route('register') }}">Sign up</a>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,155 @@
@extends('layouts.plain')
@section('title', 'Register | TAKEONE')
@section('extra_styles')
<style>
.auth-container {
width: 100%;
max-width: 400px;
margin: 0 auto;
}
.auth-card {
background: var(--bg-secondary);
border-radius: 12px;
padding: 32px;
}
.auth-logo {
text-align: center;
margin-bottom: 24px;
}
.auth-logo a {
font-size: 28px;
font-weight: 700;
color: var(--brand-red);
text-decoration: none;
}
.auth-title {
text-align: center;
font-size: 24px;
font-weight: 500;
margin-bottom: 24px;
}
.form-group {
margin-bottom: 16px;
}
.form-label {
display: block;
margin-bottom: 8px;
font-weight: 500;
}
.form-input {
width: 100%;
background: #121212;
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 12px 16px;
color: var(--text-primary);
font-size: 14px;
}
.form-input:focus {
outline: none;
border-color: var(--brand-red);
}
.btn-primary {
width: 100%;
background: var(--brand-red);
color: white;
border: none;
padding: 14px 24px;
border-radius: 8px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
margin-top: 8px;
}
.btn-primary:hover {
background: #cc1a1a;
}
.auth-footer {
text-align: center;
margin-top: 24px;
color: var(--text-secondary);
}
.auth-footer a {
color: var(--brand-red);
text-decoration: none;
}
.auth-footer a:hover {
text-decoration: underline;
}
.error-message {
background: rgba(239, 68, 68, 0.2);
border: 1px solid #ef4444;
color: #ef4444;
padding: 12px;
border-radius: 8px;
margin-bottom: 16px;
font-size: 14px;
}
</style>
@endsection
@section('content')
<div class="auth-container">
<div class="auth-card">
<div class="auth-logo">
<a href="/videos">TAKEONE</a>
</div>
<h1 class="auth-title">Create Account</h1>
@if($errors->any())
<div class="error-message">
{{ $errors->first() }}
</div>
@endif
<form method="POST" action="{{ route('register.store') }}">
@csrf
<div class="form-group">
<label class="form-label">Name</label>
<input type="text" name="name" class="form-input" required autofocus>
</div>
<div class="form-group">
<label class="form-label">Email</label>
<input type="email" name="email" class="form-input" required>
</div>
<div class="form-group">
<label class="form-label">Password</label>
<input type="password" name="password" class="form-input" required>
</div>
<div class="form-group">
<label class="form-label">Confirm Password</label>
<input type="password" name="password_confirmation" class="form-input" required>
</div>
<button type="submit" class="btn-primary">Create Account</button>
</form>
<div class="auth-footer">
Already have an account? <a href="{{ route('login') }}">Sign in</a>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
.container { max-width: 600px; margin: 0 auto; padding: 20px; }
.header { background: #e61e1e; color: white; padding: 20px; text-align: center; }
.content { padding: 20px; background: #f9f9f9; }
.footer { text-align: center; padding: 20px; color: #666; font-size: 12px; }
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>TAKEONE</h1>
</div>
<div class="content">
<h2>Video Uploaded Successfully! 🎉</h2>
<p>Hi {{ $video->user->name }},</p>
<p>Your video <strong>"{{ $video->title }}"</strong> has been uploaded successfully!</p>
<p>Your video is now being processed and will be available shortly.</p>
<p>Video Details:</p>
<ul>
<li>Size: {{ round($video->size / 1024 / 1024, 2) }} MB</li>
<li>Orientation: {{ $video->orientation }}</li>
</ul>
<p><a href="{{ url('/videos/' . $video->id) }}" style="background: #e61e1e; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px;">View Video</a></p>
</div>
<div class="footer">
<p>TAKEONE Video Platform</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,430 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@yield('title', 'TAKEONE')</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<style>
:root {
--brand-red: #e61e1e;
--bg-dark: #0f0f0f;
--bg-secondary: #1e1e1e;
--border-color: #303030;
--text-primary: #f1f1f1;
--text-secondary: #aaaaaa;
}
* { box-sizing: border-box; }
body {
background-color: var(--bg-dark);
color: var(--text-primary);
font-family: "Roboto", "Arial", sans-serif;
margin: 0;
padding: 0;
overflow-x: hidden;
}
/* Header */
.yt-header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 56px;
background: var(--bg-dark);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
z-index: 1000;
border-bottom: 1px solid var(--border-color);
}
.yt-header-left {
display: flex;
align-items: center;
gap: 16px;
}
.yt-menu-btn {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background 0.2s;
background: transparent;
border: none;
color: var(--text-primary);
}
.yt-menu-btn:hover { background: var(--border-color); }
.yt-logo {
display: flex;
align-items: center;
text-decoration: none;
gap: 4px;
}
.yt-logo-text {
font-size: 1.4rem;
font-weight: 700;
color: var(--text-primary);
letter-spacing: -1px;
}
/* Search */
.yt-header-center {
flex: 1;
max-width: 640px;
margin: 0 40px;
display: flex;
}
.yt-search {
flex: 1;
display: flex;
height: 40px;
}
.yt-search-input {
flex: 1;
background: #121212;
border: 1px solid var(--border-color);
border-right: none;
border-radius: 20px 0 0 20px;
padding: 0 16px;
color: var(--text-primary);
font-size: 16px;
}
.yt-search-input:focus {
outline: none;
border-color: #1c62b9;
}
.yt-search-btn {
width: 64px;
background: #222;
border: 1px solid var(--border-color);
border-radius: 0 20px 20px 0;
color: var(--text-primary);
cursor: pointer;
}
.yt-search-btn:hover { background: #303030; }
.yt-search-voice {
width: 40px;
height: 40px;
border-radius: 50%;
background: var(--bg-secondary);
border: none;
color: var(--text-primary);
margin-left: 8px;
cursor: pointer;
}
/* Header Right */
.yt-header-right {
display: flex;
align-items: center;
gap: 8px;
}
.yt-icon-btn {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
background: transparent;
border: none;
color: var(--text-primary);
font-size: 1.2rem;
}
.yt-icon-btn:hover { background: var(--border-color); }
.yt-user-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background: #555;
cursor: pointer;
}
/* Sidebar */
.yt-sidebar {
position: fixed;
top: 56px;
left: 0;
bottom: 0;
width: 240px;
background: var(--bg-dark);
overflow-y: auto;
padding: 12px;
transition: transform 0.3s;
z-index: 999;
}
.yt-sidebar-section {
padding-bottom: 12px;
border-bottom: 1px solid var(--border-color);
margin-bottom: 12px;
}
.yt-sidebar-link {
display: flex;
align-items: center;
gap: 20px;
padding: 0 12px;
height: 40px;
border-radius: 10px;
color: var(--text-primary);
text-decoration: none;
cursor: pointer;
transition: background 0.2s;
}
.yt-sidebar-link:hover { background: var(--border-color); }
.yt-sidebar-link.active {
background: var(--border-color);
font-weight: 500;
}
.yt-sidebar-link i { font-size: 1.2rem; }
/* Mobile sidebar overlay */
.yt-sidebar-overlay {
position: fixed;
top: 56px;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
z-index: 998;
display: none;
}
.yt-sidebar-overlay.show { display: block; }
/* Main Content */
.yt-main {
margin-top: 56px;
margin-left: 240px;
padding: 24px;
min-height: calc(100vh - 56px);
transition: margin-left 0.3s;
}
/* Upload Button */
.yt-upload-btn {
background: var(--brand-red);
color: white;
border: none;
padding: 8px 16px;
border-radius: 20px;
font-weight: 500;
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
text-decoration: none;
}
.yt-upload-btn:hover { background: #cc1a1a; }
/* Mobile circle button */
@media (max-width: 576px) {
.yt-upload-btn {
width: 40px;
height: 40px;
padding: 0;
border-radius: 50%;
justify-content: center;
}
.yt-upload-btn span { display: none; }
}
/* Responsive */
@media (min-width: 992px) {
.yt-sidebar.collapsed {
transform: translateX(-100%);
}
.yt-main.collapsed {
margin-left: 0;
}
}
@media (max-width: 991px) {
.yt-sidebar {
transform: translateX(-100%);
}
.yt-sidebar.open {
transform: translateX(0);
}
.yt-main {
margin-left: 0;
}
.yt-search-voice { display: none; }
}
@media (max-width: 768px) {
.yt-header-center { display: none; }
.yt-main { padding: 16px; }
}
/* Mobile Search */
.mobile-search {
display: none;
padding: 10px 16px;
border-bottom: 1px solid var(--border-color);
}
@media (max-width: 991px) {
.mobile-search { display: block; }
}
/* Dropdown */
.dropdown-menu-dark {
background: var(--bg-secondary);
border: 1px solid var(--border-color);
}
.dropdown-item {
color: var(--text-primary);
}
.dropdown-item:hover {
background: var(--border-color);
color: var(--text-primary);
}
</style>
@yield('extra_styles')
</head>
<body class="{{ $bodyClass ?? '' }}">
<!-- Header -->
@include('layouts.partials.header')
<!-- Sidebar Overlay (Mobile) -->
<div class="yt-sidebar-overlay" onclick="toggleSidebar()"></div>
<!-- Sidebar -->
@include('layouts.partials.sidebar')
<!-- Main Content -->
<main class="yt-main" id="main">
<!-- Mobile Search -->
<div class="mobile-search">
<div class="yt-search">
<input type="text" class="yt-search-input" placeholder="Search">
<button class="yt-search-btn">
<i class="bi bi-search"></i>
</button>
</div>
</div>
@yield('content')
</main>
<!-- Upload Modal -->
@auth
@include('layouts.partials.upload-modal')
@endauth
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Sidebar toggle function
function toggleSidebar() {
const sidebar = document.getElementById('sidebar');
const overlay = document.querySelector('.yt-sidebar-overlay');
const main = document.getElementById('main');
// Check if we're on mobile or desktop
const isMobile = window.innerWidth < 992;
if (isMobile) {
// Mobile behavior - use 'open' class
sidebar.classList.toggle('open');
overlay.classList.toggle('show');
} else {
// Desktop behavior - use 'collapsed' class
sidebar.classList.toggle('collapsed');
main.classList.toggle('collapsed');
// Save state to localStorage
const isCollapsed = sidebar.classList.contains('collapsed');
localStorage.setItem('sidebarCollapsed', isCollapsed);
}
}
// Restore sidebar state from localStorage on page load
function restoreSidebarState() {
const sidebar = document.getElementById('sidebar');
const main = document.getElementById('main');
const isMobile = window.innerWidth < 992;
// Only restore on desktop
if (!isMobile) {
const savedState = localStorage.getItem('sidebarCollapsed');
if (savedState === 'true') {
sidebar.classList.add('collapsed');
main.classList.add('collapsed');
}
}
}
// Set active sidebar link based on current route
document.addEventListener('DOMContentLoaded', function() {
// Restore sidebar state
restoreSidebarState();
const currentPath = window.location.pathname;
const sidebarLinks = document.querySelectorAll('.yt-sidebar-link');
sidebarLinks.forEach(link => {
const href = link.getAttribute('href');
if (href === currentPath || (currentPath.startsWith(href) && href !== '/')) {
link.classList.add('active');
} else if (href === '/' && currentPath === '/') {
link.classList.add('active');
}
});
});
// Handle window resize to reset state for mobile
window.addEventListener('resize', function() {
const sidebar = document.getElementById('sidebar');
const main = document.getElementById('main');
const isMobile = window.innerWidth < 992;
if (isMobile) {
// On mobile, remove collapsed state
sidebar.classList.remove('collapsed');
main.classList.remove('collapsed');
} else {
// On desktop, restore from localStorage
restoreSidebarState();
}
});
</script>
@yield('scripts')
</body>
</html>

View File

@ -0,0 +1,62 @@
<!-- Header -->
<header class="yt-header">
<div class="yt-header-left">
<button class="yt-menu-btn" onclick="toggleSidebar()">
<i class="bi bi-list fs-5"></i>
</button>
<a href="/videos" class="yt-logo">
<span class="yt-logo-text">TAKEONE</span>
</a>
</div>
<div class="yt-header-center d-none d-md-flex">
<form action="{{ route('videos.search') }}" method="GET" class="yt-search">
<input type="text" name="q" class="yt-search-input" placeholder="Search" value="{{ request('q') }}">
<button type="submit" class="yt-search-btn">
<i class="bi bi-search"></i>
</button>
</form>
<button class="yt-search-voice">
<i class="bi bi-mic-fill"></i>
</button>
</div>
<div class="yt-header-right">
@auth
<button type="button" class="yt-upload-btn" onclick="openUploadModal()">
<i class="bi bi-plus-lg"></i>
<span>Upload</span>
</button>
<!-- User Dropdown -->
<div class="dropdown">
<button class="yt-icon-btn" data-bs-toggle="dropdown" aria-expanded="false">
@if(Auth::user()->avatar)
<img src="{{ asset('storage/avatars/' . Auth::user()->avatar) }}" class="yt-user-avatar" alt="User">
@else
<img src="https://i.pravatar.cc/150?u={{ Auth::user()->id }}" class="yt-user-avatar" alt="User">
@endif
</button>
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-dark">
<li><a class="dropdown-item" href="{{ route('profile') }}"><i class="bi bi-person"></i> Profile</a></li>
<li><a class="dropdown-item" href="{{ route('channel', Auth::user()->id) }}"><i class="bi bi-play-btn"></i> My Channel</a></li>
<li><a class="dropdown-item" href="{{ route('settings') }}"><i class="bi bi-gear"></i> Settings</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<form method="POST" action="{{ route('logout') }}" class="m-0">
@csrf
<button type="submit" class="dropdown-item text-danger"><i class="bi bi-box-arrow-right"></i> Logout</button>
</form>
</li>
</ul>
</div>
@else
<!-- Login/Register for visitors -->
<a href="{{ route('login') }}" class="yt-upload-btn">
<i class="bi bi-box-arrow-in-right"></i>
<span>Login</span>
</a>
@endauth
</div>
</header>

View File

@ -0,0 +1,124 @@
<!-- Share Modal -->
<div class="modal fade" id="shareModal" tabindex="-1" aria-labelledby="shareModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content" style="background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 16px;">
<div class="modal-header" style="border-bottom: 1px solid var(--border-color); padding: 20px 24px;">
<h5 class="modal-title" id="shareModalLabel" style="font-weight: 600; color: var(--text-primary);">
<i class="bi bi-share me-2"></i>Share Video
</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" style="padding: 24px;">
<p style="color: var(--text-secondary); margin-bottom: 16px;">Share this video with your friends:</p>
<div class="share-link-container" style="display: flex; gap: 8px; align-items: center;">
<input type="text" id="shareLinkInput" class="form-control" readonly
style="background: var(--bg-primary); border: 1px solid var(--border-color); color: var(--text-primary); padding: 12px 16px; border-radius: 8px;">
<button type="button" id="copyLinkBtn" class="btn-copy"
style="background: var(--brand-red); color: white; border: none; padding: 12px 20px; border-radius: 8px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background 0.2s;">
<i class="bi bi-clipboard me-1"></i> Copy
</button>
</div>
<div id="copySuccess" class="copy-success" style="display: none; margin-top: 12px; color: #4caf50; font-size: 14px; text-align: center;">
<i class="bi bi-check-circle-fill me-1"></i> Link copied to clipboard!
</div>
<div style="margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border-color);">
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: 12px;">Share on social media:</p>
<div style="display: flex; gap: 12px;">
<a href="#" id="shareFacebook" class="social-share-btn" target="_blank"
style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: #1877f2; color: white; text-decoration: none;">
<i class="bi bi-facebook"></i>
</a>
<a href="#" id="shareTwitter" class="social-share-btn" target="_blank"
style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: #1da1f2; color: white; text-decoration: none;">
<i class="bi bi-twitter-x"></i>
</a>
<a href="#" id="shareWhatsApp" class="social-share-btn" target="_blank"
style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: #25d366; color: white; text-decoration: none;">
<i class="bi bi-whatsapp"></i>
</a>
<a href="#" id="shareTelegram" class="social-share-btn" target="_blank"
style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: #0088cc; color: white; text-decoration: none;">
<i class="bi bi-telegram"></i>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<style>
.social-share-btn {
transition: transform 0.2s, opacity 0.2s;
}
.social-share-btn:hover {
transform: scale(1.1);
opacity: 0.9;
}
.btn-copy:hover {
background: #cc1a1a !important;
}
.btn-copy.copied {
background: #4caf50 !important;
}
</style>
<script>
function openShareModal(videoUrl, videoTitle) {
document.getElementById('shareLinkInput').value = videoUrl;
// Update social share links
var encodedUrl = encodeURIComponent(videoUrl);
var encodedTitle = encodeURIComponent(videoTitle);
document.getElementById('shareFacebook').href = 'https://www.facebook.com/sharer/sharer.php?u=' + encodedUrl;
document.getElementById('shareTwitter').href = 'https://twitter.com/intent/tweet?url=' + encodedUrl + '&text=' + encodedTitle;
document.getElementById('shareWhatsApp').href = 'https://wa.me/?text=' + encodedTitle + ' ' + encodedUrl;
document.getElementById('shareTelegram').href = 'https://t.me/share/url?url=' + encodedUrl + '&text=' + encodedTitle;
// Reset copy button state
var copyBtn = document.getElementById('copyLinkBtn');
copyBtn.innerHTML = '<i class="bi bi-clipboard me-1"></i> Copy';
copyBtn.classList.remove('copied');
document.getElementById('copySuccess').style.display = 'none';
// Show modal
var modal = new bootstrap.Modal(document.getElementById('shareModal'));
modal.show();
}
document.addEventListener('DOMContentLoaded', function() {
var copyBtn = document.getElementById('copyLinkBtn');
var shareInput = document.getElementById('shareLinkInput');
var copySuccess = document.getElementById('copySuccess');
if (copyBtn && shareInput) {
copyBtn.addEventListener('click', function() {
shareInput.select();
shareInput.setSelectionRange(0, 99999);
navigator.clipboard.writeText(shareInput.value).then(function() {
copyBtn.innerHTML = '<i class="bi bi-check-lg me-1"></i> Copied!';
copyBtn.classList.add('copied');
copySuccess.style.display = 'block';
setTimeout(function() {
copyBtn.innerHTML = '<i class="bi bi-clipboard me-1"></i> Copy';
copyBtn.classList.remove('copied');
copySuccess.style.display = 'none';
}, 2000);
}).catch(function(err) {
console.error('Failed to copy: ', err);
// Fallback for older browsers
document.execCommand('copy');
copyBtn.innerHTML = '<i class="bi bi-check-lg me-1"></i> Copied!';
copySuccess.style.display = 'block';
});
});
}
});
</script>

View File

@ -0,0 +1,37 @@
<!-- Sidebar -->
<nav class="yt-sidebar" id="sidebar">
<div class="yt-sidebar-section">
<a href="/videos" class="yt-sidebar-link {{ request()->is('/') || request()->is('videos') ? 'active' : '' }}">
<i class="bi bi-house-door-fill"></i>
<span>Home</span>
</a>
<a href="#" class="yt-sidebar-link">
<i class="bi bi-play-btn"></i>
<span>Shorts</span>
</a>
@auth
<a href="#" class="yt-sidebar-link">
<i class="bi bi-collection-play"></i>
<span>Subscriptions</span>
</a>
@endauth
</div>
@auth
<div class="yt-sidebar-section">
<a href="{{ route('channel', Auth::user()->id) }}" class="yt-sidebar-link">
<i class="bi bi-person-video"></i>
<span>Your Channel</span>
</a>
<a href="{{ route('history') }}" class="yt-sidebar-link">
<i class="bi bi-clock-history"></i>
<span>History</span>
</a>
<a href="{{ route('liked') }}" class="yt-sidebar-link">
<i class="bi bi-hand-thumbs-up"></i>
<span>Liked Videos</span>
</a>
</div>
@endauth
</nav>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@yield('title', 'TAKEONE')</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<style>
:root {
--brand-red: #e61e1e;
--bg-dark: #0f0f0f;
--bg-secondary: #1e1e1e;
--border-color: #303030;
--text-primary: #f1f1f1;
--text-secondary: #aaaaaa;
}
* { box-sizing: border-box; }
body {
background-color: var(--bg-dark);
color: var(--text-primary);
font-family: "Roboto", "Arial", sans-serif;
margin: 0;
padding: 0;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.plain-main {
width: 100%;
padding: 20px;
}
/* Dropdown */
.dropdown-menu-dark {
background: var(--bg-secondary);
border: 1px solid var(--border-color);
}
.dropdown-item {
color: var(--text-primary);
}
.dropdown-item:hover {
background: var(--border-color);
color: var(--text-primary);
}
</style>
@yield('extra_styles')
</head>
<body>
<!-- Main Content - No header or sidebar -->
<main class="plain-main">
@yield('content')
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
@yield('scripts')
</body>
</html>

View File

@ -0,0 +1,372 @@
@extends('layouts.app')
@section('title', $user->name . "'s Channel | TAKEONE")
@section('extra_styles')
<style>
.channel-header {
background: var(--bg-secondary);
border-radius: 12px;
padding: 32px;
margin-bottom: 24px;
}
.channel-avatar {
width: 120px;
height: 120px;
border-radius: 50%;
object-fit: cover;
}
.channel-name {
font-size: 24px;
font-weight: 500;
margin: 16px 0 4px;
}
.channel-meta {
color: var(--text-secondary);
}
.channel-stats {
display: flex;
gap: 24px;
margin-top: 16px;
}
.channel-stat-value {
font-weight: 600;
}
/* Video Grid */
.yt-video-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 24px;
}
.yt-video-card {
cursor: pointer;
}
.yt-video-thumb {
position: relative;
aspect-ratio: 16/9;
border-radius: 12px;
overflow: hidden;
background: #1a1a1a;
}
.yt-video-thumb img {
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
top: 0;
left: 0;
}
.yt-video-thumb video {
width: 100%;
height: 100%;
object-fit: contain;
position: absolute;
top: 0;
left: 0;
opacity: 0;
transition: opacity 0.3s ease;
background: #000;
}
.yt-video-thumb video.active {
opacity: 1;
}
.yt-video-duration {
position: absolute;
bottom: 8px;
right: 8px;
background: rgba(0,0,0,0.8);
color: white;
padding: 3px 6px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
}
.yt-video-info {
display: flex;
margin-top: 12px;
gap: 12px;
}
.yt-channel-icon {
width: 36px;
height: 36px;
border-radius: 50%;
background: #555;
flex-shrink: 0;
}
.yt-video-details {
flex: 1;
}
.yt-video-title {
font-size: 16px;
font-weight: 500;
color: var(--text-primary);
margin: 0 0 4px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
line-height: 1.3;
}
.yt-video-title a {
color: inherit;
text-decoration: none;
}
.yt-channel-name, .yt-video-meta {
color: var(--text-secondary);
font-size: 14px;
}
/* More button */
.yt-more-btn {
background: transparent;
border: none;
color: var(--text-primary);
cursor: pointer;
padding: 4px;
border-radius: 50%;
}
.yt-more-dropdown {
background: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 8px 0;
min-width: 200px;
}
.yt-more-dropdown-item {
display: flex;
align-items: center;
gap: 16px;
padding: 10px 16px;
color: var(--text-primary);
text-decoration: none;
cursor: pointer;
background: transparent;
border: none;
width: 100%;
text-align: left;
font-size: 14px;
}
.yt-more-dropdown-item:hover { background: var(--border-color); }
/* Empty State */
.yt-empty {
text-align: center;
padding: 80px 20px;
}
.yt-empty-icon {
font-size: 80px;
color: var(--text-secondary);
}
.yt-empty-title {
font-size: 24px;
margin: 20px 0 8px;
}
.yt-empty-text {
color: var(--text-secondary);
margin-bottom: 20px;
}
.yt-upload-btn {
background: var(--brand-red);
color: white;
border: none;
padding: 8px 16px;
border-radius: 20px;
font-weight: 500;
display: inline-flex;
align-items: center;
gap: 8px;
cursor: pointer;
text-decoration: none;
}
.yt-upload-btn:hover {
background: #cc1a1a;
}
@media (max-width: 768px) {
.yt-video-grid {
grid-template-columns: 1fr 1fr;
}
}
@media (max-width: 480px) {
.yt-video-grid {
grid-template-columns: 1fr;
}
}
</style>
@endsection
@section('content')
<div class="channel-header">
<div class="d-flex align-items-center gap-4 flex-wrap">
@if($user->avatar)
<img src="{{ asset('storage/avatars/' . $user->avatar) }}" alt="{{ $user->name }}" class="channel-avatar">
@else
<img src="https://i.pravatar.cc/150?u={{ $user->id }}" alt="{{ $user->name }}" class="channel-avatar">
@endif
<div>
<h1 class="channel-name">{{ $user->name }}</h1>
<p class="channel-meta">Joined {{ $user->created_at->format('F d, Y') }}</p>
<div class="channel-stats">
<div>
<span class="channel-stat-value">{{ $videos->total() }}</span>
<span class="channel-meta"> videos</span>
</div>
<div>
<span class="channel-stat-value">{{ \DB::table('video_views')->whereIn('video_id', $user->videos->pluck('id'))->count() }}</span>
<span class="channel-meta"> views</span>
</div>
</div>
@auth
@if(Auth::user()->id === $user->id)
<div style="margin-top: 16px;">
<a href="{{ route('videos.create') }}" class="yt-upload-btn">
<i class="bi bi-plus-lg"></i> Upload Video
</a>
<a href="{{ route('profile') }}" class="yt-upload-btn" style="background: var(--bg-dark); margin-left: 8px;">
<i class="bi bi-pencil"></i> Edit Channel
</a>
</div>
@endif
@endauth
</div>
</div>
</div>
@if($videos->isEmpty())
<div class="yt-empty">
<i class="bi bi-camera-video yt-empty-icon"></i>
<h2 class="yt-empty-title">No videos yet</h2>
<p class="yt-empty-text">This channel hasn't uploaded any videos.</p>
@auth
@if(Auth::user()->id === $user->id)
<a href="{{ route('videos.create') }}" class="yt-upload-btn">
<i class="bi bi-plus-lg"></i> Upload First Video
</a>
@endif
@endauth
</div>
@else
<div class="yt-video-grid">
@foreach($videos as $video)
<div class="yt-video-card"
data-video-url="{{ asset('storage/videos/' . $video->filename) }}"
onmouseenter="playVideo(this)"
onmouseleave="stopVideo(this)">
<a href="{{ route('videos.show', $video->id) }}">
<div class="yt-video-thumb">
@if($video->thumbnail)
<img src="{{ asset('storage/thumbnails/' . $video->thumbnail) }}" alt="{{ $video->title }}">
@else
<img src="https://picsum.photos/seed/{{ $video->id }}/640/360" alt="{{ $video->title }}">
@endif
<video preload="none">
<source src="{{ asset('storage/videos/' . $video->filename) }}" type="{{ $video->mime_type ?? 'video/mp4' }}">
</video>
@if($video->duration)
<span class="yt-video-duration">{{ gmdate('i:s', $video->duration) }}</span>
@endif
</div>
</a>
<div class="yt-video-info">
<div class="yt-channel-icon">
@if($video->user && $video->user->avatar_url)
<img src="{{ $video->user->avatar_url }}" alt="{{ $video->user->name }}" style="width: 100%; height: 100%; object-fit: cover; border-radius: 50%;">
@endif
</div>
<div class="yt-video-details">
<h3 class="yt-video-title">
<a href="{{ route('videos.show', $video->id) }}">{{ $video->title }}</a>
</h3>
<div class="yt-channel-name">{{ $video->user->name ?? 'Unknown' }}</div>
<div class="yt-video-meta">
{{ number_format($video->size / 1024 / 1024, 0) }} MB {{ $video->created_at->diffForHumans() }}
</div>
</div>
<div class="position-relative">
<button class="yt-more-btn" data-bs-toggle="dropdown">
<i class="bi bi-three-dots-vertical"></i>
</button>
<ul class="dropdown-menu dropdown-menu-dark yt-more-dropdown dropdown-menu-end">
@if($video->isShareable())
<li>
<button class="yt-more-dropdown-item" onclick="openShareModal('{{ $video->share_url }}', '{{ addslashes($video->title) }}')">
<i class="bi bi-share"></i> Share
</button>
</li>
@endif
<li><a class="yt-more-dropdown-item" href="{{ route('videos.edit', $video->id) }}"><i class="bi bi-pencil"></i> Edit</a></li>
<li><a class="yt-more-dropdown-item" href="{{ route('videos.show', $video->id) }}"><i class="bi bi-play"></i> Play</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<form action="{{ route('videos.destroy', $video->id) }}" method="POST" onsubmit="return confirm('Delete this video?');" class="m-0">
@csrf @method('DELETE')
<button type="submit" class="yt-more-dropdown-item text-danger"><i class="bi bi-trash"></i> Delete</button>
</form>
</li>
</ul>
</div>
</div>
</div>
@endforeach
</div>
<div class="mt-4">{{ $videos->links() }}</div>
@endif
@include('layouts.partials.share-modal')
@endsection
@section('scripts')
<script>
function playVideo(card) {
const video = card.querySelector('video');
if (video) {
video.currentTime = 0;
video.play().catch(function(e) {
// Auto-play may be blocked, ignore error
});
video.classList.add('active');
}
}
function stopVideo(card) {
const video = card.querySelector('video');
if (video) {
video.pause();
video.currentTime = 0;
video.classList.remove('active');
}
}
</script>
@endsection

View File

@ -0,0 +1,178 @@
@extends('layouts.app')
@section('title', 'Watch History | TAKEONE')
@section('extra_styles')
<style>
.history-header {
margin-bottom: 24px;
}
.history-title {
font-size: 24px;
font-weight: 500;
}
/* Video Grid */
.yt-video-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
}
.yt-video-card {
cursor: pointer;
}
.yt-video-thumb {
position: relative;
aspect-ratio: 16/9;
border-radius: 12px;
overflow: hidden;
background: #1a1a1a;
}
.yt-video-thumb img {
width: 100%;
height: 100%;
object-fit: cover;
}
.yt-video-duration {
position: absolute;
bottom: 8px;
right: 8px;
background: rgba(0,0,0,0.8);
color: white;
padding: 3px 6px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
}
.yt-video-info {
display: flex;
margin-top: 12px;
gap: 12px;
}
.yt-channel-icon {
width: 36px;
height: 36px;
border-radius: 50%;
background: #555;
flex-shrink: 0;
}
.yt-video-details {
flex: 1;
}
.yt-video-title {
font-size: 16px;
font-weight: 500;
color: var(--text-primary);
margin: 0 0 4px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
line-height: 1.3;
}
.yt-video-title a {
color: inherit;
text-decoration: none;
}
.yt-channel-name, .yt-video-meta {
color: var(--text-secondary);
font-size: 14px;
}
/* Empty State */
.yt-empty {
text-align: center;
padding: 80px 20px;
}
.yt-empty-icon {
font-size: 80px;
color: var(--text-secondary);
}
.yt-empty-title {
font-size: 24px;
margin: 20px 0 8px;
}
.yt-empty-text {
color: var(--text-secondary);
margin-bottom: 20px;
}
@media (max-width: 768px) {
.yt-video-grid {
grid-template-columns: 1fr 1fr;
}
}
@media (max-width: 480px) {
.yt-video-grid {
grid-template-columns: 1fr;
}
}
</style>
@endsection
@section('content')
<div class="history-header">
<h1 class="history-title">Watch History</h1>
</div>
@if($videos->isEmpty())
<div class="yt-empty">
<i class="bi bi-clock-history yt-empty-icon"></i>
<h2 class="yt-empty-title">No watch history</h2>
<p class="yt-empty-text">Videos you watch will appear here.</p>
<a href="{{ route('videos.index') }}" class="btn btn-primary" style="background: var(--brand-red); color: white; padding: 10px 20px; border-radius: 20px; text-decoration: none;">
<i class="bi bi-play-btn"></i> Browse Videos
</a>
</div>
@else
<div class="yt-video-grid">
@foreach($videos as $video)
<div class="yt-video-card">
<a href="{{ route('videos.show', $video->id) }}">
<div class="yt-video-thumb">
@if($video->thumbnail)
<img src="{{ asset('storage/thumbnails/' . $video->thumbnail) }}" alt="{{ $video->title }}">
@else
<img src="https://picsum.photos/seed/{{ $video->id }}/640/360" alt="{{ $video->title }}">
@endif
@if($video->duration)
<span class="yt-video-duration">{{ gmdate('i:s', $video->duration) }}</span>
@endif
</div>
</a>
<div class="yt-video-info">
<div class="yt-channel-icon">
@if($video->user && $video->user->avatar_url)
<img src="{{ $video->user->avatar_url }}" alt="{{ $video->user->name }}" style="width: 100%; height: 100%; object-fit: cover; border-radius: 50%;">
@endif
</div>
<div class="yt-video-details">
<h3 class="yt-video-title">
<a href="{{ route('videos.show', $video->id) }}">{{ $video->title }}</a>
</h3>
<div class="yt-video-meta">
{{ $video->user->name ?? 'Unknown' }} {{ number_format($video->size / 1024 / 1024, 0) }} MB
</div>
</div>
</div>
</div>
@endforeach
</div>
@endif
@endsection

View File

@ -0,0 +1,180 @@
@extends('layouts.app')
@section('title', 'Liked Videos | TAKEONE')
@section('extra_styles')
<style>
.liked-header {
margin-bottom: 24px;
}
.liked-title {
font-size: 24px;
font-weight: 500;
}
/* Video Grid */
.yt-video-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
}
.yt-video-card {
cursor: pointer;
}
.yt-video-thumb {
position: relative;
aspect-ratio: 16/9;
border-radius: 12px;
overflow: hidden;
background: #1a1a1a;
}
.yt-video-thumb img {
width: 100%;
height: 100%;
object-fit: cover;
}
.yt-video-duration {
position: absolute;
bottom: 8px;
right: 8px;
background: rgba(0,0,0,0.8);
color: white;
padding: 3px 6px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
}
.yt-video-info {
display: flex;
margin-top: 12px;
gap: 12px;
}
.yt-channel-icon {
width: 36px;
height: 36px;
border-radius: 50%;
background: #555;
flex-shrink: 0;
}
.yt-video-details {
flex: 1;
}
.yt-video-title {
font-size: 16px;
font-weight: 500;
color: var(--text-primary);
margin: 0 0 4px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
line-height: 1.3;
}
.yt-video-title a {
color: inherit;
text-decoration: none;
}
.yt-channel-name, .yt-video-meta {
color: var(--text-secondary);
font-size: 14px;
}
/* Empty State */
.yt-empty {
text-align: center;
padding: 80px 20px;
}
.yt-empty-icon {
font-size: 80px;
color: var(--text-secondary);
}
.yt-empty-title {
font-size: 24px;
margin: 20px 0 8px;
}
.yt-empty-text {
color: var(--text-secondary);
margin-bottom: 20px;
}
@media (max-width: 768px) {
.yt-video-grid {
grid-template-columns: 1fr 1fr;
}
}
@media (max-width: 480px) {
.yt-video-grid {
grid-template-columns: 1fr;
}
}
</style>
@endsection
@section('content')
<div class="liked-header">
<h1 class="liked-title">Liked Videos</h1>
</div>
@if($videos->isEmpty())
<div class="yt-empty">
<i class="bi bi-hand-thumbs-up yt-empty-icon"></i>
<h2 class="yt-empty-title">No liked videos</h2>
<p class="yt-empty-text">Videos you like will appear here.</p>
<a href="{{ route('videos.index') }}" class="btn btn-primary" style="background: var(--brand-red); color: white; padding: 10px 20px; border-radius: 20px; text-decoration: none;">
<i class="bi bi-play-btn"></i> Browse Videos
</a>
</div>
@else
<div class="yt-video-grid">
@foreach($videos as $video)
<div class="yt-video-card">
<a href="{{ route('videos.show', $video->id) }}">
<div class="yt-video-thumb">
@if($video->thumbnail)
<img src="{{ asset('storage/thumbnails/' . $video->thumbnail) }}" alt="{{ $video->title }}">
@else
<img src="https://picsum.photos/seed/{{ $video->id }}/640/360" alt="{{ $video->title }}">
@endif
@if($video->duration)
<span class="yt-video-duration">{{ gmdate('i:s', $video->duration) }}</span>
@endif
</div>
</a>
<div class="yt-video-info">
<div class="yt-channel-icon">
@if($video->user && $video->user->avatar_url)
<img src="{{ $video->user->avatar_url }}" alt="{{ $video->user->name }}" style="width: 100%; height: 100%; object-fit: cover; border-radius: 50%;">
@endif
</div>
<div class="yt-video-details">
<h3 class="yt-video-title">
<a href="{{ route('videos.show', $video->id) }}">{{ $video->title }}</a>
</h3>
<div class="yt-video-meta">
{{ $video->user->name ?? 'Unknown' }} {{ number_format($video->size / 1024 / 1024, 0) }} MB
</div>
</div>
</div>
</div>
@endforeach
</div>
<div class="mt-4">{{ $videos->links() }}</div>
@endif
@endsection

View File

@ -0,0 +1,196 @@
@extends('layouts.app')
@section('title', 'Profile | TAKEONE')
@section('extra_styles')
<style>
.profile-header {
background: var(--bg-secondary);
border-radius: 12px;
padding: 32px;
margin-bottom: 24px;
}
.profile-avatar {
width: 120px;
height: 120px;
border-radius: 50%;
object-fit: cover;
margin-bottom: 16px;
}
.profile-name {
font-size: 24px;
font-weight: 500;
margin-bottom: 4px;
}
.profile-email {
color: var(--text-secondary);
margin-bottom: 16px;
}
.profile-stats {
display: flex;
gap: 24px;
margin-top: 16px;
}
.profile-stat {
text-align: center;
}
.profile-stat-value {
font-size: 20px;
font-weight: 600;
}
.profile-stat-label {
font-size: 14px;
color: var(--text-secondary);
}
.form-card {
background: var(--bg-secondary);
border-radius: 12px;
padding: 24px;
margin-bottom: 24px;
}
.form-title {
font-size: 18px;
font-weight: 500;
margin-bottom: 20px;
padding-bottom: 12px;
border-bottom: 1px solid var(--border-color);
}
.form-group {
margin-bottom: 16px;
}
.form-label {
display: block;
margin-bottom: 8px;
font-weight: 500;
}
.form-input {
width: 100%;
background: #121212;
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 12px 16px;
color: var(--text-primary);
font-size: 14px;
}
.form-input:focus {
outline: none;
border-color: var(--brand-red);
}
.btn-primary {
background: var(--brand-red);
color: white;
border: none;
padding: 12px 24px;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn-primary:hover {
background: #cc1a1a;
}
.alert {
padding: 12px 16px;
border-radius: 8px;
margin-bottom: 16px;
}
.alert-success {
background: rgba(34, 197, 94, 0.2);
border: 1px solid #22c55e;
color: #22c55e;
}
</style>
@endsection
@section('content')
<div class="profile-header text-center">
@if($user->avatar)
<img src="{{ asset('storage/avatars/' . $user->avatar) }}" alt="{{ $user->name }}" class="profile-avatar">
@else
<img src="https://i.pravatar.cc/150?u={{ $user->id }}" alt="{{ $user->name }}" class="profile-avatar">
@endif
<h1 class="profile-name">{{ $user->name }}</h1>
<p class="profile-email">{{ $user->email }}</p>
<div class="profile-stats justify-content-center">
<div class="profile-stat">
<div class="profile-stat-value">{{ $user->videos->count() }}</div>
<div class="profile-stat-label">Videos</div>
</div>
<div class="profile-stat">
<div class="profile-stat-value">{{ $user->likes->count() }}</div>
<div class="profile-stat-label">Likes</div>
</div>
<div class="profile-stat">
<div class="profile-stat-value">{{ \DB::table('video_views')->whereIn('video_id', $user->videos->pluck('id'))->count() }}</div>
<div class="profile-stat-label">Total Views</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="form-card">
<h2 class="form-title">Edit Profile</h2>
@if(session('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
@endif
<form method="POST" action="{{ route('profile.update') }}" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="form-group">
<label class="form-label">Name</label>
<input type="text" name="name" class="form-input" value="{{ old('name', $user->name) }}" required>
</div>
<div class="form-group">
<label class="form-label">Avatar</label>
<input type="file" name="avatar" class="form-input" accept="image/*">
<small class="text-muted">Max size: 5MB. Supported: JPG, PNG, WebP</small>
</div>
<button type="submit" class="btn-primary">Save Changes</button>
</form>
</div>
</div>
<div class="col-lg-6">
<div class="form-card">
<h2 class="form-title">Quick Links</h2>
<a href="{{ route('channel', $user->id) }}" class="btn-primary d-inline-block text-decoration-none">
<i class="bi bi-play-btn"></i> View My Channel
</a>
<a href="{{ route('settings') }}" class="btn-primary d-inline-block text-decoration-none ms-2">
<i class="bi bi-gear"></i> Settings
</a>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,163 @@
@extends('layouts.app')
@section('title', 'Settings | TAKEONE')
@section('extra_styles')
<style>
.settings-container {
max-width: 600px;
}
.settings-card {
background: var(--bg-secondary);
border-radius: 12px;
padding: 24px;
margin-bottom: 24px;
}
.settings-title {
font-size: 18px;
font-weight: 500;
margin-bottom: 20px;
padding-bottom: 12px;
border-bottom: 1px solid var(--border-color);
}
.form-group {
margin-bottom: 16px;
}
.form-label {
display: block;
margin-bottom: 8px;
font-weight: 500;
}
.form-input {
width: 100%;
background: #121212;
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 12px 16px;
color: var(--text-primary);
font-size: 14px;
}
.form-input:focus {
outline: none;
border-color: var(--brand-red);
}
.btn-primary {
background: var(--brand-red);
color: white;
border: none;
padding: 12px 24px;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn-primary:hover {
background: #cc1a1a;
}
.alert {
padding: 12px 16px;
border-radius: 8px;
margin-bottom: 16px;
}
.alert-success {
background: rgba(34, 197, 94, 0.2);
border: 1px solid #22c55e;
color: #22c55e;
}
.alert-danger {
background: rgba(239, 68, 68, 0.2);
border: 1px solid #ef4444;
color: #ef4444;
}
.text-muted {
color: var(--text-secondary);
font-size: 12px;
}
</style>
@endsection
@section('content')
<div class="settings-container">
<h1 style="font-size: 24px; margin-bottom: 24px;">Settings</h1>
<div class="settings-card">
<h2 class="settings-title">Change Password</h2>
@if(session('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
@endif
@if($errors->any())
<div class="alert alert-danger">
{{ $errors->first() }}
</div>
@endif
<form method="POST" action="{{ route('settings.update') }}">
@csrf
@method('PUT')
<div class="form-group">
<label class="form-label">Current Password</label>
<input type="password" name="current_password" class="form-input" required>
</div>
<div class="form-group">
<label class="form-label">New Password</label>
<input type="password" name="new_password" class="form-input" required minlength="8">
<small class="text-muted">Minimum 8 characters</small>
</div>
<div class="form-group">
<label class="form-label">Confirm New Password</label>
<input type="password" name="new_password_confirmation" class="form-input" required>
</div>
<button type="submit" class="btn-primary">Update Password</button>
</form>
</div>
<div class="settings-card">
<h2 class="settings-title">Account Info</h2>
<div class="form-group">
<label class="form-label">Email</label>
<input type="email" class="form-input" value="{{ $user->email }}" disabled>
<small class="text-muted">Email cannot be changed</small>
</div>
<div class="form-group">
<label class="form-label">Member Since</label>
<input type="text" class="form-input" value="{{ $user->created_at->format('F d, Y') }}" disabled>
</div>
</div>
<div class="settings-card">
<h2 class="settings-title">Quick Links</h2>
<a href="{{ route('profile') }}" class="btn-primary text-decoration-none">
<i class="bi bi-person"></i> Edit Profile
</a>
<a href="{{ route('channel', $user->id) }}" class="btn-primary text-decoration-none ms-2">
<i class="bi bi-play-btn"></i> My Channel
</a>
</div>
</div>
@endsection

View File

@ -1,109 +1,380 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload Video - TAKEONE</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body { background-color: #0f0f0f; color: #fff; }
</style>
</head>
<body class="min-h-screen">
<header class="bg-[#0f0f0f] border-b border-gray-800">
<div class="max-w-7xl mx-auto px-4 py-3">
<a href="/videos" class="text-2xl font-bold text-red-600">TAKEONE</a>
</div>
</header>
@extends('layouts.app')
<main class="max-w-3xl mx-auto px-4 py-8">
<h1 class="text-3xl font-bold mb-8">Upload Video</h1>
@section('title', 'Upload Video | TAKEONE')
@section('extra_styles')
<style>
.upload-container {
max-width: 600px;
margin: 0 auto;
}
<form id="upload-form" enctype="multipart/form-data" class="space-y-6">
.form-group {
margin-bottom: 20px;
}
.form-label {
display: block;
margin-bottom: 8px;
font-weight: 500;
}
.form-input, .form-select, .form-textarea {
width: 100%;
background: #121212;
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 12px 16px;
color: var(--text-primary);
font-size: 14px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
outline: none;
border-color: var(--brand-red);
}
.form-textarea {
resize: vertical;
min-height: 100px;
}
/* Dropzone */
#dropzone, #thumbnail-dropzone {
border: 2px dashed var(--border-color);
border-radius: 12px;
padding: 40px 20px;
text-align: center;
cursor: pointer;
transition: all 0.2s;
}
/* Hide file input */
#video, #thumbnail {
display: none;
}
#dropzone:hover, #dropzone.dragover,
#thumbnail-dropzone:hover, #thumbnail-dropzone.dragover {
border-color: var(--brand-red);
background: rgba(230, 30, 30, 0.05);
}
#dropzone .icon, #thumbnail-dropzone .icon {
font-size: 48px;
color: var(--text-secondary);
margin-bottom: 16px;
}
#dropzone p, #thumbnail-dropzone p {
color: var(--text-secondary);
margin: 8px 0;
}
#dropzone .hint, #thumbnail-dropzone .hint {
font-size: 12px;
color: var(--text-secondary);
opacity: 0.7;
}
#file-info, #thumbnail-info {
display: none;
}
#file-info.active, #thumbnail-info.active {
display: block;
}
#file-info .filename, #thumbnail-info .filename {
color: var(--brand-red);
font-weight: 500;
}
/* Upload Row - Side by Side */
.upload-row {
display: flex;
gap: 20px;
margin-bottom: 20px;
}
.upload-row .form-group {
flex: 1;
margin-bottom: 0;
}
/* Progress Bar */
#progress-container {
display: none;
margin: 20px 0;
}
#progress-container.active {
display: block;
}
.progress-bar-wrapper {
background: var(--border-color);
border-radius: 4px;
height: 8px;
overflow: hidden;
}
.progress-bar-fill {
background: var(--brand-red);
height: 100%;
width: 0%;
transition: width 0.3s;
}
.progress-text {
text-align: center;
color: var(--text-secondary);
font-size: 14px;
margin-top: 8px;
}
/* Status Message */
#status-message {
display: none;
padding: 16px;
border-radius: 8px;
margin-bottom: 20px;
}
#status-message.success {
display: block;
background: rgba(34, 197, 94, 0.2);
color: #22c55e;
border: 1px solid #22c55e;
}
#status-message.error {
display: block;
background: rgba(239, 68, 68, 0.2);
color: #ef4444;
border: 1px solid #ef4444;
}
/* Submit Button */
.btn-submit {
width: 100%;
background: var(--brand-red);
color: white;
border: none;
padding: 14px 24px;
border-radius: 8px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn-submit:hover {
background: #cc1a1a;
}
.btn-submit:disabled {
background: #555;
cursor: not-allowed;
}
/* Upload Page Layout */
.upload-page .yt-main {
display: block;
margin-left: 0;
}
/* Visibility Options */
.visibility-options {
display: flex;
flex-direction: column;
gap: 12px;
}
.visibility-option {
display: block;
cursor: pointer;
}
.visibility-option input {
display: none;
}
.visibility-content {
display: flex;
align-items: center;
gap: 16px;
padding: 16px;
background: #1a1a1a;
border: 2px solid var(--border-color);
border-radius: 12px;
transition: all 0.2s;
}
.visibility-option:hover .visibility-content {
border-color: var(--text-secondary);
}
.visibility-option.active .visibility-content {
border-color: var(--brand-red);
background: rgba(230, 30, 30, 0.1);
}
.visibility-content i {
font-size: 24px;
color: var(--text-secondary);
}
.visibility-option.active .visibility-content i {
color: var(--brand-red);
}
.visibility-title {
font-weight: 500;
font-size: 16px;
}
.visibility-desc {
color: var(--text-secondary);
font-size: 14px;
}
@media (min-width: 992px) {
.upload-page .yt-main {
margin-left: 240px;
}
}
</style>
@endsection
@section('content')
<div class="upload-container">
<h1 style="font-size: 24px; font-weight: 500; margin-bottom: 24px;">Upload Video</h1>
<form id="upload-form" enctype="multipart/form-data">
@csrf
<div>
<label class="block text-sm font-medium mb-2">Title *</label>
<div class="form-group">
<label class="form-label">Title *</label>
<input type="text" name="title" required
class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600"
class="form-input"
placeholder="Enter video title">
</div>
<div>
<label class="block text-sm font-medium mb-2">Description</label>
<div class="form-group">
<label class="form-label">Description</label>
<textarea name="description" rows="4"
class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600"
class="form-textarea"
placeholder="Tell viewers about your video"></textarea>
</div>
<div>
<label class="block text-sm font-medium mb-2">Video File *</label>
<div id="dropzone" class="border-2 border-dashed border-gray-700 rounded-lg p-8 text-center cursor-pointer hover:border-red-500 transition-colors">
<input type="file" name="video" id="video" accept="video/*" required class="hidden" onchange="handleFileSelect(this)">
<div id="dropzone-content">
<svg class="h-12 w-12 mx-auto text-gray-500 mb-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
</svg>
<p class="text-gray-400 mb-2">Click to select or drag video here</p>
<p class="text-gray-500 text-sm">MP4, MOV, AVI, WebM up to 500MB</p>
<div class="upload-row">
<div class="form-group">
<label class="form-label">Video File *</label>
<div id="dropzone">
<input type="file" name="video" id="video" accept="video/*" required>
<div id="dropzone-default">
<i class="bi bi-camera-video icon"></i>
<p>Click to select or drag video here</p>
<p class="hint">MP4, MOV, AVI, WebM up to 2GB</p>
</div>
<div id="file-info">
<p class="filename" id="filename"></p>
<p id="filesize"></p>
</div>
</div>
<div id="file-info" class="hidden">
<p id="filename" class="text-green-500 font-medium"></p>
<p id="filesize" class="text-gray-400 text-sm"></p>
</div>
<div class="form-group">
<label class="form-label">Thumbnail (optional)</label>
<div id="thumbnail-dropzone">
<input type="file" name="thumbnail" id="thumbnail" accept="image/*">
<div id="thumbnail-default">
<i class="bi bi-image icon"></i>
<p>Click to select or drag thumbnail</p>
<p class="hint">JPG, PNG, WebP up to 5MB</p>
</div>
<div id="thumbnail-info">
<p class="filename" id="thumbnail-filename"></p>
<p id="thumbnail-filesize"></p>
</div>
</div>
</div>
</div>
<div>
<label class="block text-sm font-medium mb-2">Orientation</label>
<select name="orientation" class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600">
<option value="landscape">Landscape (16:9)</option>
<option value="portrait">Portrait (9:16)</option>
<option value="square">Square (1:1)</option>
<option value="ultrawide">Ultrawide (21:9)</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-2">Thumbnail (optional)</label>
<input type="file" name="thumbnail" accept="image/*" class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600">
<div class="form-group">
<label class="form-label">Privacy</label>
<div class="visibility-options">
<label class="visibility-option active">
<input type="radio" name="visibility" value="public" checked>
<div class="visibility-content">
<i class="bi bi-globe"></i>
<span class="visibility-title">Public</span>
<span class="visibility-desc">Everyone can see this video</span>
</div>
</label>
<label class="visibility-option">
<input type="radio" name="visibility" value="unlisted">
<div class="visibility-content">
<i class="bi bi-link-45deg"></i>
<span class="visibility-title">Unlisted</span>
<span class="visibility-desc">Only people with the link can see</span>
</div>
</label>
<label class="visibility-option">
<input type="radio" name="visibility" value="private">
<div class="visibility-content">
<i class="bi bi-lock"></i>
<span class="visibility-title">Private</span>
<span class="visibility-desc">Only you can see this video</span>
</div>
</label>
</div>
</div>
<!-- Progress Bar -->
<div id="progress-container" class="hidden">
<div class="bg-gray-700 rounded-full h-4 overflow-hidden">
<div id="progress-bar" class="bg-red-600 h-full transition-all duration-300" style="width: 0%"></div>
<div id="progress-container">
<div class="progress-bar-wrapper">
<div id="progress-bar" class="progress-bar-fill"></div>
</div>
<p id="progress-text" class="text-center text-gray-400 text-sm mt-2">Uploading... 0%</p>
<p id="progress-text" class="progress-text">Uploading... 0%</p>
</div>
<!-- Status Message -->
<div id="status-message" class="hidden p-4 rounded-lg"></div>
<div id="status-message"></div>
<button type="submit" id="submit-btn" class="w-full bg-red-600 hover:bg-red-700 text-white font-semibold py-3 rounded-lg transition-colors">
<button type="submit" id="submit-btn" class="btn-submit">
Upload Video
</button>
</form>
</main>
</div>
@endsection
@section('scripts')
<script>
// Video Dropzone
const dropzone = document.getElementById('dropzone');
const fileInput = document.getElementById('video');
// Add change event listener for video file selection
fileInput.addEventListener('change', function() {
handleFileSelect(this);
});
dropzone.addEventListener('click', () => fileInput.click());
dropzone.addEventListener('dragover', (e) => {
e.preventDefault();
dropzone.classList.add('border-red-500');
dropzone.classList.add('dragover');
});
dropzone.addEventListener('dragleave', () => {
dropzone.classList.remove('border-red-500');
dropzone.classList.remove('dragover');
});
dropzone.addEventListener('drop', (e) => {
e.preventDefault();
dropzone.classList.remove('border-red-500');
dropzone.classList.remove('dragover');
if (e.dataTransfer.files.length) {
fileInput.files = e.dataTransfer.files;
handleFileSelect(fileInput);
@ -115,20 +386,69 @@
const file = input.files[0];
document.getElementById('filename').textContent = file.name;
document.getElementById('filesize').textContent = (file.size / 1024 / 1024).toFixed(2) + ' MB';
document.getElementById('dropzone-content').classList.add('hidden');
document.getElementById('file-info').classList.remove('hidden');
document.getElementById('dropzone-default').style.display = 'none';
document.getElementById('file-info').classList.add('active');
}
}
// Thumbnail Dropzone
const thumbnailDropzone = document.getElementById('thumbnail-dropzone');
const thumbnailInput = document.getElementById('thumbnail');
thumbnailDropzone.addEventListener('click', () => thumbnailInput.click());
thumbnailDropzone.addEventListener('dragover', (e) => {
e.preventDefault();
thumbnailDropzone.classList.add('dragover');
});
thumbnailDropzone.addEventListener('dragleave', () => {
thumbnailDropzone.classList.remove('dragover');
});
thumbnailDropzone.addEventListener('drop', (e) => {
e.preventDefault();
thumbnailDropzone.classList.remove('dragover');
if (e.dataTransfer.files.length) {
thumbnailInput.files = e.dataTransfer.files;
handleThumbnailSelect(thumbnailInput);
}
});
thumbnailInput.addEventListener('change', function() {
handleThumbnailSelect(this);
});
function handleThumbnailSelect(input) {
if (input.files && input.files[0]) {
const file = input.files[0];
document.getElementById('thumbnail-filename').textContent = file.name;
document.getElementById('thumbnail-filesize').textContent = (file.size / 1024 / 1024).toFixed(2) + ' MB';
document.getElementById('thumbnail-default').style.display = 'none';
document.getElementById('thumbnail-info').classList.add('active');
}
}
// Visibility option handling
const visibilityOptions = document.querySelectorAll('.visibility-option');
visibilityOptions.forEach(option => {
const radio = option.querySelector('input[type="radio"]');
radio.addEventListener('change', function() {
visibilityOptions.forEach(opt => opt.classList.remove('active'));
option.classList.add('active');
});
});
document.getElementById('upload-form').addEventListener('submit', function(e) {
e.preventDefault();
const formData = new FormData(this);
const xhr = new XMLHttpRequest();
document.getElementById('progress-container').classList.remove('hidden');
document.getElementById('progress-container').classList.add('active');
document.getElementById('submit-btn').disabled = true;
document.getElementById('submit-btn').textContent = 'Uploading...';
document.getElementById('status-message').className = '';
xhr.upload.addEventListener('progress', function(e) {
if (e.lengthComputable) {
@ -166,12 +486,11 @@
function showError(message) {
const status = document.getElementById('status-message');
status.className = 'p-4 rounded-lg bg-red-600 text-white';
status.textContent = message;
status.classList.remove('hidden');
status.className = 'error';
document.getElementById('submit-btn').disabled = false;
document.getElementById('submit-btn').textContent = 'Upload Video';
}
</script>
</body>
</html>
@endsection

View File

@ -1,69 +1,278 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit {{ $video->title }} - TAKEONE</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body { background-color: #0f0f0f; color: #fff; }
</style>
</head>
<body class="min-h-screen">
<header class="bg-[#0f0f0f] border-b border-gray-800">
<div class="max-w-7xl mx-auto px-4 py-3">
<a href="/videos" class="text-2xl font-bold text-red-600">TAKEONE</a>
</div>
</header>
@extends('layouts.app')
<main class="max-w-3xl mx-auto px-4 py-8">
<h1 class="text-3xl font-bold mb-8">Edit Video</h1>
@section('title', 'Edit ' . $video->title . ' | TAKEONE')
@section('extra_styles')
<style>
.edit-container {
max-width: 600px;
margin: 0 auto;
}
<form action="{{ route('videos.update', $video->id) }}" method="POST" enctype="multipart/form-data" class="space-y-6">
.form-group {
margin-bottom: 20px;
}
.form-label {
display: block;
margin-bottom: 8px;
font-weight: 500;
}
.form-input, .form-select, .form-textarea {
width: 100%;
background: #121212;
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 12px 16px;
color: var(--text-primary);
font-size: 14px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
outline: none;
border-color: var(--brand-red);
}
.form-textarea {
resize: vertical;
min-height: 100px;
}
/* Visibility Options */
.visibility-options {
display: flex;
flex-direction: column;
gap: 12px;
}
.visibility-option {
display: block;
cursor: pointer;
}
.visibility-option input {
display: none;
}
.visibility-content {
display: flex;
align-items: center;
gap: 16px;
padding: 16px;
background: #1a1a1a;
border: 2px solid var(--border-color);
border-radius: 12px;
transition: all 0.2s;
}
.visibility-option:hover .visibility-content {
border-color: var(--text-secondary);
}
.visibility-option.active .visibility-content {
border-color: var(--brand-red);
background: rgba(230, 30, 30, 0.1);
}
.visibility-content i {
font-size: 24px;
color: var(--text-secondary);
}
.visibility-option.active .visibility-content i {
color: var(--brand-red);
}
.visibility-title {
display: block;
font-weight: 500;
font-size: 16px;
}
.visibility-desc {
display: block;
color: var(--text-secondary);
font-size: 14px;
}
/* Thumbnail Preview */
.thumbnail-preview {
width: 160px;
height: 90px;
object-fit: cover;
border-radius: 8px;
margin-bottom: 12px;
}
/* Buttons */
.btn-group {
display: flex;
gap: 12px;
margin-top: 24px;
}
.btn-primary {
flex: 1;
background: var(--brand-red);
color: white;
border: none;
padding: 14px 24px;
border-radius: 8px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
text-decoration: none;
text-align: center;
}
.btn-primary:hover {
background: #cc1a1a;
}
.btn-secondary {
padding: 14px 24px;
background: var(--bg-secondary);
color: var(--text-primary);
border: 1px solid var(--border-color);
border-radius: 8px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
text-decoration: none;
transition: background 0.2s;
}
.btn-secondary:hover {
background: var(--border-color);
}
.btn-danger {
margin-top: 16px;
width: 100%;
background: #7f1d1d;
color: white;
border: none;
padding: 14px 24px;
border-radius: 8px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn-danger:hover {
background: #991b1b;
}
/* Edit Page Layout */
.edit-page .yt-main {
display: block;
margin-left: 0;
}
@media (min-width: 992px) {
.edit-page .yt-main {
margin-left: 240px;
}
}
@media (max-width: 576px) {
.btn-group {
flex-direction: column;
}
}
</style>
@endsection
@section('content')
<div class="edit-container">
<h1 style="font-size: 24px; font-weight: 500; margin-bottom: 24px;">Edit Video</h1>
<form action="{{ route('videos.update', $video->id) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div>
<label class="block text-sm font-medium mb-2">Title</label>
<input type="text" name="title" value="{{ $video->title }}" required class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600">
<div class="form-group">
<label class="form-label">Title</label>
<input type="text" name="title" value="{{ $video->title }}" required class="form-input">
</div>
<div>
<label class="block text-sm font-medium mb-2">Description</label>
<textarea name="description" rows="3" class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600">{{ $video->description }}</textarea>
<div class="form-group">
<label class="form-label">Description</label>
<textarea name="description" rows="3" class="form-textarea">{{ $video->description }}</textarea>
</div>
<div>
<label class="block text-sm font-medium mb-2">Orientation</label>
<div class="grid grid-cols-4 gap-3">
@foreach(['landscape', 'portrait', 'square', 'ultrawide'] as $orientation)
<label class="cursor-pointer border-2 {{ $video->orientation == $orientation ? 'border-red-600' : 'border-gray-700' }} rounded-lg p-3 text-center">
<input type="radio" name="orientation" value="{{ $orientation }}" {{ $video->orientation == $orientation ? 'checked' : '' }} class="d-none">
<span class="text-sm capitalize">{{ $orientation }}</span>
<div class="form-group">
<label class="form-label">Privacy</label>
<div class="visibility-options">
<label class="visibility-option {{ ($video->visibility ?? 'public') == 'public' ? 'active' : '' }}">
<input type="radio" name="visibility" value="public" {{ ($video->visibility ?? 'public') == 'public' ? 'checked' : '' }}>
<div class="visibility-content">
<i class="bi bi-globe"></i>
<div>
<span class="visibility-title">Public</span>
<span class="visibility-desc">Everyone can see this video</span>
</div>
</div>
</label>
<label class="visibility-option {{ $video->visibility == 'unlisted' ? 'active' : '' }}">
<input type="radio" name="visibility" value="unlisted" {{ $video->visibility == 'unlisted' ? 'checked' : '' }}>
<div class="visibility-content">
<i class="bi bi-link-45deg"></i>
<div>
<span class="visibility-title">Unlisted</span>
<span class="visibility-desc">Only people with the link can see</span>
</div>
</div>
</label>
<label class="visibility-option {{ $video->visibility == 'private' ? 'active' : '' }}">
<input type="radio" name="visibility" value="private" {{ $video->visibility == 'private' ? 'checked' : '' }}>
<div class="visibility-content">
<i class="bi bi-lock"></i>
<div>
<span class="visibility-title">Private</span>
<span class="visibility-desc">Only you can see this video</span>
</div>
</div>
</label>
@endforeach
</div>
</div>
<div>
<label class="block text-sm font-medium mb-2">Thumbnail</label>
<div class="form-group">
<label class="form-label">Thumbnail</label>
@if($video->thumbnail)
<img src="{{ asset('storage/thumbnails/' . $video->thumbnail) }}" class="w-32 h-20 object-cover rounded mb-2">
<img src="{{ asset('storage/thumbnails/' . $video->thumbnail) }}" class="thumbnail-preview" alt="Thumbnail">
@endif
<input type="file" name="thumbnail" accept="image/*" class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600">
<input type="file" name="thumbnail" accept="image/*" class="form-input">
</div>
<div class="flex gap-4">
<button type="submit" class="flex-1 bg-red-600 hover:bg-red-700 text-white font-semibold py-3 rounded-lg">Save Changes</button>
<a href="{{ route('videos.show', $video->id) }}" class="px-6 py-3 bg-gray-700 rounded-lg">Cancel</a>
<div class="btn-group">
<button type="submit" class="btn-primary">Save Changes</button>
<a href="{{ route('videos.show', $video->id) }}" class="btn-secondary">Cancel</a>
</div>
</form>
<form action="{{ route('videos.destroy', $video->id) }}" method="POST" class="mt-6" onsubmit="return confirm('Delete this video? This cannot be undone.');">
<form action="{{ route('videos.destroy', $video->id) }}" method="POST" onsubmit="return confirm('Delete this video? This cannot be undone.');">
@csrf
@method('DELETE')
<button type="submit" class="w-full bg-red-900 hover:bg-red-800 text-white font-semibold py-3 rounded-lg">Delete Video</button>
<button type="submit" class="btn-danger">Delete Video</button>
</form>
</main>
</body>
</html>
</div>
@endsection
@section('scripts')
<script>
// Visibility option handling
const visibilityOptions = document.querySelectorAll('.visibility-option');
visibilityOptions.forEach(option => {
const radio = option.querySelector('input[type="radio"]');
radio.addEventListener('change', function() {
visibilityOptions.forEach(opt => opt.classList.remove('active'));
option.classList.add('active');
});
});
</script>
@endsection

View File

@ -1,237 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TAKEONE | Video Gallery</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
@extends('layouts.app')
@section('title', isset($query) ? 'Search: ' . $query . ' | TAKEONE' : 'Video Gallery | TAKEONE')
@section('extra_styles')
<style>
:root {
--brand-red: #e61e1e;
--bg-dark: #0f0f0f;
--bg-secondary: #1e1e1e;
--border-color: #303030;
--text-primary: #f1f1f1;
--text-secondary: #aaaaaa;
}
* { box-sizing: border-box; }
body {
background-color: var(--bg-dark);
color: var(--text-primary);
font-family: "Roboto", "Arial", sans-serif;
margin: 0;
padding: 0;
overflow-x: hidden;
}
/* Header */
.yt-header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 56px;
background: var(--bg-dark);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
z-index: 1000;
border-bottom: 1px solid var(--border-color);
}
.yt-header-left {
display: flex;
align-items: center;
gap: 16px;
}
.yt-menu-btn {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background 0.2s;
background: transparent;
border: none;
color: var(--text-primary);
}
.yt-menu-btn:hover { background: var(--border-color); }
.yt-logo {
display: flex;
align-items: center;
text-decoration: none;
gap: 4px;
}
.yt-logo-text {
font-size: 1.4rem;
font-weight: 700;
color: var(--text-primary);
letter-spacing: -1px;
}
/* Search */
.yt-header-center {
flex: 1;
max-width: 640px;
margin: 0 40px;
display: flex;
}
.yt-search {
flex: 1;
display: flex;
height: 40px;
}
.yt-search-input {
flex: 1;
background: #121212;
border: 1px solid var(--border-color);
border-right: none;
border-radius: 20px 0 0 20px;
padding: 0 16px;
color: var(--text-primary);
font-size: 16px;
}
.yt-search-input:focus {
outline: none;
border-color: #1c62b9;
}
.yt-search-btn {
width: 64px;
background: #222;
border: 1px solid var(--border-color);
border-radius: 0 20px 20px 0;
color: var(--text-primary);
cursor: pointer;
}
.yt-search-btn:hover { background: #303030; }
.yt-search-voice {
width: 40px;
height: 40px;
border-radius: 50%;
/* Search info */
.search-info {
margin-bottom: 20px;
padding: 16px;
background: var(--bg-secondary);
border: none;
color: var(--text-primary);
margin-left: 8px;
cursor: pointer;
border-radius: 12px;
}
/* Header Right */
.yt-header-right {
display: flex;
align-items: center;
gap: 8px;
.search-info h2 {
font-size: 20px;
margin: 0;
}
.yt-icon-btn {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
background: transparent;
border: none;
color: var(--text-primary);
font-size: 1.2rem;
}
.yt-icon-btn:hover { background: var(--border-color); }
.yt-user-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background: #555;
cursor: pointer;
}
/* Sidebar */
.yt-sidebar {
position: fixed;
top: 56px;
left: 0;
bottom: 0;
width: 240px;
background: var(--bg-dark);
overflow-y: auto;
padding: 12px;
transition: transform 0.3s;
z-index: 999;
}
.yt-sidebar-section {
padding-bottom: 12px;
border-bottom: 1px solid var(--border-color);
margin-bottom: 12px;
}
.yt-sidebar-link {
display: flex;
align-items: center;
gap: 20px;
padding: 0 12px;
height: 40px;
border-radius: 10px;
color: var(--text-primary);
text-decoration: none;
cursor: pointer;
transition: background 0.2s;
}
.yt-sidebar-link:hover { background: var(--border-color); }
.yt-sidebar-link.active {
background: var(--border-color);
font-weight: 500;
}
.yt-sidebar-link i { font-size: 1.2rem; }
/* Mobile sidebar overlay */
.yt-sidebar-overlay {
position: fixed;
top: 56px;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
z-index: 998;
display: none;
}
.yt-sidebar-overlay.show { display: block; }
/* Main Content */
.yt-main {
margin-top: 56px;
margin-left: 240px;
padding: 24px;
min-height: calc(100vh - 56px);
transition: margin-left 0.3s;
.search-info p {
color: var(--text-secondary);
margin: 8px 0 0;
}
/* Video Grid */
.yt-video-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
grid-template-columns: repeat(3, 1fr);
gap: 24px;
}
.yt-video-card {
@ -250,6 +45,25 @@
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
top: 0;
left: 0;
}
.yt-video-thumb video {
width: 100%;
height: 100%;
object-fit: contain;
position: absolute;
top: 0;
left: 0;
opacity: 0;
transition: opacity 0.3s ease;
background: #000;
}
.yt-video-thumb video.active {
opacity: 1;
}
.yt-video-duration {
@ -306,7 +120,6 @@
/* More button */
.yt-more-btn {
opacity: 0;
background: transparent;
border: none;
color: var(--text-primary);
@ -315,8 +128,6 @@
border-radius: 50%;
}
.yt-video-card:hover .yt-more-btn { opacity: 1; }
.yt-more-dropdown {
background: var(--bg-secondary);
border: 1px solid var(--border-color);
@ -363,237 +174,152 @@
margin-bottom: 20px;
}
/* Upload Button */
.yt-upload-btn {
background: var(--brand-red);
color: white;
border: none;
padding: 8px 16px;
border-radius: 20px;
font-weight: 500;
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
text-decoration: none;
}
.yt-upload-btn:hover { background: #cc1a1a; }
n /* Mobile circle button */
@media (max-width: 576px) {
.yt-upload-btn {
width: 40px;
height: 40px;
padding: 0;
border-radius: 50%;
justify-content: center;
}
.yt-upload-btn span { display: none; }
}
/* Responsive */
@media (max-width: 1300px) {
@media (max-width: 1200px) {
.yt-video-grid {
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
grid-template-columns: repeat(3, 1fr);
gap: 20px;
}
}
@media (max-width: 991px) {
.yt-sidebar {
transform: translateX(-100%);
@media (max-width: 992px) {
.yt-video-grid {
grid-template-columns: repeat(2, 1fr);
}
.yt-sidebar.open {
transform: translateX(0);
}
.yt-main {
margin-left: 0;
}
.yt-search-voice { display: none; }
}
@media (max-width: 768px) {
.yt-header-center { display: none; }
.yt-video-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
.yt-main { padding: 16px; }
}
@media (max-width: 480px) {
.yt-video-grid { grid-template-columns: 1fr; }
@media (max-width: 576px) {
.yt-video-grid {
grid-template-columns: 1fr;
}
.yt-header-right .yt-icon-btn:not(:last-child) { display: none; }
}
/* Mobile Search */
.mobile-search {
display: none;
padding: 10px 16px;
border-bottom: 1px solid var(--border-color);
}
@media (max-width: 991px) {
.mobile-search { display: block; }
}
</style>
</head>
<body>
<!-- Header -->
<header class="yt-header">
<div class="yt-header-left">
<button class="yt-menu-btn" onclick="toggleSidebar()">
<i class="bi bi-list fs-5"></i>
</button>
<a href="/videos" class="yt-logo">
<span class="yt-logo-text">TAKEONE</span>
</a>
@endsection
@section('content')
@isset($query)
<div class="search-info">
<h2>Search results for "{{ $query }}"</h2>
<p>{{ $videos->total() }} videos found</p>
</div>
<div class="yt-header-center d-none d-md-flex">
<div class="yt-search">
<input type="text" class="yt-search-input" placeholder="Search">
<button class="yt-search-btn">
<i class="bi bi-search"></i>
</button>
</div>
<button class="yt-search-voice">
<i class="bi bi-mic-fill"></i>
</button>
</div>
<div class="yt-header-right">
<a href="/videos/create" class="yt-upload-btn">
<i class="bi bi-plus-lg"></i>
<span>Upload</span>
</a>
<a href="/videos/create" class="yt-icon-btn d-sm-none">
<i class="bi bi-plus-lg"></i>
</a>
<button class="yt-icon-btn d-none d-sm-block">
<i class="bi bi-bell"></i>
</button>
<img src="https://i.pravatar.cc/150?u=user" class="yt-user-avatar" alt="User">
</div>
</header>
@endif
<!-- Sidebar Overlay (Mobile) -->
<div class="yt-sidebar-overlay" onclick="toggleSidebar()"></div>
<!-- Sidebar -->
<nav class="yt-sidebar" id="sidebar">
<div class="yt-sidebar-section">
<a href="/videos" class="yt-sidebar-link active">
<i class="bi bi-house-door-fill"></i>
<span>Home</span>
</a>
<a href="#" class="yt-sidebar-link">
<i class="bi bi-play-btn"></i>
<span>Shorts</span>
</a>
<a href="#" class="yt-sidebar-link">
<i class="bi bi-collection-play"></i>
<span>Subscriptions</span>
</a>
</div>
<div class="yt-sidebar-section">
<a href="#" class="yt-sidebar-link">
<i class="bi bi-person-video"></i>
<span>Your Channel</span>
</a>
<a href="#" class="yt-sidebar-link">
<i class="bi bi-clock-history"></i>
<span>History</span>
</a>
<a href="#" class="yt-sidebar-link">
<i class="bi bi-hand-thumbs-up"></i>
<span>Liked Videos</span>
</a>
</div>
</nav>
<!-- Main Content -->
<main class="yt-main" id="main">
<!-- Mobile Search -->
<div class="mobile-search">
<div class="yt-search">
<input type="text" class="yt-search-input" placeholder="Search">
<button class="yt-search-btn">
<i class="bi bi-search"></i>
</button>
</div>
</div>
@if($videos->isEmpty())
<div class="yt-empty">
<i class="bi bi-camera-video yt-empty-icon"></i>
@if($videos->isEmpty())
<div class="yt-empty">
<i class="bi bi-camera-video yt-empty-icon"></i>
@isset($query)
<h2 class="yt-empty-title">No results found</h2>
<p class="yt-empty-text">Try different keywords or browse all videos.</p>
@else
<h2 class="yt-empty-title">No videos yet</h2>
<p class="yt-empty-text">Be the first to upload a video!</p>
@endisset
@auth
<a href="/videos/create" class="yt-upload-btn" style="display: inline-flex;">
<i class="bi bi-plus-lg"></i>
Upload Video
</a>
</div>
@else
<div class="yt-video-grid">
@foreach($videos as $video)
<div class="yt-video-card">
<a href="{{ route('videos.show', $video->id) }}">
<div class="yt-video-thumb">
@if($video->thumbnail)
<img src="{{ asset('storage/thumbnails/' . $video->thumbnail) }}" alt="{{ $video->title }}">
@else
<img src="https://picsum.photos/seed/{{ $video->id }}/640/360" alt="{{ $video->title }}">
@endif
@if($video->duration)
<span class="yt-video-duration">{{ gmdate('i:s', $video->duration) }}</span>
@endif
</div>
</a>
<div class="yt-video-info">
<div class="yt-channel-icon"></div>
<div class="yt-video-details">
<h3 class="yt-video-title">
<a href="{{ route('videos.show', $video->id) }}">{{ $video->title }}</a>
</h3>
<div class="yt-channel-name">TAKEONE</div>
<div class="yt-video-meta">
{{ number_format($video->size / 1024 / 1024, 0) }} MB {{ $video->created_at->diffForHumans() }}
</div>
</div>
<div class="position-relative">
<button class="yt-more-btn" data-bs-toggle="dropdown">
<i class="bi bi-three-dots-vertical"></i>
</button>
<ul class="dropdown-menu dropdown-menu-dark yt-more-dropdown dropdown-menu-end">
<li><a class="yt-more-dropdown-item" href="{{ route('videos.edit', $video->id) }}"><i class="bi bi-pencil"></i> Edit</a></li>
<li><a class="yt-more-dropdown-item" href="{{ route('videos.show', $video->id) }}"><i class="bi bi-play"></i> Play</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<form action="{{ route('videos.destroy', $video->id) }}" method="POST" onsubmit="return confirm('Delete this video?');" class="m-0">
@csrf @method('DELETE')
<button type="submit" class="yt-more-dropdown-item text-danger"><i class="bi bi-trash"></i> Delete</button>
</form>
</li>
</ul>
@else
<a href="{{ route('login') }}" class="yt-upload-btn" style="display: inline-flex;">
<i class="bi bi-box-arrow-in-right"></i>
Login to Upload
</a>
@endauth
</div>
@else
<div class="yt-video-grid">
@foreach($videos as $video)
<div class="yt-video-card"
data-video-url="{{ asset('storage/videos/' . $video->filename) }}"
onmouseenter="playVideo(this)"
onmouseleave="stopVideo(this)">
<a href="{{ route('videos.show', $video->id) }}">
<div class="yt-video-thumb">
@if($video->thumbnail)
<img src="{{ asset('storage/thumbnails/' . $video->thumbnail) }}" alt="{{ $video->title }}">
@else
<img src="https://picsum.photos/seed/{{ $video->id }}/640/360" alt="{{ $video->title }}">
@endif
<video preload="none">
<source src="{{ asset('storage/videos/' . $video->filename) }}" type="{{ $video->mime_type ?? 'video/mp4' }}">
</video>
@if($video->duration)
<span class="yt-video-duration">{{ gmdate('i:s', $video->duration) }}</span>
@endif
</div>
</a>
<div class="yt-video-info">
<div class="yt-channel-icon">
@if($video->user && $video->user->avatar_url)
<img src="{{ $video->user->avatar_url }}" alt="{{ $video->user->name }}" style="width: 100%; height: 100%; object-fit: cover; border-radius: 50%;">
@endif
</div>
<div class="yt-video-details">
<h3 class="yt-video-title">
<a href="{{ route('videos.show', $video->id) }}">{{ $video->title }}</a>
</h3>
<div class="yt-channel-name">{{ $video->user->name ?? 'Unknown' }}</div>
<div class="yt-video-meta">
{{ number_format($video->size / 1024 / 1024, 0) }} MB {{ $video->created_at->diffForHumans() }}
</div>
</div>
<div class="position-relative">
<button class="yt-more-btn" data-bs-toggle="dropdown">
<i class="bi bi-three-dots-vertical"></i>
</button>
<ul class="dropdown-menu dropdown-menu-dark yt-more-dropdown dropdown-menu-end">
@if($video->isShareable())
<li>
<button class="yt-more-dropdown-item" onclick="openShareModal('{{ $video->share_url }}', '{{ addslashes($video->title) }}')">
<i class="bi bi-share"></i> Share
</button>
</li>
@endif
<li><a class="yt-more-dropdown-item" href="{{ route('videos.edit', $video->id) }}"><i class="bi bi-pencil"></i> Edit</a></li>
<li><a class="yt-more-dropdown-item" href="{{ route('videos.show', $video->id) }}"><i class="bi bi-play"></i> Play</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<form action="{{ route('videos.destroy', $video->id) }}" method="POST" onsubmit="return confirm('Delete this video?');" class="m-0">
@csrf @method('DELETE')
<button type="submit" class="yt-more-dropdown-item text-danger"><i class="bi bi-trash"></i> Delete</button>
</form>
</li>
</ul>
</div>
</div>
@endforeach
</div>
<div class="mt-4">{{ $videos->links() }}</div>
@endif
</main>
@endforeach
</div>
<div class="mt-4">{{ $videos->links() }}</div>
@endif
@include('layouts.partials.share-modal')
@include('layouts.partials.upload-modal')
@endsection
@section('scripts')
<script>
function playVideo(card) {
const video = card.querySelector('video');
if (video) {
video.currentTime = 0;
video.play().catch(function(e) {
// Auto-play may be blocked, ignore error
});
video.classList.add('active');
}
}
function stopVideo(card) {
const video = card.querySelector('video');
if (video) {
video.pause();
video.currentTime = 0;
video.classList.remove('active');
}
}
</script>
@endsection
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
function toggleSidebar() {
const sidebar = document.getElementById('sidebar');
const overlay = document.querySelector('.yt-sidebar-overlay');
sidebar.classList.toggle('open');
overlay.classList.toggle('show');
}
</script>
</body>
</html>

View File

@ -1,105 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $video->title }} | TAKEONE</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
@extends('layouts.app')
@section('title', $video->title . ' | TAKEONE')
@section('extra_styles')
<style>
:root {
--brand-red: #e61e1e;
--bg-dark: #0f0f0f;
--bg-secondary: #1e1e1e;
--border-color: #303030;
--text-primary: #f1f1f1;
--text-secondary: #aaaaaa;
}
* { box-sizing: border-box; }
body {
background-color: var(--bg-dark);
color: var(--text-primary);
font-family: "Roboto", "Arial", sans-serif;
margin: 0;
padding: 0;
}
/* Header */
.yt-header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 56px;
background: var(--bg-dark);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
z-index: 1000;
border-bottom: 1px solid var(--border-color);
}
.yt-header-left { display: flex; align-items: center; gap: 16px; }
.yt-menu-btn {
width: 40px; height: 40px; border-radius: 50%;
display: flex; align-items: center; justify-content: center;
cursor: pointer; background: transparent; border: none; color: var(--text-primary);
}
.yt-menu-btn:hover { background: var(--border-color); }
.yt-logo-text { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); letter-spacing: -1px; }
.yt-header-center { flex: 1; max-width: 640px; margin: 0 40px; display: flex; }
.yt-search { flex: 1; display: flex; height: 40px; }
.yt-search-input {
flex: 1; background: #121212; border: 1px solid var(--border-color);
border-right: none; border-radius: 20px 0 0 20px; padding: 0 16px;
color: var(--text-primary); font-size: 16px;
}
.yt-search-input:focus { outline: none; border-color: #1c62b9; }
.yt-search-btn {
width: 64px; background: #222; border: 1px solid var(--border-color);
border-radius: 0 20px 20px 0; color: var(--text-primary); cursor: pointer;
}
.yt-search-btn:hover { background: #303030; }
.yt-header-right { display: flex; align-items: center; gap: 8px; }
.yt-icon-btn {
width: 40px; height: 40px; border-radius: 50%; display: flex;
align-items: center; justify-content: center; cursor: pointer;
background: transparent; border: none; color: var(--text-primary); font-size: 1.2rem;
}
.yt-icon-btn:hover { background: var(--border-color); }
.yt-user-avatar { width: 32px; height: 32px; border-radius: 50%; background: #555; cursor: pointer; }
.yt-upload-btn {
background: var(--brand-red); color: white; border: none;
padding: 8px 16px; border-radius: 20px; font-weight: 500;
display: flex; align-items: center; gap: 8px; cursor: pointer; text-decoration: none;
}
/* Main Layout */
.yt-main {
margin-top: 56px;
margin-left: 240px;
padding: 24px;
display: flex;
gap: 24px;
}
/* Video Section */
.yt-video-section { flex: 1; min-width: 0; }
@ -111,13 +15,16 @@
border-radius: 12px;
overflow: hidden;
max-height: 70vh;
display: flex;
justify-content: center;
align-items: center;
}
.video-container.portrait { aspect-ratio: 9/16; aspect-ratio: 9/16; }
.video-container.square { aspect-ratio: 1/1; aspect-ratio: 1/1; }
.video-container.portrait { aspect-ratio: 9/16; }
.video-container.square { aspect-ratio: 1/1; }
.video-container.ultrawide { aspect-ratio: 21/9; }
.video-container video { width: 100%; height: 100%; object-fit: contain; }
.video-container video { width: 100%; height: 100%; object-fit: contain; }
/* Video Info */
.video-title {
@ -216,7 +123,7 @@
}
/* Sidebar */
.yt-sidebar {
.yt-sidebar-container {
width: 400px;
flex-shrink: 0;
}
@ -255,12 +162,12 @@
/* Responsive */
@media (max-width: 1300px) {
.yt-sidebar { width: 300px; }
.yt-sidebar-container { width: 300px; }
}
@media (max-width: 991px) {
.yt-main { margin-left: 0; flex-direction: column; }
.yt-sidebar { width: 100%; }
.yt-sidebar-container { width: 100%; }
.yt-header-center { display: none; }
.sidebar-video-card { flex-direction: column; }
.sidebar-thumb { width: 100%; }
@ -272,35 +179,11 @@
.yt-main { padding: 16px; }
}
</style>
</head>
<body>
<!-- Header -->
<header class="yt-header">
<div class="yt-header-left">
<a href="/videos" class="yt-menu-btn">
<i class="bi bi-arrow-left"></i>
</a>
<a href="/videos" class="yt-logo-text">TAKEONE</a>
</div>
<div class="yt-header-center d-none d-md-flex">
<div class="yt-search">
<input type="text" class="yt-search-input" placeholder="Search">
<button class="yt-search-btn"><i class="bi bi-search"></i></button>
</div>
</div>
<div class="yt-header-right">
<a href="/videos/create" class="yt-upload-btn d-none d-sm-flex">
<i class="bi bi-plus-lg"></i>
<span>Upload</span>
</a>
<img src="https://i.pravatar.cc/150?u=user" class="yt-user-avatar" alt="User">
</div>
</header>
<!-- Main Content -->
<main class="yt-main">
@endsection
@section('content')
<!-- Video Layout Container -->
<div style="display: flex; gap: 24px; max-width: 1800px; margin: 0 auto;">
<!-- Video Section -->
<div class="yt-video-section">
<!-- Video Player -->
@ -325,22 +208,38 @@
@endif
</div>
<div class="video-actions">
<button class="yt-action-btn"><i class="bi bi-hand-thumbs-up"></i> Like</button>
<button class="yt-action-btn"><i class="bi bi-share"></i> Share</button>
<button class="yt-action-btn"><i class="bi bi-bookmark"></i> Save</button>
@auth
<form method="POST" action="{{ $video->isLikedBy(Auth::user()) ? route('videos.unlike', $video->id) : route('videos.like', $video->id) }}" class="d-inline">
@csrf
<button type="submit" class="yt-action-btn {{ $video->isLikedBy(Auth::user()) ? 'liked' : '' }}">
<i class="bi {{ $video->isLikedBy(Auth::user()) ? 'bi-hand-thumbs-up-fill' : 'bi-hand-thumbs-up' }}"></i>
{{ $video->like_count > 0 ? $video->like_count : 'Like' }}
</button>
</form>
@else
<a href="{{ route('login') }}" class="yt-action-btn">
<i class="bi bi-hand-thumbs-up"></i> Like
</a>
@endauth
@if($video->isShareable())
<button class="yt-action-btn" onclick="openShareModal('{{ $video->share_url }}', '{{ addslashes($video->title) }}')"><i class="bi bi-share"></i> Share</button>
@endif
</div>
</div>
<!-- Channel Row -->
<div class="channel-row">
<div class="channel-info">
<div class="channel-avatar"></div>
<a href="{{ route('channel', $video->user_id) }}" class="channel-info text-decoration-none" style="color: inherit;">
@if($video->user)
<img src="{{ $video->user->avatar_url }}" class="channel-avatar" alt="{{ $video->user->name }}">
@else
<div class="channel-avatar"></div>
@endif
<div>
<div class="channel-name">TAKEONE</div>
<div class="channel-name">{{ $video->user->name ?? 'Unknown' }}</div>
<div class="channel-subs">Video Creator</div>
</div>
</div>
<button class="subscribe-btn">Subscribe</button>
</a>
</div>
<!-- Description -->
@ -352,11 +251,13 @@
</div>
<!-- Sidebar -->
<div class="yt-sidebar">
<div class="yt-sidebar-container">
<h3 style="font-size: 16px; font-weight: 500; margin-bottom: 12px;">Up Next</h3>
<!-- Placeholder for recommended videos - would be dynamic in full implementation -->
<div class="text-secondary">More videos coming soon...</div>
</div>
</main>
</body>
</html>
</div>
@include('layouts.partials.share-modal')
@endsection

17
routes/auth.php Normal file
View File

@ -0,0 +1,17 @@
<?php
use App\Http\Controllers\Auth\AuthenticatedSessionController;
use App\Http\Controllers\Auth\RegisteredUserController;
use Illuminate\Support\Facades\Route;
Route::middleware('guest')->group(function () {
Route::get('register', [RegisteredUserController::class, 'create'])->name('register');
Route::post('register', [RegisteredUserController::class, 'store'])->name('register.store');
Route::get('login', [AuthenticatedSessionController::class, 'create'])->name('login');
Route::post('login', [AuthenticatedSessionController::class, 'store'])->name('login.store');
});
Route::middleware('auth')->group(function () {
Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])->name('logout');
});

View File

@ -2,17 +2,52 @@
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\VideoController;
use App\Http\Controllers\UserController;
// Redirect root to videos
Route::get('/', function () {
return redirect('/videos');
});
// Video routes - public
Route::get('/videos', [VideoController::class, 'index'])->name('videos.index');
Route::get('/videos/search', [VideoController::class, 'search'])->name('videos.search');
Route::get('/videos/create', [VideoController::class, 'create'])->name('videos.create');
Route::post('/videos', [VideoController::class, 'store'])->name('videos.store');
Route::get('/videos/{video}', [VideoController::class, 'show'])->name('videos.show');
Route::get('/videos/{video}/edit', [VideoController::class, 'edit'])->name('videos.edit');
Route::put('/videos/{video}', [VideoController::class, 'update'])->name('videos.update');
Route::get('/videos/{video}/stream', [VideoController::class, 'stream'])->name('videos.stream');
Route::delete('/videos/{video}', [VideoController::class, 'destroy'])->name('videos.destroy');
// Video routes - auth required
Route::middleware('auth')->group(function () {
Route::get('/videos/create', [VideoController::class, 'create'])->name('videos.create');
Route::post('/videos', [VideoController::class, 'store'])->name('videos.store');
Route::get('/videos/{video}/edit', [VideoController::class, 'edit'])->name('videos.edit');
Route::put('/videos/{video}', [VideoController::class, 'update'])->name('videos.update');
Route::delete('/videos/{video}', [VideoController::class, 'destroy'])->name('videos.destroy');
// Like/unlike routes
Route::post('/videos/{video}/like', [UserController::class, 'like'])->name('videos.like');
Route::post('/videos/{video}/unlike', [UserController::class, 'unlike'])->name('videos.unlike');
Route::post('/videos/{video}/toggle-like', [UserController::class, 'toggleLike'])->name('videos.toggleLike');
});
// User routes
Route::middleware('auth')->group(function () {
// Profile
Route::get('/profile', [UserController::class, 'profile'])->name('profile');
Route::put('/profile', [UserController::class, 'updateProfile'])->name('profile.update');
// Settings
Route::get('/settings', [UserController::class, 'settings'])->name('settings');
Route::put('/settings', [UserController::class, 'updateSettings'])->name('settings.update');
// History & Liked
Route::get('/history', [UserController::class, 'history'])->name('history');
Route::get('/liked', [UserController::class, 'liked'])->name('liked');
});
// Channel - public for viewing, own channel requires auth
Route::get('/channel/{userId?}', [UserController::class, 'channel'])->name('channel');
// Authentication Routes
require __DIR__.'/auth.php';