بوت 3

import React, { useState } from 'react'; export default function App() { const [videoLink, setVideoLink] = useState(''); const [videos, setVideos] = useState([]); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(''); const handleAddVideo = (e) => { e.preventDefault(); if (!videoLink.trim()) { setError('Please enter a valid video link'); return; } setIsLoading(true); setError(''); // Simulate processing the video link setTimeout(() => { // Validate URL format try { new URL(videoLink); const newVideo = { id: Date.now(), url: videoLink, title: `Video ${videos.length + 1}`, thumbnail: `https://placehold.co/320x180/3b82f6/ffffff?text=Video+${videos.length + 1}`, addedDate: new Date().toLocaleDateString(), status: 'Added (Demo)' }; setVideos([...videos, newVideo]); setVideoLink(''); setIsLoading(false); } catch (err) { setError('Please enter a valid URL'); setIsLoading(false); } }, 1000); }; const handleRemoveVideo = (id) => { setVideos(videos.filter(video => video.id !== id)); }; return (
{/* Header */}

Video Blogger

Manage your video collection

{/* Main Content */}
{/* Video Input Form */}

Add Video Link

setVideoLink(e.target.value)} placeholder="https://example.com/video" className="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200" /> {error &&

{error}

}

Note: This is a demonstration tool. In a real application, downloading videos from other websites may violate their terms of service and copyright laws.

{/* Videos Grid */}

Your Videos ({videos.length})

{videos.length === 0 ? (

No videos yet

Add your first video link above to get started

) : (
{videos.map((video) => (
{video.title}

{video.title}

{video.url}

Added: {video.addedDate} {video.status}
))}
)}
{/* Footer */}

Video Blogger Demo • For educational purposes only

Respect copyright laws and terms of service of video platforms

); }

تعليقات

المشاركات الشائعة من هذه المدونة

Bot 2