latest update

This commit is contained in:
ghassan committed 2026-03-11 11:21:33 +03:00
1 parent 9ad842dcd5
commit 062c0e896f
42 files changed
+7052 -2921

No files matched your search

+122 -112
View File
@@ -4,11 +4,14 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@yield('title', config('app.name'))</title>
<!-- Open Graph meta tags default - will be overridden by page-specific tags -->
@stack('head')
<!-- Favicon -->
<link rel="icon" type="image/png" href="{{ asset('storage/images/logo.png') }}">
<link rel="apple-touch-icon" href="{{ asset('storage/images/logo.png') }}">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<style>
@@ -20,18 +23,18 @@
--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;
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;
@@ -47,13 +50,13 @@
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;
@@ -67,37 +70,38 @@
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;
align-items: center;
}
.yt-search {
flex: 1;
display: flex;
height: 40px;
}
.yt-search-input {
flex: 1;
background: #121212;
@@ -108,12 +112,12 @@
color: var(--text-primary);
font-size: 16px;
}
.yt-search-input:focus {
outline: none;
border-color: #1c62b9;
}
.yt-search-btn {
width: 64px;
background: #222;
@@ -122,9 +126,9 @@
color: var(--text-primary);
cursor: pointer;
}
.yt-search-btn:hover { background: #303030; }
.yt-search-voice {
width: 40px;
height: 40px;
@@ -135,14 +139,14 @@
margin-left: 8px;
cursor: pointer;
}
/* Header Right */
.yt-header-right {
display: flex;
align-items: center;
gap: 8px;
}
.yt-icon-btn {
width: 40px;
height: 40px;
@@ -156,9 +160,9 @@
color: var(--text-primary);
font-size: 1.2rem;
}
.yt-icon-btn:hover { background: var(--border-color); }
.yt-user-avatar {
width: 32px;
height: 32px;
@@ -166,7 +170,7 @@
background: #555;
cursor: pointer;
}
/* Sidebar */
.yt-sidebar {
position: fixed;
@@ -180,13 +184,13 @@
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;
@@ -199,16 +203,16 @@
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;
@@ -220,9 +224,9 @@
z-index: 998;
display: none;
}
.yt-sidebar-overlay.show { display: block; }
/* Main Content */
.yt-main {
margin-top: 56px;
@@ -231,7 +235,7 @@
min-height: calc(100vh - 56px);
transition: margin-left 0.3s;
}
/* Upload Button */
.yt-upload-btn {
background: var(--brand-red);
@@ -246,9 +250,9 @@
cursor: pointer;
text-decoration: none;
}
.yt-upload-btn:hover { background: #cc1a1a; }
/* Mobile circle button */
@media (max-width: 576px) {
.yt-upload-btn {
@@ -258,10 +262,10 @@
border-radius: 50%;
justify-content: center;
}
.yt-upload-btn span {
display: none;
.yt-upload-btn span {
display: none;
}
/* Show text on larger mobile */
@media (min-width: 400px) {
.yt-upload-btn {
@@ -274,39 +278,39 @@
}
}
}
/* 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 Toggle Button */
.yt-mobile-search-toggle {
width: 40px;
@@ -321,11 +325,11 @@
color: var(--text-primary);
font-size: 1.2rem;
}
.yt-mobile-search-toggle:hover {
background: var(--border-color);
}
/* Mobile Search Overlay */
.mobile-search-overlay {
display: none;
@@ -340,18 +344,18 @@
justify-content: center;
align-items: flex-start;
}
.mobile-search-overlay.active {
display: flex;
}
.mobile-search-form {
display: flex;
width: 100%;
max-width: 600px;
height: 44px;
}
.mobile-search-input {
flex: 1;
background: #121212;
@@ -362,12 +366,12 @@
color: var(--text-primary);
font-size: 16px;
}
.mobile-search-input:focus {
outline: none;
border-color: #1c62b9;
}
.mobile-search-submit {
width: 50px;
background: #222;
@@ -379,26 +383,26 @@
align-items: center;
justify-content: center;
}
.mobile-search-submit:hover {
background: #303030;
}
/* 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);
}
/* Modal input focus */
#deleteVideoInput:focus {
outline: none;
@@ -406,13 +410,13 @@
box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}
</style>
@yield('extra_styles')
</head>
<body class="{{ $bodyClass ?? '' }}">
<!-- Header -->
@include('layouts.partials.header')
<!-- Mobile Search Overlay -->
<div class="mobile-search-overlay" id="mobileSearchOverlay">
<form action="{{ route('videos.trending') }}" method="GET" class="mobile-search-form">
@@ -422,13 +426,13 @@
</button>
</form>
</div>
<!-- Sidebar Overlay (Mobile) -->
<div class="yt-sidebar-overlay" onclick="toggleSidebar()"></div>
<!-- Sidebar -->
@include('layouts.partials.sidebar')
<!-- Main Content -->
<main class="yt-main @yield('main_class')" id="main">
@yield('content')
@@ -438,8 +442,13 @@
@auth
@include('layouts.partials.upload-modal')
@include('layouts.partials.edit-video-modal')
@endauth
<!-- Add to Playlist Modal - Available for all users (shows login prompt if not authenticated) -->
@include('layouts.partials.add-to-playlist-modal')
<!-- Delete Video Modal -->
@auth
<div class="modal fade" id="deleteVideoModal" tabindex="-1" aria-labelledby="deleteVideoModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content" style="background: #1a1a1a; border: 1px solid #3f3f3f; border-radius: 12px;">
@@ -468,9 +477,9 @@
<label for="deleteVideoInput" style="color: #aaa; font-size: 14px; margin-bottom: 8px; display: block;">
To confirm deletion, type <strong style="color: #fff;">"<span id="deleteVideoName"></span>"</strong> below:
</label>
<input type="text"
id="deleteVideoInput"
class="form-control"
<input type="text"
id="deleteVideoInput"
class="form-control"
style="background: #282828; border: 1px solid #3f3f3f; color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 14px;"
placeholder="Enter video name">
</div>
@@ -518,7 +527,7 @@
function toggleMobileSearch() {
const overlay = document.getElementById('mobileSearchOverlay');
overlay.classList.toggle('active');
// Focus input when overlay opens
if (overlay.classList.contains('active')) {
setTimeout(function() {
@@ -526,7 +535,7 @@
}, 100);
}
}
// Close mobile search on escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
@@ -536,16 +545,16 @@
}
}
});
// 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');
@@ -554,19 +563,19 @@
// 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');
@@ -576,15 +585,15 @@
}
}
}
// 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 !== '/')) {
@@ -594,13 +603,13 @@
}
});
});
// 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');
@@ -610,35 +619,35 @@
restoreSidebarState();
}
});
// Delete video modal functions
let currentDeleteVideoId = null;
let currentDeleteVideoTitle = '';
function showDeleteModal(videoId, videoTitle) {
currentDeleteVideoId = videoId;
currentDeleteVideoTitle = videoTitle;
document.getElementById('deleteVideoName').textContent = videoTitle;
document.getElementById('deleteVideoInput').value = '';
const deleteBtn = document.getElementById('confirmDeleteBtn');
deleteBtn.disabled = true;
deleteBtn.style.opacity = '0.5';
deleteBtn.style.cursor = 'not-allowed';
// Close the dropdown first
const dropdown = document.querySelector('.dropdown-menu.show');
if (dropdown) {
dropdown.classList.remove('show');
}
// Show the modal
const modalElement = document.getElementById('deleteVideoModal');
const modal = new bootstrap.Modal(modalElement);
modal.show();
}
document.getElementById('deleteVideoInput').addEventListener('input', function(e) {
const deleteBtn = document.getElementById('confirmDeleteBtn');
if (e.target.value === currentDeleteVideoTitle) {
@@ -651,16 +660,16 @@
deleteBtn.style.cursor = 'not-allowed';
}
});
function confirmDeleteVideo() {
if (!currentDeleteVideoId || !currentDeleteVideoTitle) return;
const inputValue = document.getElementById('deleteVideoInput').value;
if (inputValue !== currentDeleteVideoTitle) {
alert('Video name does not match. Please try again.');
return;
}
fetch(`/videos/${currentDeleteVideoId}`, {
method: 'DELETE',
headers: {
@@ -669,7 +678,7 @@
}
})
.then(response => {
// Check for successful response
// Check for successful response
if (response.status === 200 || response.status === 302 || response.redirected) {
// Close modal first
const modalElement = document.getElementById('deleteVideoModal');
@@ -697,7 +706,7 @@
});
}
</script>
@yield('scripts')
</body>
</html>
@@ -711,17 +720,17 @@
min-width: 44px;
min-height: 44px;
}
/* Reduce padding on main content */
.yt-main {
padding: 12px 8px !important;
}
/* Smaller video title */
.yt-video-title, .video-title {
font-size: 14px !important;
}
/* Channel info compact */
.channel-info {
gap: 8px !important;
@@ -736,12 +745,12 @@
.channel-subs {
font-size: 12px !important;
}
/* Video meta smaller */
.yt-channel-name, .yt-video-meta {
font-size: 12px !important;
}
/* Action buttons horizontal scroll on mobile */
.video-actions {
overflow-x: auto;
@@ -749,13 +758,13 @@
padding-bottom: 8px;
width: 100%;
}
.yt-action-btn {
flex-shrink: 0;
padding: 8px 12px;
font-size: 13px;
}
/* Comment improvements */
.comment-item {
flex-direction: column;
@@ -764,36 +773,36 @@
width: 32px !important;
height: 32px !important;
}
/* Search input mobile */
.yt-search-input {
font-size: 14px;
padding: 0 12px;
}
/* Header spacing */
.yt-header {
padding: 0 8px;
}
/* User dropdown full width on mobile */
.dropdown-menu {
width: 100%;
min-width: 200px;
}
}
/* Very small screens */
@media (max-width: 360px) {
.yt-main {
padding: 8px 4px !important;
}
.yt-header-right .yt-icon-btn:not(:first-child) {
display: none;
}
}
/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
.yt-sidebar {
@@ -803,22 +812,23 @@
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
}
/* Prevent horizontal scroll */
body {
overflow-x: hidden;
max-width: 100vw;
}
/* Better video player on mobile */
@media (max-width: 768px) {
.video-container {
border-radius: 0 !important;
margin: 0 -16px !important;
max-width: calc(100% + 32px) !important;
margin: 0 !important;
max-width: 100% !important;
width: 100% !important;
}
}
/* Sidebar link padding for touch */
@media (hover: none) {
.yt-sidebar-link {
@@ -0,0 +1,401 @@
<!-- Add to Playlist Modal -->
<div id="addToPlaylistModal" class="playlist-modal-overlay" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 9999; align-items: center; justify-content: center;">
<div class="playlist-modal-content" style="background: #282828; border-radius: 12px; width: 90%; max-width: 380px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,0.5); overflow: hidden;">
<!-- Header -->
<div class="playlist-modal-header" style="display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid #3f3f3f;">
<h2 style="font-size: 18px; font-weight: 600; margin: 0; color: #fff;">Save to playlist</h2>
<button type="button" id="closePlaylistModalBtn" style="background: transparent; border: none; color: #aaa; cursor: pointer; font-size: 24px; padding: 4px; line-height: 1; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; transition: all 0.2s;">
<i class="bi bi-x-lg"></i>
</button>
</div>
<!-- Body -->
<div style="padding: 16px 24px; flex: 1; overflow-y: auto;">
<!-- Create New Playlist Option -->
@auth
<div style="margin-bottom: 16px;">
<button onclick="showCreatePlaylistInModal()" class="create-playlist-btn" style="width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: transparent; border: none; color: #fff; cursor: pointer; border-radius: 8px; transition: background 0.2s; font-size: 14px;">
<span style="width: 36px; height: 36px; background: #3f3f3f; border-radius: 50%; display: flex; align-items: center; justify-content: center;">
<i class="bi bi-plus-lg" style="font-size: 18px;"></i>
</span>
<span style="font-weight: 500;">Create new playlist</span>
</button>
</div>
<!-- Create Playlist Form (Hidden by default) -->
<div id="createPlaylistInModal" style="display: none; margin-bottom: 16px; padding: 16px; background: #1f1f1f; border-radius: 10px; border: 1px solid #3f3f3f;">
<input type="text" id="newPlaylistName" placeholder="Playlist name"
style="width: 100%; padding: 12px 14px; margin-bottom: 12px; border: 1px solid #3f3f3f; border-radius: 8px; background: #121212; color: #fff; font-size: 14px; outline: none; transition: border-color 0.2s;">
<div style="display: flex; gap: 10px; justify-content: flex-end;">
<button onclick="hideCreatePlaylistInModal()" style="padding: 8px 16px; background: #3f3f3f; color: #fff; border: none; border-radius: 18px; cursor: pointer; font-size: 14px; font-weight: 500; transition: background 0.2s;">Cancel</button>
<button onclick="createPlaylistFromModal()" style="padding: 8px 16px; background: #e61e1e; color: #fff; border: none; border-radius: 18px; cursor: pointer; font-size: 14px; font-weight: 500; transition: background 0.2s;">Create</button>
</div>
</div>
@endauth
<!-- Playlist List Container -->
<div id="playlistListContainer" style="flex: 1; overflow-y: auto; min-height: 80px;">
<!-- Playlist items will be loaded here via JavaScript -->
</div>
</div>
<!-- Footer -->
<div style="padding: 16px 24px; border-top: 1px solid #3f3f3f;">
<a href="{{ route('playlists.index') }}" style="display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 14px; padding: 10px 12px; border-radius: 8px; transition: background 0.2s;">
<i class="bi bi-collection-play" style="font-size: 18px;"></i>
<span style="font-weight: 500;">View all playlists</span>
</a>
</div>
</div>
</div>
<style>
/* Modal Overlay with proper centering */
.playlist-modal-overlay {
backdrop-filter: blur(2px);
}
/* Modal Content */
.playlist-modal-content {
font-family: "Roboto", "Arial", sans-serif;
}
/* Header button hover */
.playlist-modal-header button:hover {
background: #3f3f3f !important;
color: #fff !important;
}
/* Create playlist button hover */
.create-playlist-btn:hover {
background: #3f3f3f !important;
}
/* Input focus */
#newPlaylistName:focus {
border-color: #e61e1e !important;
}
/* Button hover effects */
#createPlaylistInModal button:hover {
opacity: 0.9;
}
#createPlaylistInModal button:last-child:hover {
background: #cc1a1a !important;
}
/* Footer link hover */
.playlist-modal-footer a:hover {
background: #3f3f3f;
}
/* Playlist items */
.playlist-item {
border-radius: 8px;
}
.playlist-item:hover {
background: #3f3f3f !important;
}
/* Scrollbar styling */
#playlistListContainer::-webkit-scrollbar {
width: 8px;
}
#playlistListContainer::-webkit-scrollbar-track {
background: transparent;
}
#playlistListContainer::-webkit-scrollbar-thumb {
background: #555;
border-radius: 4px;
}
#playlistListContainer::-webkit-scrollbar-thumb:hover {
background: #666;
}
</style>
<script>
let currentModalVideoId = null;
// Check if user is authenticated
function isAuthenticated() {
return {{ auth()->check() ? 'true' : 'false' }};
}
// Close button event listener
document.addEventListener('DOMContentLoaded', function() {
const closeBtn = document.getElementById('closePlaylistModalBtn');
if (closeBtn) {
closeBtn.addEventListener('click', function(e) {
e.stopPropagation();
closeAddToPlaylistModal();
});
}
});
function openAddToPlaylistModal(videoId) {
currentModalVideoId = videoId;
// Close any open dropdown menus first
const activeDropdowns = document.querySelectorAll('.dropdown-menu.show');
activeDropdowns.forEach(function(dropdown) {
dropdown.classList.remove('show');
});
// Also close Bootstrap dropdowns
const dropdownToggles = document.querySelectorAll('.dropdown-toggle[aria-expanded="true"]');
dropdownToggles.forEach(function(toggle) {
toggle.click();
});
const modal = document.getElementById('addToPlaylistModal');
modal.style.display = 'flex';
document.getElementById('createPlaylistInModal').style.display = 'none';
// Load playlists when modal opens
loadPlaylistsForModal(videoId);
}
function closeAddToPlaylistModal() {
const modal = document.getElementById('addToPlaylistModal');
modal.style.display = 'none';
currentModalVideoId = null;
}
// Close modal when clicking outside
document.getElementById('addToPlaylistModal').addEventListener('click', function(e) {
if (e.target === this) {
closeAddToPlaylistModal();
}
});
// Close on escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
const modal = document.getElementById('addToPlaylistModal');
if (modal && modal.style.display === 'flex') {
closeAddToPlaylistModal();
}
}
});
// Load playlists for modal
function loadPlaylistsForModal(videoId) {
const container = document.getElementById('playlistListContainer');
@auth
// Fetch playlists data
fetch('{{ route("playlists.userPlaylists") }}', {
headers: {
'Accept': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
})
.then(response => response.json())
.then(data => {
if (data.success && data.playlists && data.playlists.length > 0) {
let html = '';
data.playlists.forEach(function(playlist) {
const isInPlaylist = playlist.video_ids && playlist.video_ids.includes(parseInt(videoId));
const visibilityText = playlist.visibility === 'public' ? 'Public' : 'Private';
const durationText = playlist.formatted_duration || '0m';
html += `
<div class="playlist-item" style="display: flex; align-items: flex-start; justify-content: space-between; padding: 12px; border-radius: 8px; cursor: pointer; transition: background 0.2s; margin-bottom: 8px;"
onmouseover="this.style.background='#3f3f3f'"
onmouseout="this.style.background='transparent'"
onclick="toggleVideoInPlaylist(${playlist.id}, ${videoId})">
<div style="display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0;">
<div style="width: 100px; height: 56px; background: #1a1a1a; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; position: relative;">
${playlist.thumbnail_url
? `<img src="${playlist.thumbnail_url}" style="width: 100%; height: 100%; object-fit: cover;">`
: `<i class="bi bi-collection-play" style="font-size: 24px; color: #666;"></i>`
}
${playlist.is_default
? `<span style="position: absolute; top: 2px; left: 2px; background: rgba(230,30,30,0.9); color: white; padding: 1px 4px; border-radius: 2px; font-size: 9px; font-weight: 600;">WL</span>`
: ''
}
</div>
<div style="min-width: 0; flex: 1;">
<div style="font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff;">${playlist.name}</div>
<div style="font-size: 12px; color: #aaa; margin-top: 2px;">
${playlist.video_count || 0} videos • ${durationText}
</div>
<div style="font-size: 11px; color: #777; margin-top: 2px;">
${visibilityText}
</div>
${playlist.description ? `<div style="font-size: 11px; color: #777; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${playlist.description}</div>` : ''}
</div>
</div>
<div style="flex-shrink: 0; margin-left: 8px;">
${isInPlaylist
? '<i class="bi bi-check-circle-fill" style="color: #e61e1e; font-size: 20px;"></i>'
: '<i class="bi bi-plus-circle" style="color: #aaa; font-size: 20px;"></i>'}
</div>
</div>
`;
});
container.innerHTML = html;
} else {
container.innerHTML = `
<div style="text-align: center; color: #aaa; padding: 30px 20px;">
<i class="bi bi-collection-play" style="font-size: 36px; margin-bottom: 12px; display: block; color: #555;"></i>
<p style="margin: 0 0 8px; font-size: 14px; color: #fff;">No playlists yet</p>
<p style="margin: 0; font-size: 12px;">Create a playlist to save videos</p>
</div>
`;
}
})
.catch(error => {
console.error('Error loading playlists:', error);
container.innerHTML = `
<div style="text-align: center; color: #aaa; padding: 30px 20px;">
<i class="bi bi-exclamation-circle" style="font-size: 28px; margin-bottom: 12px; display: block; color: #ef4444;"></i>
<p style="margin: 0; font-size: 14px; color: #fff;">Failed to load playlists</p>
</div>
`;
});
@else
container.innerHTML = `
<div style="text-align: center; color: #aaa; padding: 30px 20px;">
<i class="bi bi-person-circle" style="font-size: 40px; margin-bottom: 12px; display: block; color: #555;"></i>
<p style="margin: 0 0 8px; font-size: 14px; color: #fff;">Sign in to save videos to playlists</p>
<p style="margin: 0 0 16px; font-size: 12px;">Create a playlist to organize your videos</p>
<a href="{{ route('login') }}?redirect={{ urlencode(request()->fullUrl()) }}"
style="display: inline-block; padding: 10px 24px; background: #e61e1e; color: white; border-radius: 20px; text-decoration: none; font-weight: 500; font-size: 14px; transition: background 0.2s;">
Sign In
</a>
</div>
`;
@endauth
}
// Toggle video in playlist
function toggleVideoInPlaylist(playlistId, videoId) {
if (!videoId) return;
// Check authentication before adding
if (!isAuthenticated()) {
window.location.href = '{{ route("login") }}?redirect=' + encodeURIComponent(window.location.href);
return;
}
fetch(`/playlists/${playlistId}/videos`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json'
},
body: JSON.stringify({ video_id: videoId })
})
.then(response => response.json())
.then(data => {
if (data.success) {
showToast(data.message || 'Video added to playlist');
// Reload playlists to update checkmarks
loadPlaylistsForModal(videoId);
}
})
.catch(error => console.error('Error:', error));
}
// Show create playlist form in modal
function showCreatePlaylistInModal() {
// Check authentication before creating playlist
if (!isAuthenticated()) {
window.location.href = '{{ route("login") }}?redirect=' + encodeURIComponent(window.location.href);
return;
}
document.getElementById('createPlaylistInModal').style.display = 'block';
document.getElementById('newPlaylistName').focus();
}
// Hide create playlist form
function hideCreatePlaylistInModal() {
document.getElementById('createPlaylistInModal').style.display = 'none';
document.getElementById('newPlaylistName').value = '';
}
// Create playlist from modal
function createPlaylistFromModal() {
const name = document.getElementById('newPlaylistName').value.trim();
if (!name) {
alert('Please enter a playlist name');
return;
}
fetch('{{ route("playlists.store") }}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json'
},
body: JSON.stringify({
name: name,
visibility: 'private'
})
})
.then(response => response.json())
.then(data => {
if (data.success) {
hideCreatePlaylistInModal();
showToast('Playlist created!');
// Reload playlists to show new playlist
loadPlaylistsForModal(currentModalVideoId);
}
})
.catch(error => console.error('Error:', error));
}
// Simple toast notification
function showToast(message) {
// Remove existing toast if any
const existing = document.querySelector('.playlist-toast');
if (existing) existing.remove();
const toast = document.createElement('div');
toast.className = 'playlist-toast';
toast.style.cssText = `
position: fixed;
bottom: 80px;
left: 50%;
transform: translateX(-50%);
background: #fff;
color: #0f0f0f;
padding: 14px 28px;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
z-index: 10000;
animation: fadeInUp 0.3s ease;
box-shadow: 0 4px 20px rgba(0,0,0,0.4);
max-width: 90%;
text-align: center;
`;
toast.textContent = message;
document.body.appendChild(toast);
setTimeout(() => {
toast.style.animation = 'fadeOutDown 0.3s ease';
setTimeout(() => toast.remove(), 300);
}, 2500);
}
</script>
<style>
@keyframes fadeInUp {
from { opacity: 0; transform: translateX(-50%) translateY(20px); }
to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes fadeOutDown {
from { opacity: 1; transform: translateX(-50%) translateY(0); }
to { opacity: 0; transform: translateX(-50%) translateY(20px); }
}
</style>
@@ -4,7 +4,7 @@
<button class="yt-menu-btn" onclick="toggleSidebar()">
<i class="bi bi-list fs-5"></i>
</button>
<a href="/videos" class="yt-logo">
<a href="{{ route('home') }}" class="yt-logo">
<!-- Mobile logo (visible only on mobile) -->
<img src="{{ asset('storage/images/logo.png') }}" alt="{{ config('app.name') }}" class="d-md-none" style="height: 30px;">
<!-- Desktop logo (visible only on desktop) -->
@@ -1,14 +1,18 @@
<!-- 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' : '' }}">
<a href="{{ route('home') }}" 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">
<a href="{{ route('videos.shorts') }}" class="yt-sidebar-link {{ request()->is('shorts') ? 'active' : '' }}">
<i class="bi bi-play-btn"></i>
<span>Shorts</span>
</a>
<a href="{{ route('videos.trending') }}" class="yt-sidebar-link {{ request()->is('trending') ? 'active' : '' }}">
<i class="bi bi-fire"></i>
<span>Trending</span>
</a>
@auth
<a href="#" class="yt-sidebar-link">
<i class="bi bi-collection-play"></i>
@@ -16,13 +20,17 @@
</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('playlists.index') }}" class="yt-sidebar-link {{ request()->is('playlists*') ? 'active' : '' }}">
<i class="bi bi-collection-play"></i>
<span>Playlists</span>
</a>
<a href="{{ route('history') }}" class="yt-sidebar-link">
<i class="bi bi-clock-history"></i>
<span>History</span>
File diff suppressed because it is too large. Load diff
+126 -14
View File
@@ -4,6 +4,10 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@yield('title', config('app.name'))</title>
<!-- Open Graph meta tags default - will be overridden by page-specific tags -->
@stack('head')
<!-- Favicon -->
<link rel="icon" type="image/png" href="{{ asset('storage/images/logo.png') }}">
<link rel="apple-touch-icon" href="{{ asset('storage/images/logo.png') }}">
@@ -18,53 +22,161 @@
--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;
body {
background-color: var(--bg-dark);
color: var(--text-primary);
font-family: "Roboto", "Arial", sans-serif;
margin: 0;
padding: 0;
min-height: 100vh;
}
/* 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 - Hidden on plain layout */
.yt-header-center { display: none; }
/* 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;
}
/* Main Content */
.plain-main {
width: 100%;
padding: 20px;
padding-top: 76px; /* 56px header + 20px */
display: flex;
align-items: center;
justify-content: center;
min-height: calc(100vh);
}
/* 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; }
/* 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 -->
<!-- Header -->
@include('layouts.partials.header')
<!-- Main Content -->
<main class="plain-main">
@yield('content')
</main>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
@yield('scripts')
</body>
</html>