2026-03-11 11:21:33 +03:00

907 lines
29 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<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/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;
align-items: center;
}
.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;
}
/* Show text on larger mobile */
@media (min-width: 400px) {
.yt-upload-btn {
width: auto;
border-radius: 20px;
padding: 8px 16px;
}
.yt-upload-btn span {
display: inline;
}
}
}
/* 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;
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-mobile-search-toggle:hover {
background: var(--border-color);
}
/* Mobile Search Overlay */
.mobile-search-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: var(--bg-dark);
z-index: 1001;
padding: 60px 16px 16px;
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;
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;
}
.mobile-search-input:focus {
outline: none;
border-color: #1c62b9;
}
.mobile-search-submit {
width: 50px;
background: #222;
border: 1px solid var(--border-color);
border-radius: 0 20px 20px 0;
color: var(--text-primary);
cursor: pointer;
display: flex;
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;
border-color: #ef4444 !important;
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">
<input type="text" name="q" class="mobile-search-input" placeholder="Search" value="{{ request('q') }}">
<button type="submit" class="mobile-search-submit">
<i class="bi bi-search"></i>
</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')
</main>
<!-- Upload Modal -->
@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;">
<div class="modal-header" style="border-bottom: 1px solid #3f3f3f; padding: 20px 24px;">
<h5 class="modal-title" id="deleteVideoModalLabel" style="color: #fff; font-weight: 600; display: flex; align-items: center; gap: 10px;">
<i class="bi bi-exclamation-triangle-fill" style="color: #ef4444;"></i>
Delete 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;">
<div style="background: #282828; border-radius: 8px; padding: 16px; margin-bottom: 20px;">
<p style="color: #fff; margin: 0; font-size: 14px; line-height: 1.6;">
<strong style="color: #ef4444;">Warning:</strong> This action is permanent and cannot be undone.
All data associated with this video will be lost, including:
</p>
<ul style="color: #aaa; margin: 12px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.8;">
<li>View count</li>
<li>Comments</li>
<li>Likes</li>
<li>Thumbnail</li>
<li>Video file</li>
</ul>
</div>
<div>
<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"
style="background: #282828; border: 1px solid #3f3f3f; color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 14px;"
placeholder="Enter video name">
</div>
</div>
<div class="modal-footer" style="border-top: 1px solid #3f3f3f; padding: 16px 24px; gap: 12px;">
<button type="button" class="btn" style="background: #3f3f3f; color: #fff; padding: 10px 20px; border-radius: 8px; font-weight: 500; border: none;" data-bs-dismiss="modal">
Cancel
</button>
<button type="button" id="confirmDeleteBtn" class="btn" style="background: #ef4444; color: #fff; padding: 10px 20px; border-radius: 8px; font-weight: 500; border: none; opacity: 0.5; cursor: not-allowed;" disabled onclick="confirmDeleteVideo()">
Delete Video
</button>
</div>
</div>
</div>
</div>
@endauth
<!-- YouTube-style Bottom Navigation Bar (Mobile) -->
<nav class="yt-bottom-nav">
<a href="{{ route('videos.index') }}" class="yt-bottom-nav-item {{ request()->routeIs('videos.index') ? 'active' : '' }}">
<i class="bi bi-house-door-fill"></i>
<span>Home</span>
</a>
<a href="{{ route('videos.trending') }}" class="yt-bottom-nav-item {{ request()->routeIs('videos.trending') ? 'active' : '' }}">
<i class="bi bi-fire"></i>
<span>Trending</span>
</a>
<a href="{{ auth()->check() ? route('videos.create') : route('login') }}" class="yt-bottom-nav-item {{ request()->routeIs('videos.create') ? 'active' : '' }}">
<i class="bi bi-play-circle-fill"></i>
<span>Upload</span>
</a>
<a href="{{ route('history') }}" class="yt-bottom-nav-item {{ request()->routeIs('history') ? 'active' : '' }}">
<i class="bi bi-collection-play-fill"></i>
<span>History</span>
</a>
<a href="{{ auth()->check() ? route('channel', auth()->user()->channel) : route('login') }}" class="yt-bottom-nav-item">
<i class="bi bi-person-fill"></i>
<span>Profile</span>
</a>
</nav>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Mobile search toggle function
function toggleMobileSearch() {
const overlay = document.getElementById('mobileSearchOverlay');
overlay.classList.toggle('active');
// Focus input when overlay opens
if (overlay.classList.contains('active')) {
setTimeout(function() {
document.querySelector('.mobile-search-input').focus();
}, 100);
}
}
// Close mobile search on escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
const overlay = document.getElementById('mobileSearchOverlay');
if (overlay.classList.contains('active')) {
overlay.classList.remove('active');
}
}
});
// 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();
}
});
// 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) {
deleteBtn.disabled = false;
deleteBtn.style.opacity = '1';
deleteBtn.style.cursor = 'pointer';
} else {
deleteBtn.disabled = true;
deleteBtn.style.opacity = '0.5';
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: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json'
}
})
.then(response => {
// Check for successful response
if (response.status === 200 || response.status === 302 || response.redirected) {
// Close modal first
const modalElement = document.getElementById('deleteVideoModal');
const modal = bootstrap.Modal.getInstance(modalElement);
if (modal) {
modal.hide();
}
// Reload the page
window.location.reload();
} else if (response.status === 403) {
alert('You do not have permission to delete this video.');
} else if (response.status === 404) {
alert('Video not found.');
} else {
response.json().then(data => {
alert(data.message || 'Failed to delete video. Please try again.');
}).catch(() => {
alert('Failed to delete video. Please try again.');
});
}
})
.catch(error => {
console.error('Error:', error);
alert('An error occurred while deleting the video.');
});
}
</script>
@yield('scripts')
</body>
</html>
<!-- Extra Mobile Responsive Styles -->
<style>
/* Touch-friendly improvements */
@media (max-width: 480px) {
/* Better touch targets */
.yt-menu-btn, .yt-icon-btn, .yt-mobile-search-toggle {
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;
}
.channel-avatar {
width: 32px !important;
height: 32px !important;
}
.channel-name {
font-size: 14px !important;
}
.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;
-webkit-overflow-scrolling: touch;
padding-bottom: 8px;
width: 100%;
}
.yt-action-btn {
flex-shrink: 0;
padding: 8px 12px;
font-size: 13px;
}
/* Comment improvements */
.comment-item {
flex-direction: column;
}
.comment-item > img {
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 {
width: 200px;
}
.yt-video-grid {
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 !important;
max-width: 100% !important;
width: 100% !important;
}
}
/* Sidebar link padding for touch */
@media (hover: none) {
.yt-sidebar-link {
padding: 0 16px;
}
.yt-sidebar-link:hover {
background: transparent;
}
.yt-sidebar-link:active {
background: var(--border-color);
}
}
/* YouTube-style Bottom Navigation Bar */
.yt-bottom-nav {
display: none;
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 56px;
background: var(--bg-dark);
border-top: 1px solid var(--border-color);
z-index: 999;
justify-content: space-around;
align-items: center;
padding: 0 8px;
}
.yt-bottom-nav-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
height: 100%;
color: var(--text-secondary);
text-decoration: none;
font-size: 12px;
gap: 4px;
transition: color 0.2s;
cursor: pointer;
background: transparent;
border: none;
min-width: 56px;
}
.yt-bottom-nav-item:hover {
color: var(--text-primary);
}
.yt-bottom-nav-item.active {
color: var(--text-primary);
}
.yt-bottom-nav-item i {
font-size: 24px;
}
.yt-bottom-nav-item span {
font-size: 10px;
font-weight: 500;
}
/* Show bottom nav on mobile only */
@media (max-width: 768px) {
.yt-bottom-nav {
display: flex;
}
.yt-main {
padding-bottom: 72px !important;
}
}
</style>