changed UI
This commit is contained in:
parent
3ab5404fbe
commit
1eec87f061
6 changed files with 418 additions and 351 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Upload, FileVideo, Sparkles, Youtube, Instagram, Share2, LogOut, ChevronDown, Check, Activity } from 'lucide-react';
|
import { Upload, FileVideo, Sparkles, Youtube, Instagram, Share2, LogOut, ChevronDown, Check, Activity, LayoutDashboard, Settings, PlusCircle, History, Menu, X, Terminal } from 'lucide-react';
|
||||||
import KeyInput from './components/KeyInput';
|
import KeyInput from './components/KeyInput';
|
||||||
import MediaInput from './components/MediaInput';
|
import MediaInput from './components/MediaInput';
|
||||||
import ResultCard from './components/ResultCard';
|
import ResultCard from './components/ResultCard';
|
||||||
|
|
@ -21,27 +21,22 @@ const UserProfileSelector = ({ profiles, selectedUserId, onSelect }) => {
|
||||||
const selectedProfile = profiles.find(p => p.username === selectedUserId) || profiles[0];
|
const selectedProfile = profiles.find(p => p.username === selectedUserId) || profiles[0];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative z-50">
|
||||||
<label className="text-xs text-zinc-500 font-medium ml-1 mb-1 block">Select User Profile</label>
|
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsOpen(!isOpen)}
|
onClick={() => setIsOpen(!isOpen)}
|
||||||
className="w-full flex items-center justify-between bg-black/20 border border-white/10 rounded-lg px-4 py-2 text-sm text-zinc-300 hover:bg-black/30 transition-colors"
|
className="flex items-center justify-between bg-surface border border-white/10 rounded-lg px-3 py-2 text-sm text-zinc-300 hover:bg-white/5 transition-colors min-w-[180px]"
|
||||||
>
|
>
|
||||||
<span className="flex items-center gap-2">
|
<span className="flex items-center gap-2">
|
||||||
<span className="font-medium text-white">{selectedProfile?.username || "Select User"}</span>
|
<div className="w-5 h-5 rounded-full bg-gradient-to-br from-primary to-purple-600 flex items-center justify-center text-[10px] font-bold text-white">
|
||||||
{selectedProfile && (
|
{selectedProfile?.username?.substring(0, 1).toUpperCase() || "U"}
|
||||||
<div className="flex gap-1">
|
</div>
|
||||||
{selectedProfile.connected.includes('tiktok') && <TikTokIcon size={12} className="text-white" />}
|
<span className="font-medium text-white truncate max-w-[100px]">{selectedProfile?.username || "Select User"}</span>
|
||||||
{selectedProfile.connected.includes('instagram') && <Instagram size={12} className="text-pink-500" />}
|
|
||||||
{selectedProfile.connected.includes('youtube') && <Youtube size={12} className="text-red-500" />}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</span>
|
</span>
|
||||||
<ChevronDown size={14} className={`text-zinc-500 transition-transform ${isOpen ? 'rotate-180' : ''}`} />
|
<ChevronDown size={14} className={`text-zinc-500 transition-transform ${isOpen ? 'rotate-180' : ''}`} />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
<div className="absolute bottom-full mb-2 left-0 right-0 bg-[#1a1a1a] border border-white/10 rounded-xl shadow-xl z-50 overflow-hidden">
|
<div className="absolute top-full mt-2 right-0 w-64 bg-[#1a1a1a] border border-white/10 rounded-xl shadow-2xl overflow-hidden">
|
||||||
<div className="max-h-60 overflow-y-auto custom-scrollbar">
|
<div className="max-h-60 overflow-y-auto custom-scrollbar">
|
||||||
{profiles.map((profile) => (
|
{profiles.map((profile) => (
|
||||||
<button
|
<button
|
||||||
|
|
@ -101,8 +96,9 @@ function App() {
|
||||||
const [status, setStatus] = useState('idle'); // idle, processing, complete, error
|
const [status, setStatus] = useState('idle'); // idle, processing, complete, error
|
||||||
const [results, setResults] = useState(null);
|
const [results, setResults] = useState(null);
|
||||||
const [logs, setLogs] = useState([]);
|
const [logs, setLogs] = useState([]);
|
||||||
const [logsVisible, setLogsVisible] = useState(false);
|
const [logsVisible, setLogsVisible] = useState(true);
|
||||||
const [processingMedia, setProcessingMedia] = useState(null);
|
const [processingMedia, setProcessingMedia] = useState(null);
|
||||||
|
const [activeTab, setActiveTab] = useState('dashboard'); // dashboard, settings
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (apiKey) localStorage.setItem('gemini_key', apiKey);
|
if (apiKey) localStorage.setItem('gemini_key', apiKey);
|
||||||
|
|
@ -113,9 +109,6 @@ function App() {
|
||||||
localStorage.setItem('uploadUserId', uploadUserId);
|
localStorage.setItem('uploadUserId', uploadUserId);
|
||||||
}, [uploadPostKey, uploadUserId]);
|
}, [uploadPostKey, uploadUserId]);
|
||||||
|
|
||||||
// Auto-fetch profiles when key is set (and not just on mount, but when key changes we might want to debounce or wait)
|
|
||||||
// But user said "when I reload the web I have to hit load profiles".
|
|
||||||
// So on mount, if key exists, fetch.
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (uploadPostKey && userProfiles.length === 0) {
|
if (uploadPostKey && userProfiles.length === 0) {
|
||||||
fetchUserProfiles();
|
fetchUserProfiles();
|
||||||
|
|
@ -195,7 +188,6 @@ function App() {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', data.payload);
|
formData.append('file', data.payload);
|
||||||
body = formData;
|
body = formData;
|
||||||
// Content-Type is auto-set for FormData
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await fetch(getApiUrl('/api/process'), {
|
const res = await fetch(getApiUrl('/api/process'), {
|
||||||
|
|
@ -214,175 +206,255 @@ function App() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
const handleReset = () => {
|
||||||
<div className="min-h-screen bg-background relative overflow-x-hidden p-6 md:p-12">
|
setStatus('idle');
|
||||||
{/* Background Gradients */}
|
setJobId(null);
|
||||||
<div className="fixed top-0 left-0 w-full h-full overflow-hidden -z-10 pointer-events-none">
|
setResults(null);
|
||||||
<div className="absolute -top-[10%] -left-[10%] w-[50%] h-[50%] bg-primary/10 rounded-full blur-[120px]" />
|
setLogs([]);
|
||||||
<div className="absolute top-[20%] -right-[10%] w-[40%] h-[60%] bg-accent/10 rounded-full blur-[120px]" />
|
setProcessingMedia(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
// --- UI Components ---
|
||||||
|
|
||||||
|
const Sidebar = () => (
|
||||||
|
<div className="w-20 lg:w-64 bg-surface border-r border-white/5 flex flex-col h-full shrink-0 transition-all duration-300">
|
||||||
|
<div className="p-6 flex items-center gap-3">
|
||||||
|
<div className="w-8 h-8 bg-primary rounded-lg flex items-center justify-center shrink-0">
|
||||||
|
<Sparkles size={18} className="text-white" />
|
||||||
|
</div>
|
||||||
|
<span className="font-bold text-lg text-white hidden lg:block tracking-tight">OpenShorts</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="max-w-4xl mx-auto">
|
<nav className="flex-1 px-4 py-4 space-y-2">
|
||||||
<header className="mb-12 text-center animate-[fadeIn_0.5s_ease-out]">
|
<button
|
||||||
<div className="inline-flex items-center gap-2 px-3 py-1 bg-white/5 rounded-full border border-white/10 mb-4">
|
onClick={() => setActiveTab('dashboard')}
|
||||||
<Sparkles size={14} className="text-yellow-400" />
|
className={`w-full flex items-center gap-3 px-3 py-3 rounded-xl transition-colors ${activeTab === 'dashboard' ? 'bg-primary/10 text-primary' : 'text-zinc-400 hover:text-white hover:bg-white/5'}`}
|
||||||
<span className="text-xs font-medium text-zinc-300">AI Viral Clipper</span>
|
>
|
||||||
|
<LayoutDashboard size={20} />
|
||||||
|
<span className="font-medium hidden lg:block">Dashboard</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
onClick={() => setActiveTab('settings')}
|
||||||
|
className={`w-full flex items-center gap-3 px-3 py-3 rounded-xl transition-colors ${activeTab === 'settings' ? 'bg-primary/10 text-primary' : 'text-zinc-400 hover:text-white hover:bg-white/5'}`}
|
||||||
|
>
|
||||||
|
<Settings size={20} />
|
||||||
|
<span className="font-medium hidden lg:block">Settings</span>
|
||||||
|
</button>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div className="p-4 border-t border-white/5">
|
||||||
|
<a
|
||||||
|
href="https://github.com/mutonby/openshorts"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="flex items-center gap-2 p-3 bg-white/5 hover:bg-white/10 rounded-xl transition-colors group"
|
||||||
|
>
|
||||||
|
<div className="w-8 h-8 rounded-full bg-white text-black flex items-center justify-center shrink-0">
|
||||||
|
<svg height="20" viewBox="0 0 16 16" version="1.1" width="20" aria-hidden="true"><path fillRule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
|
||||||
</div>
|
</div>
|
||||||
<h1 className="text-5xl md:text-6xl font-black bg-gradient-to-br from-white via-white to-white/50 bg-clip-text text-transparent mb-4 tracking-tight">
|
<div className="hidden lg:block overflow-hidden">
|
||||||
OpenShorts<span className="text-primary">.app</span>
|
<p className="text-sm font-bold text-white leading-none mb-0.5">Open Source</p>
|
||||||
</h1>
|
<p className="text-[10px] text-zinc-400 group-hover:text-zinc-300 transition-colors truncate">Free & Community Driven</p>
|
||||||
<p className="text-zinc-400 text-lg max-w-lg mx-auto">
|
</div>
|
||||||
Transform long-form videos into viral Shorts, Reels, and TikToks instantly with Gemini AI.
|
</a>
|
||||||
</p>
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex h-screen bg-background overflow-hidden selection:bg-primary/30">
|
||||||
|
<Sidebar />
|
||||||
|
|
||||||
|
<main className="flex-1 flex flex-col h-full overflow-hidden relative">
|
||||||
|
{/* Background Gradients */}
|
||||||
|
<div className="absolute inset-0 overflow-hidden -z-10 pointer-events-none">
|
||||||
|
<div className="absolute -top-[10%] -right-[10%] w-[50%] h-[50%] bg-primary/5 rounded-full blur-[120px]" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Top Header */}
|
||||||
|
<header className="h-16 border-b border-white/5 bg-background/50 backdrop-blur-md flex items-center justify-between px-6 shrink-0 z-10">
|
||||||
|
<div className="flex items-center gap-4">
|
||||||
|
{status !== 'idle' && (
|
||||||
|
<button
|
||||||
|
onClick={handleReset}
|
||||||
|
className="flex items-center gap-2 text-sm text-zinc-400 hover:text-white transition-colors"
|
||||||
|
>
|
||||||
|
<PlusCircle size={16} />
|
||||||
|
<span className="hidden sm:inline">New Project</span>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-4">
|
||||||
|
{userProfiles.length > 0 && (
|
||||||
|
<UserProfileSelector
|
||||||
|
profiles={userProfiles}
|
||||||
|
selectedUserId={uploadUserId}
|
||||||
|
onSelect={setUploadUserId}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!apiKey && (
|
||||||
|
<span className="text-xs text-amber-500 bg-amber-500/10 px-3 py-1 rounded-full border border-amber-500/20">
|
||||||
|
API Key Missing
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div className="space-y-4 mb-8">
|
{/* Main Workspace */}
|
||||||
<KeyInput onKeySet={setApiKey} savedKey={apiKey} />
|
<div className="flex-1 overflow-hidden relative">
|
||||||
|
|
||||||
<div className="p-4 rounded-xl bg-white/5 border border-white/10 backdrop-blur-sm">
|
{/* View: Settings */}
|
||||||
<div className="flex flex-col md:flex-row gap-6">
|
{activeTab === 'settings' && (
|
||||||
<div className="flex-1 space-y-4">
|
<div className="h-full overflow-y-auto p-8 max-w-2xl mx-auto animate-[fadeIn_0.3s_ease-out]">
|
||||||
<div className="relative">
|
<h1 className="text-2xl font-bold mb-8">Settings</h1>
|
||||||
<label className="text-xs text-zinc-500 font-medium ml-1 mb-1 block">Upload-Post API Key (Optional)</label>
|
<KeyInput onKeySet={setApiKey} savedKey={apiKey} />
|
||||||
<div className="flex gap-2">
|
|
||||||
<input
|
<div className="glass-panel p-6 mt-8">
|
||||||
type="password"
|
<h2 className="text-lg font-semibold mb-4">Social Integration</h2>
|
||||||
placeholder="ey..."
|
<div className="space-y-4">
|
||||||
value={uploadPostKey}
|
<label className="block text-sm text-zinc-400">Upload-Post API Key</label>
|
||||||
onChange={(e) => setUploadPostKey(e.target.value)}
|
<div className="flex gap-2">
|
||||||
className="flex-1 bg-black/20 border border-white/10 rounded-lg px-4 py-2 text-sm text-zinc-300 focus:outline-none focus:border-primary/50 transition-colors"
|
<input
|
||||||
/>
|
type="password"
|
||||||
<button
|
value={uploadPostKey}
|
||||||
onClick={fetchUserProfiles}
|
onChange={(e) => setUploadPostKey(e.target.value)}
|
||||||
className="px-3 py-2 bg-white/10 hover:bg-white/20 rounded-lg text-xs font-medium text-zinc-300 transition-colors"
|
className="input-field"
|
||||||
title="Fetch User Profiles"
|
placeholder="ey..."
|
||||||
>
|
/>
|
||||||
Load Profiles
|
<button onClick={fetchUserProfiles} className="btn-primary py-2 px-4 text-sm">
|
||||||
</button>
|
Connect
|
||||||
</div>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<p className="text-xs text-zinc-500">
|
||||||
{userProfiles.length > 0 ? (
|
Connect your Upload-Post account to enable one-click publishing.
|
||||||
<UserProfileSelector
|
</p>
|
||||||
profiles={userProfiles}
|
|
||||||
selectedUserId={uploadUserId}
|
|
||||||
onSelect={setUploadUserId}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="relative">
|
|
||||||
<label className="text-xs text-zinc-500 font-medium ml-1 mb-1 block">Upload-Post User ID</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="User Identifier (or Load Profiles)"
|
|
||||||
value={uploadUserId}
|
|
||||||
onChange={(e) => setUploadUserId(e.target.value)}
|
|
||||||
className="w-full bg-black/20 border border-white/10 rounded-lg px-4 py-2 text-sm text-zinc-300 focus:outline-none focus:border-primary/50 transition-colors"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="md:w-64 bg-primary/5 border border-primary/10 rounded-lg p-3">
|
|
||||||
<h4 className="text-xs font-bold text-primary mb-2 flex items-center gap-1.5">
|
|
||||||
<Sparkles size={12} /> Social Auto-Post
|
|
||||||
</h4>
|
|
||||||
<p className="text-[11px] text-zinc-400 leading-relaxed mb-2">
|
|
||||||
Connect your accounts to post directly to TikTok, Instagram & YouTube.
|
|
||||||
</p>
|
|
||||||
<p className="text-[11px] text-zinc-400 leading-relaxed mb-3 border-l-2 border-white/10 pl-2">
|
|
||||||
Post directly to all your social networks. Start with a free trial (no credit card required). Simply connect your accounts, generate an API Key, and you're ready to go.
|
|
||||||
</p>
|
|
||||||
<a
|
|
||||||
href="https://app.upload-post.com/"
|
|
||||||
target="_blank"
|
|
||||||
className="block w-full py-1.5 bg-primary/10 hover:bg-primary/20 text-primary text-center rounded text-xs font-medium transition-colors"
|
|
||||||
>
|
|
||||||
Get Account Used
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="space-y-8">
|
|
||||||
<MediaInput onProcess={handleProcess} isProcessing={status === 'processing'} />
|
|
||||||
|
|
||||||
{status === 'processing' && processingMedia && (
|
|
||||||
<ProcessingAnimation media={processingMedia} />
|
|
||||||
)}
|
|
||||||
|
|
||||||
{(status === 'processing' || status === 'error') && (
|
|
||||||
<div className={`glass-panel p-6 ${status === 'error' ? 'border-red-500/30' : ''}`}>
|
|
||||||
<div className="flex items-center justify-between mb-4">
|
|
||||||
<div className={`flex items-center gap-3 ${status === 'error' ? 'text-red-400' : 'text-zinc-300'}`}>
|
|
||||||
<Activity size={20} className={status === 'processing' ? "animate-pulse text-primary" : ""} />
|
|
||||||
<span className="font-mono text-sm">{status === 'error' ? 'Process Failed' : 'Processing Status'}</span>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
onClick={() => setLogsVisible(!logsVisible)}
|
|
||||||
className="text-xs text-zinc-500 hover:text-zinc-300 transition-colors"
|
|
||||||
>
|
|
||||||
{logsVisible ? 'Hide Logs' : 'Show Logs'}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{logsVisible && (
|
|
||||||
<div className="h-48 overflow-y-auto font-mono text-xs text-zinc-400 space-y-1 custom-scrollbar bg-black/20 p-4 rounded-lg animate-[fadeIn_0.2s_ease-out]">
|
|
||||||
{logs.map((log, i) => (
|
|
||||||
<div key={i} className={log.toLowerCase().includes('error') || log.toLowerCase().includes('failed') ? 'text-red-400' : ''}>
|
|
||||||
{'>'} {log}
|
|
||||||
</div>
|
</div>
|
||||||
))}
|
</div>
|
||||||
{status === 'processing' && <div className="animate-pulse">{'>'} _</div>}
|
</div>
|
||||||
</div>
|
)}
|
||||||
)}
|
|
||||||
{!logsVisible && status === 'processing' && (
|
{/* View: Dashboard (Idle) */}
|
||||||
<div className="text-zinc-500 text-sm animate-pulse">
|
{activeTab === 'dashboard' && status === 'idle' && (
|
||||||
Analyzing video content with Gemini AI...
|
<div className="h-full flex flex-col items-center justify-center p-6 animate-[fadeIn_0.3s_ease-out]">
|
||||||
</div>
|
<div className="max-w-xl w-full text-center space-y-8">
|
||||||
)}
|
<div className="space-y-4">
|
||||||
|
<h1 className="text-4xl md:text-5xl font-black bg-gradient-to-b from-white to-white/60 bg-clip-text text-transparent">
|
||||||
|
Create Viral Shorts
|
||||||
|
</h1>
|
||||||
|
<p className="text-zinc-400 text-lg">
|
||||||
|
Drop your long-form video URL or file below to instantly generate viral clips with AI.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<MediaInput onProcess={handleProcess} isProcessing={status === 'processing'} />
|
||||||
|
|
||||||
|
<div className="flex items-center justify-center gap-8 text-zinc-500 text-sm">
|
||||||
|
<span className="flex items-center gap-2"><Youtube size={16} /> YouTube</span>
|
||||||
|
<span className="flex items-center gap-2"><Instagram size={16} /> Instagram</span>
|
||||||
|
<span className="flex items-center gap-2"><TikTokIcon size={16} /> TikTok</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{status === 'error' && (
|
{/* View: Processing / Results (Split View) */}
|
||||||
<div className="mt-4 bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-xl text-center text-sm">
|
{activeTab === 'dashboard' && (status === 'processing' || status === 'complete' || status === 'error') && (
|
||||||
Processing encountered an error.
|
<div className="h-full flex flex-col md:flex-row animate-[fadeIn_0.3s_ease-out]">
|
||||||
<button
|
|
||||||
onClick={() => setLogsVisible(true)}
|
{/* Left Panel: Preview & Status */}
|
||||||
className="ml-2 underline hover:text-white"
|
<div className={`${status === 'complete' ? 'w-full md:w-[30%] lg:w-[25%]' : 'w-full md:w-[55%] lg:w-[60%]'} h-full flex flex-col border-r border-white/5 bg-black/20 p-6 overflow-y-auto custom-scrollbar transition-all duration-700 ease-in-out`}>
|
||||||
>
|
<div className="mb-6 flex items-center justify-between">
|
||||||
Check Logs
|
<h2 className="text-lg font-semibold flex items-center gap-2">
|
||||||
</button>
|
<Activity className={`text-primary ${status === 'processing' ? 'animate-pulse' : ''}`} size={20} />
|
||||||
<button
|
Live Analysis
|
||||||
onClick={() => setStatus('idle')}
|
</h2>
|
||||||
className="ml-4 underline hover:text-white"
|
<span className={`text-xs px-2 py-1 rounded-full border ${
|
||||||
>
|
status === 'processing' ? 'bg-primary/10 border-primary/20 text-primary' :
|
||||||
Try Again
|
status === 'complete' ? 'bg-green-500/10 border-green-500/20 text-green-400' :
|
||||||
</button>
|
'bg-red-500/10 border-red-500/20 text-red-400'
|
||||||
</div>
|
}`}>
|
||||||
)}
|
{status.toUpperCase()}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
{status === 'complete' && results && (
|
{/* Video Preview */}
|
||||||
<div className="space-y-6">
|
{processingMedia && <ProcessingAnimation media={processingMedia} isComplete={status === 'complete'} />}
|
||||||
<h2 className="text-2xl font-bold text-white mb-6 flex items-center gap-2">
|
|
||||||
<Sparkles className="text-yellow-400" /> Results Generated
|
{/* Logs Terminal */}
|
||||||
</h2>
|
<div className={`bg-[#0c0c0e] rounded-xl border border-white/10 overflow-hidden flex flex-col transition-all duration-500 ${status === 'complete' ? 'h-32 min-h-0 opacity-50 hover:opacity-100' : 'flex-1 min-h-[200px]'}`}>
|
||||||
<div className="grid gap-6">
|
<div className="px-4 py-2 border-b border-white/5 flex items-center justify-between bg-white/5 shrink-0">
|
||||||
{results.clips.map((clip, i) => (
|
<span className="text-xs font-mono text-zinc-400 flex items-center gap-2">
|
||||||
<ResultCard
|
<Terminal size={12} /> System Logs
|
||||||
key={i}
|
</span>
|
||||||
clip={clip}
|
<button onClick={() => setLogsVisible(!logsVisible)} className="text-zinc-500 hover:text-white transition-colors">
|
||||||
index={i}
|
{logsVisible ? <ChevronDown size={14} /> : <ChevronDown size={14} className="rotate-180" />}
|
||||||
jobId={jobId}
|
</button>
|
||||||
uploadPostKey={uploadPostKey}
|
</div>
|
||||||
uploadUserId={uploadUserId}
|
{logsVisible && (
|
||||||
/>
|
<div className="flex-1 p-4 overflow-y-auto font-mono text-xs space-y-1.5 custom-scrollbar text-zinc-400">
|
||||||
))}
|
{logs.map((log, i) => (
|
||||||
|
<div key={i} className={`flex gap-2 ${log.toLowerCase().includes('error') ? 'text-red-400' : 'text-zinc-400'}`}>
|
||||||
|
<span className="text-zinc-700 shrink-0">{new Date().toLocaleTimeString()}</span>
|
||||||
|
<span>{log}</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
{status === 'processing' && (
|
||||||
|
<div className="animate-pulse text-primary/70">_</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Right Panel: Results Grid */}
|
||||||
|
<div className={`${status === 'complete' ? 'w-full md:w-[70%] lg:w-[75%]' : 'w-full md:w-[45%] lg:w-[40%]'} h-full flex flex-col bg-background p-6 transition-all duration-700 ease-in-out`}>
|
||||||
|
<h2 className="text-lg font-semibold mb-6 flex items-center gap-2 shrink-0">
|
||||||
|
<Sparkles className="text-yellow-400" size={20} />
|
||||||
|
Generated Shorts
|
||||||
|
{results?.clips?.length > 0 && (
|
||||||
|
<span className="text-xs bg-white/10 text-white px-2 py-0.5 rounded-full ml-auto">
|
||||||
|
{results.clips.length} Clips
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div className="flex-1 overflow-y-auto custom-scrollbar p-1">
|
||||||
|
{results && results.clips && results.clips.length > 0 ? (
|
||||||
|
<div className="grid grid-cols-1 xl:grid-cols-2 gap-4 pb-10">
|
||||||
|
{results.clips.map((clip, i) => (
|
||||||
|
<ResultCard
|
||||||
|
key={i}
|
||||||
|
clip={clip}
|
||||||
|
index={i}
|
||||||
|
jobId={jobId}
|
||||||
|
uploadPostKey={uploadPostKey}
|
||||||
|
uploadUserId={uploadUserId}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
status === 'processing' ? (
|
||||||
|
<div className="h-full flex flex-col items-center justify-center text-zinc-500 space-y-4 opacity-50">
|
||||||
|
<div className="w-12 h-12 rounded-full border-2 border-zinc-800 border-t-primary animate-spin" />
|
||||||
|
<p className="text-sm">Waiting for clips...</p>
|
||||||
|
</div>
|
||||||
|
) : status === 'error' ? (
|
||||||
|
<div className="h-full flex flex-col items-center justify-center text-red-400 space-y-2">
|
||||||
|
<p>Generation failed.</p>
|
||||||
|
</div>
|
||||||
|
) : null
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ export default function KeyInput({ onKeySet, savedKey }) {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="glass-panel p-6 mb-8 animate-[fadeIn_0.5s_ease-out]">
|
<div className="bg-surface border border-white/5 rounded-2xl p-6 mb-8 animate-[fadeIn_0.5s_ease-out]">
|
||||||
<div className="flex items-center gap-3 mb-4">
|
<div className="flex items-center gap-3 mb-4">
|
||||||
<div className="p-2 bg-accent/20 rounded-lg text-accent">
|
<div className="p-2 bg-accent/20 rounded-lg text-accent">
|
||||||
<Key size={20} />
|
<Key size={20} />
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ export default function MediaInput({ onProcess, isProcessing }) {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="glass-panel p-6 animate-[fadeIn_0.6s_ease-out]">
|
<div className="bg-surface border border-white/5 rounded-2xl p-6 animate-[fadeIn_0.6s_ease-out]">
|
||||||
<div className="flex gap-4 mb-6 border-b border-white/10 pb-4">
|
<div className="flex gap-4 mb-6 border-b border-white/5 pb-4">
|
||||||
<button
|
<button
|
||||||
onClick={() => setMode('url')}
|
onClick={() => setMode('url')}
|
||||||
className={`flex items-center gap-2 pb-2 px-2 transition-all ${mode === 'url'
|
className={`flex items-center gap-2 pb-2 px-2 transition-all ${mode === 'url'
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Scan, Scissors, Activity, Radio } from 'lucide-react';
|
import { Scan, Scissors, Activity, Radio, CheckCircle } from 'lucide-react';
|
||||||
|
|
||||||
const ProcessingAnimation = ({ media }) => {
|
const ProcessingAnimation = ({ media, isComplete }) => {
|
||||||
const [videoSrc, setVideoSrc] = useState(null);
|
const [videoSrc, setVideoSrc] = useState(null);
|
||||||
const [isYouTube, setIsYouTube] = useState(false);
|
const [isYouTube, setIsYouTube] = useState(false);
|
||||||
|
|
||||||
|
|
@ -26,9 +26,9 @@ const ProcessingAnimation = ({ media }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative w-full aspect-video rounded-xl overflow-hidden bg-black/40 border border-white/10 shadow-2xl mb-8 group animate-[fadeIn_0.5s_ease-out]">
|
<div className={`relative w-full aspect-video rounded-xl overflow-hidden bg-black/40 border border-white/10 shadow-2xl mb-8 group animate-[fadeIn_0.5s_ease-out] transition-all duration-500 ${isComplete ? 'grayscale brightness-50' : ''}`}>
|
||||||
{/* Video Layer */}
|
{/* Video Layer */}
|
||||||
<div className="absolute inset-0 opacity-40 grayscale group-hover:grayscale-0 transition-all duration-700">
|
<div className={`absolute inset-0 transition-all duration-700 ${isComplete ? 'opacity-30' : 'opacity-40 grayscale group-hover:grayscale-0'}`}>
|
||||||
{isYouTube && videoSrc ? (
|
{isYouTube && videoSrc ? (
|
||||||
<iframe
|
<iframe
|
||||||
className="w-full h-full pointer-events-none scale-110"
|
className="w-full h-full pointer-events-none scale-110"
|
||||||
|
|
@ -53,58 +53,74 @@ const ProcessingAnimation = ({ media }) => {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Grid Overlay */}
|
{!isComplete && (
|
||||||
<div className="absolute inset-0 bg-[linear-gradient(rgba(255,255,255,0.03)_1px,transparent_1px),linear-gradient(90deg,rgba(255,255,255,0.03)_1px,transparent_1px)] bg-[size:40px_40px] z-10 pointer-events-none"></div>
|
<>
|
||||||
|
{/* Grid Overlay */}
|
||||||
|
<div className="absolute inset-0 bg-[linear-gradient(rgba(255,255,255,0.03)_1px,transparent_1px),linear-gradient(90deg,rgba(255,255,255,0.03)_1px,transparent_1px)] bg-[size:40px_40px] z-10 pointer-events-none"></div>
|
||||||
|
|
||||||
{/* Scanner Animation Line */}
|
{/* Scanner Animation Line */}
|
||||||
<div className="absolute left-0 w-full h-[2px] bg-primary shadow-[0_0_15px_2px_rgba(59,130,246,0.5)] animate-[scan_2.5s_linear_infinite] z-20 pointer-events-none"></div>
|
<div className="absolute left-0 w-full h-[2px] bg-primary shadow-[0_0_15px_2px_rgba(59,130,246,0.5)] animate-[scan_2.5s_linear_infinite] z-20 pointer-events-none"></div>
|
||||||
|
|
||||||
{/* Scanner Gradient Band */}
|
{/* Scanner Gradient Band */}
|
||||||
<div className="absolute left-0 w-full h-[15%] bg-gradient-to-b from-primary/0 via-primary/5 to-primary/0 animate-[scan-overlay_2.5s_linear_infinite] z-10 pointer-events-none"></div>
|
<div className="absolute left-0 w-full h-[15%] bg-gradient-to-b from-primary/0 via-primary/5 to-primary/0 animate-[scan-overlay_2.5s_linear_infinite] z-10 pointer-events-none"></div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* HUD Elements */}
|
{/* HUD Elements */}
|
||||||
<div className="absolute top-4 left-4 z-30 flex items-center gap-2 px-3 py-1.5 bg-black/60 backdrop-blur-md rounded-lg border border-primary/30 text-primary text-xs font-mono font-bold uppercase animate-pulse">
|
<div className={`absolute top-4 left-4 z-30 flex items-center gap-2 px-3 py-1.5 backdrop-blur-md rounded-lg border text-xs font-mono font-bold uppercase transition-all duration-500 ${isComplete ? 'bg-green-500/10 border-green-500/20 text-green-400' : 'bg-black/60 border-primary/30 text-primary animate-pulse'}`}>
|
||||||
<Scan size={14} />
|
{isComplete ? (
|
||||||
Scanning Content...
|
<>
|
||||||
|
<CheckCircle size={14} /> Analysis Complete
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Scan size={14} /> Scanning Content...
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="absolute top-4 right-4 z-30 flex items-center gap-2 px-3 py-1.5 bg-black/60 backdrop-blur-md rounded-lg border border-white/10 text-white/50 text-[10px] font-mono">
|
{!isComplete && (
|
||||||
AI_MODEL: GEMINI-2.5-PRO
|
<div className="absolute top-4 right-4 z-30 flex items-center gap-2 px-3 py-1.5 bg-black/60 backdrop-blur-md rounded-lg border border-white/10 text-white/50 text-[10px] font-mono">
|
||||||
</div>
|
AI_MODEL: GEMINI-2.5-PRO
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Visual Flair: Simulated Crop Marks */}
|
{/* Visual Flair: Simulated Crop Marks */}
|
||||||
<div className="absolute inset-0 pointer-events-none z-20 overflow-hidden">
|
{!isComplete && (
|
||||||
{/* Vertical crop lines showing "potential vertical format" */}
|
<div className="absolute inset-0 pointer-events-none z-20 overflow-hidden">
|
||||||
<div className="absolute top-0 bottom-0 left-[35%] w-[1px] bg-yellow-500/20 border-r border-dashed border-yellow-500/40"></div>
|
{/* Vertical crop lines showing "potential vertical format" */}
|
||||||
<div className="absolute top-0 bottom-0 right-[35%] w-[1px] bg-yellow-500/20 border-l border-dashed border-yellow-500/40"></div>
|
<div className="absolute top-0 bottom-0 left-[35%] w-[1px] bg-yellow-500/20 border-r border-dashed border-yellow-500/40"></div>
|
||||||
|
<div className="absolute top-0 bottom-0 right-[35%] w-[1px] bg-yellow-500/20 border-l border-dashed border-yellow-500/40"></div>
|
||||||
{/* Center focus indicator */}
|
|
||||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-12 h-12 border border-white/20 rounded-full flex items-center justify-center">
|
{/* Center focus indicator */}
|
||||||
<div className="w-1 h-1 bg-red-500 rounded-full animate-ping"></div>
|
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-12 h-12 border border-white/20 rounded-full flex items-center justify-center">
|
||||||
</div>
|
<div className="w-1 h-1 bg-red-500 rounded-full animate-ping"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="absolute bottom-1/3 left-1/2 -translate-x-1/2 flex flex-col items-center justify-center gap-2 opacity-60">
|
<div className="absolute bottom-1/3 left-1/2 -translate-x-1/2 flex flex-col items-center justify-center gap-2 opacity-60">
|
||||||
<Scissors size={24} className="text-white/20" />
|
<Scissors size={24} className="text-white/20" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Bottom Info Bar */}
|
{/* Bottom Info Bar */}
|
||||||
<div className="absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-black/90 to-transparent z-30 flex justify-between items-end border-t border-white/5">
|
{!isComplete && (
|
||||||
<div className="font-mono text-[10px] text-primary/80 space-y-1">
|
<div className="absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-black/90 to-transparent z-30 flex justify-between items-end border-t border-white/5">
|
||||||
<div className="flex items-center gap-2"><Activity size={10} className="animate-bounce" /> > ANALYSIS_THREAD_01: ACTIVE</div>
|
<div className="font-mono text-[10px] text-primary/80 space-y-1">
|
||||||
<div className="flex items-center gap-2"><Radio size={10} /> > AUDIO_TRANSCRIPT: PROCESSING</div>
|
<div className="flex items-center gap-2"><Activity size={10} className="animate-bounce" /> > ANALYSIS_THREAD_01: ACTIVE</div>
|
||||||
|
<div className="flex items-center gap-2"><Radio size={10} /> > AUDIO_TRANSCRIPT: PROCESSING</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-1">
|
||||||
|
<div className="w-1 h-3 bg-primary/40 animate-[pulse_0.5s_infinite]"></div>
|
||||||
|
<div className="w-1 h-5 bg-primary/60 animate-[pulse_0.7s_infinite]"></div>
|
||||||
|
<div className="w-1 h-2 bg-primary/30 animate-[pulse_0.4s_infinite]"></div>
|
||||||
|
<div className="w-1 h-4 bg-primary/80 animate-[pulse_0.6s_infinite]"></div>
|
||||||
|
<div className="w-1 h-3 bg-primary/50 animate-[pulse_0.5s_infinite]"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-1">
|
)}
|
||||||
<div className="w-1 h-3 bg-primary/40 animate-[pulse_0.5s_infinite]"></div>
|
|
||||||
<div className="w-1 h-5 bg-primary/60 animate-[pulse_0.7s_infinite]"></div>
|
|
||||||
<div className="w-1 h-2 bg-primary/30 animate-[pulse_0.4s_infinite]"></div>
|
|
||||||
<div className="w-1 h-4 bg-primary/80 animate-[pulse_0.6s_infinite]"></div>
|
|
||||||
<div className="w-1 h-3 bg-primary/50 animate-[pulse_0.5s_infinite]"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ProcessingAnimation;
|
export default ProcessingAnimation;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Download, Share2, Instagram, Youtube, Video, CheckCircle, AlertCircle, X, Loader2 } from 'lucide-react';
|
import { Download, Share2, Instagram, Youtube, Video, CheckCircle, AlertCircle, X, Loader2, Copy } from 'lucide-react';
|
||||||
import { getApiUrl } from '../config';
|
import { getApiUrl } from '../config';
|
||||||
|
|
||||||
export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUserId }) {
|
export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUserId }) {
|
||||||
|
|
@ -10,11 +10,11 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
||||||
youtube: true
|
youtube: true
|
||||||
});
|
});
|
||||||
const [posting, setPosting] = useState(false);
|
const [posting, setPosting] = useState(false);
|
||||||
const [postResult, setPostResult] = useState(null); // { success: boolean, msg: string }
|
const [postResult, setPostResult] = useState(null);
|
||||||
|
|
||||||
const handlePost = async () => {
|
const handlePost = async () => {
|
||||||
if (!uploadPostKey || !uploadUserId) {
|
if (!uploadPostKey || !uploadUserId) {
|
||||||
setPostResult({ success: false, msg: "Missing API Key or User ID. Configure them at the top." });
|
setPostResult({ success: false, msg: "Missing API Key or User ID." });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,7 +42,6 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
const errText = await res.text();
|
const errText = await res.text();
|
||||||
// Try parsing JSON error
|
|
||||||
try {
|
try {
|
||||||
const jsonErr = JSON.parse(errText);
|
const jsonErr = JSON.parse(errText);
|
||||||
throw new Error(jsonErr.detail || errText);
|
throw new Error(jsonErr.detail || errText);
|
||||||
|
|
@ -51,8 +50,7 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await res.json();
|
setPostResult({ success: true, msg: "Posted successfully!" });
|
||||||
setPostResult({ success: true, msg: "Posted successfully! Check your social accounts." });
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setShowModal(false);
|
setShowModal(false);
|
||||||
setPostResult(null);
|
setPostResult(null);
|
||||||
|
|
@ -68,86 +66,84 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
||||||
const videoUrl = getApiUrl(clip.video_url);
|
const videoUrl = getApiUrl(clip.video_url);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="glass-panel overflow-hidden animate-[fadeIn_0.5s_ease-out]" style={{ animationDelay: `${index * 0.1}s` }}>
|
<div className="bg-surface border border-white/5 rounded-2xl overflow-hidden flex flex-col md:flex-row group hover:border-white/10 transition-all animate-[fadeIn_0.5s_ease-out] h-auto md:h-[350px]" style={{ animationDelay: `${index * 0.1}s` }}>
|
||||||
<div className="grid md:grid-cols-2 gap-0">
|
{/* Left: Video Preview (Fixed Width on Desktop) */}
|
||||||
<div className="bg-black/50 aspect-[9/16] relative group">
|
<div className="w-full md:w-[200px] bg-black relative shrink-0 aspect-[9/16] md:aspect-auto">
|
||||||
<video
|
<video
|
||||||
src={videoUrl}
|
src={videoUrl}
|
||||||
controls
|
controls
|
||||||
className="w-full h-full object-contain"
|
className="w-full h-full object-cover"
|
||||||
loop
|
loop
|
||||||
/>
|
playsInline
|
||||||
<div className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
/>
|
||||||
<a
|
<div className="absolute top-3 left-3 flex gap-2">
|
||||||
href={videoUrl}
|
<span className="bg-black/60 backdrop-blur-md text-white text-[10px] font-bold px-2 py-1 rounded-md border border-white/10 uppercase tracking-wide">
|
||||||
download
|
Clip {index + 1}
|
||||||
className="p-2 bg-black/60 backdrop-blur rounded-lg text-white hover:bg-black/80 inline-flex"
|
</span>
|
||||||
>
|
|
||||||
<Download size={16} />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="p-6 flex flex-col h-full">
|
|
||||||
<div className="mb-4">
|
|
||||||
<div className="flex items-center gap-2 mb-2">
|
|
||||||
<span className="text-xs font-bold px-2 py-1 bg-primary/20 text-primary rounded-md uppercase tracking-wider">
|
|
||||||
Clip {index + 1}
|
|
||||||
</span>
|
|
||||||
<span className="text-xs text-zinc-500 font-mono">
|
|
||||||
{clip.start}s - {clip.end}s
|
|
||||||
</span>
|
|
||||||
<span className="ml-auto text-xs font-medium text-red-400 flex items-center gap-1">
|
|
||||||
<Youtube size={12} /> YouTube Short Title
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<h3 className="text-xl font-bold leading-tight mb-4 text-white">
|
|
||||||
{clip.video_title_for_youtube_short || "Viral Clip"}
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="space-y-4 flex-1">
|
|
||||||
<div className="space-y-1">
|
|
||||||
<div className="flex items-center gap-2 text-xs font-medium text-pink-400">
|
|
||||||
<Instagram size={14} /> Instagram Description
|
|
||||||
</div>
|
|
||||||
<div className="p-3 bg-white/5 rounded-lg text-sm text-zinc-300 leading-relaxed border border-white/5 line-clamp-3 hover:line-clamp-none transition-all">
|
|
||||||
{clip.video_description_for_instagram}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="space-y-1">
|
|
||||||
<div className="flex items-center gap-2 text-xs font-medium text-cyan-400">
|
|
||||||
<Video size={14} /> TikTok Description
|
|
||||||
</div>
|
|
||||||
<div className="p-3 bg-white/5 rounded-lg text-sm text-zinc-300 leading-relaxed border border-white/5 line-clamp-3 hover:line-clamp-none transition-all">
|
|
||||||
{clip.video_description_for_tiktok || clip.video_description_for_instagram}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="mt-6 pt-4 border-t border-white/10 flex gap-2">
|
|
||||||
<button
|
|
||||||
onClick={() => setShowModal(true)}
|
|
||||||
className="flex-1 py-2 bg-white/5 hover:bg-white/10 rounded-lg text-sm font-medium transition-colors flex items-center justify-center gap-2 text-white"
|
|
||||||
>
|
|
||||||
<Share2 size={16} /> Post to Socials
|
|
||||||
</button>
|
|
||||||
<a
|
|
||||||
href={videoUrl}
|
|
||||||
download
|
|
||||||
className="flex-1 py-2 bg-primary/10 hover:bg-primary/20 text-primary rounded-lg text-sm font-medium transition-colors flex items-center justify-center gap-2"
|
|
||||||
>
|
|
||||||
<Download size={16} /> Download
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Modal */}
|
{/* Right: Content & Details */}
|
||||||
|
<div className="flex-1 p-5 flex flex-col bg-[#121214] overflow-hidden">
|
||||||
|
<div className="mb-4">
|
||||||
|
<h3 className="text-base font-bold text-white leading-tight line-clamp-2 mb-2" title={clip.video_title_for_youtube_short}>
|
||||||
|
{clip.video_title_for_youtube_short || "Viral Clip Generated"}
|
||||||
|
</h3>
|
||||||
|
<div className="flex gap-2 text-[10px] text-zinc-500 font-mono">
|
||||||
|
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5">{Math.floor(clip.end - clip.start)}s</span>
|
||||||
|
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5">#shorts</span>
|
||||||
|
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5">#viral</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Scrollable Descriptions Area */}
|
||||||
|
<div className="flex-1 overflow-y-auto custom-scrollbar space-y-3 pr-2 mb-4">
|
||||||
|
{/* YouTube */}
|
||||||
|
<div className="bg-black/20 rounded-lg p-3 border border-white/5">
|
||||||
|
<div className="flex items-center gap-2 text-[10px] font-bold text-red-400 mb-1.5 uppercase tracking-wider">
|
||||||
|
<Youtube size={12} /> YouTube Title
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-zinc-300 select-all">
|
||||||
|
{clip.video_title_for_youtube_short || "Viral Short Video"}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* TikTok / IG */}
|
||||||
|
<div className="bg-black/20 rounded-lg p-3 border border-white/5">
|
||||||
|
<div className="flex items-center gap-2 text-[10px] font-bold text-zinc-400 mb-1.5 uppercase tracking-wider">
|
||||||
|
<Video size={12} className="text-cyan-400" />
|
||||||
|
<span className="text-zinc-500">/</span>
|
||||||
|
<Instagram size={12} className="text-pink-400" />
|
||||||
|
Caption
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-zinc-300 line-clamp-3 hover:line-clamp-none transition-all cursor-pointer select-all">
|
||||||
|
{clip.video_description_for_tiktok || clip.video_description_for_instagram}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Actions Footer */}
|
||||||
|
<div className="grid grid-cols-2 gap-3 mt-auto pt-4 border-t border-white/5">
|
||||||
|
<button
|
||||||
|
onClick={() => setShowModal(true)}
|
||||||
|
className="col-span-1 py-2 bg-primary hover:bg-blue-600 text-white rounded-lg text-xs font-bold shadow-lg shadow-primary/20 transition-all active:scale-[0.98] flex items-center justify-center gap-2"
|
||||||
|
>
|
||||||
|
<Share2 size={14} /> Post
|
||||||
|
</button>
|
||||||
|
<a
|
||||||
|
href={videoUrl}
|
||||||
|
download
|
||||||
|
className="col-span-1 py-2 bg-white/5 hover:bg-white/10 text-zinc-300 hover:text-white rounded-lg text-xs font-medium transition-colors flex items-center justify-center gap-2 border border-white/5"
|
||||||
|
>
|
||||||
|
<Download size={14} /> Download
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Post Modal */}
|
||||||
{showModal && (
|
{showModal && (
|
||||||
<div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm animate-[fadeIn_0.2s_ease-out]">
|
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm animate-[fadeIn_0.2s_ease-out]">
|
||||||
<div className="bg-zinc-900 border border-white/10 p-6 rounded-2xl w-full max-w-sm shadow-2xl relative">
|
<div className="bg-[#121214] border border-white/10 p-6 rounded-2xl w-full max-w-sm shadow-2xl relative">
|
||||||
<button
|
<button
|
||||||
onClick={() => setShowModal(false)}
|
onClick={() => setShowModal(false)}
|
||||||
className="absolute top-4 right-4 text-zinc-500 hover:text-white"
|
className="absolute top-4 right-4 text-zinc-500 hover:text-white"
|
||||||
|
|
@ -155,61 +151,33 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
||||||
<X size={20} />
|
<X size={20} />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<h3 className="text-xl font-bold text-white mb-4">Post to Socials</h3>
|
<h3 className="text-lg font-bold text-white mb-4">Post to Socials</h3>
|
||||||
|
|
||||||
{!uploadPostKey && (
|
{!uploadPostKey && (
|
||||||
<div className="mb-4 p-3 bg-yellow-500/10 border border-yellow-500/20 text-yellow-200 text-sm rounded-lg flex items-start gap-2">
|
<div className="mb-4 p-3 bg-yellow-500/10 border border-yellow-500/20 text-yellow-200 text-xs rounded-lg flex items-start gap-2">
|
||||||
<AlertCircle size={16} className="mt-0.5 shrink-0" />
|
<AlertCircle size={14} className="mt-0.5 shrink-0" />
|
||||||
<div>
|
<div>Configure API Key in Settings first.</div>
|
||||||
Please configure your Upload-Post API Key at the top of the page first.
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="space-y-3 mb-6">
|
<div className="space-y-2 mb-6">
|
||||||
<label className="flex items-center gap-3 p-3 bg-white/5 rounded-lg cursor-pointer hover:bg-white/10 transition-colors border border-white/5">
|
<label className="flex items-center gap-3 p-3 bg-white/5 rounded-lg cursor-pointer hover:bg-white/10 transition-colors border border-white/5">
|
||||||
<input
|
<input type="checkbox" checked={platforms.tiktok} onChange={e => setPlatforms({ ...platforms, tiktok: e.target.checked })} className="w-4 h-4 rounded border-zinc-600 bg-black/50 text-primary focus:ring-primary" />
|
||||||
type="checkbox"
|
<div className="flex items-center gap-2 text-sm text-white"><Video size={16} className="text-cyan-400" /> TikTok</div>
|
||||||
checked={platforms.tiktok}
|
|
||||||
onChange={e => setPlatforms({ ...platforms, tiktok: e.target.checked })}
|
|
||||||
className="w-4 h-4 rounded border-zinc-600 bg-black/50 text-primary focus:ring-primary"
|
|
||||||
/>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Video size={18} className="text-cyan-400" />
|
|
||||||
<span className="text-sm font-medium text-white">TikTok</span>
|
|
||||||
</div>
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label className="flex items-center gap-3 p-3 bg-white/5 rounded-lg cursor-pointer hover:bg-white/10 transition-colors border border-white/5">
|
<label className="flex items-center gap-3 p-3 bg-white/5 rounded-lg cursor-pointer hover:bg-white/10 transition-colors border border-white/5">
|
||||||
<input
|
<input type="checkbox" checked={platforms.instagram} onChange={e => setPlatforms({ ...platforms, instagram: e.target.checked })} className="w-4 h-4 rounded border-zinc-600 bg-black/50 text-primary focus:ring-primary" />
|
||||||
type="checkbox"
|
<div className="flex items-center gap-2 text-sm text-white"><Instagram size={16} className="text-pink-400" /> Instagram</div>
|
||||||
checked={platforms.instagram}
|
|
||||||
onChange={e => setPlatforms({ ...platforms, instagram: e.target.checked })}
|
|
||||||
className="w-4 h-4 rounded border-zinc-600 bg-black/50 text-primary focus:ring-primary"
|
|
||||||
/>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Instagram size={18} className="text-pink-400" />
|
|
||||||
<span className="text-sm font-medium text-white">Instagram</span>
|
|
||||||
</div>
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label className="flex items-center gap-3 p-3 bg-white/5 rounded-lg cursor-pointer hover:bg-white/10 transition-colors border border-white/5">
|
<label className="flex items-center gap-3 p-3 bg-white/5 rounded-lg cursor-pointer hover:bg-white/10 transition-colors border border-white/5">
|
||||||
<input
|
<input type="checkbox" checked={platforms.youtube} onChange={e => setPlatforms({ ...platforms, youtube: e.target.checked })} className="w-4 h-4 rounded border-zinc-600 bg-black/50 text-primary focus:ring-primary" />
|
||||||
type="checkbox"
|
<div className="flex items-center gap-2 text-sm text-white"><Youtube size={16} className="text-red-400" /> YouTube Shorts</div>
|
||||||
checked={platforms.youtube}
|
|
||||||
onChange={e => setPlatforms({ ...platforms, youtube: e.target.checked })}
|
|
||||||
className="w-4 h-4 rounded border-zinc-600 bg-black/50 text-primary focus:ring-primary"
|
|
||||||
/>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Youtube size={18} className="text-red-400" />
|
|
||||||
<span className="text-sm font-medium text-white">YouTube Shorts</span>
|
|
||||||
</div>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{postResult && (
|
{postResult && (
|
||||||
<div className={`mb-4 p-3 rounded-lg text-sm flex items-start gap-2 ${postResult.success ? 'bg-green-500/10 text-green-400' : 'bg-red-500/10 text-red-400'}`}>
|
<div className={`mb-4 p-3 rounded-lg text-xs flex items-start gap-2 ${postResult.success ? 'bg-green-500/10 text-green-400' : 'bg-red-500/10 text-red-400'}`}>
|
||||||
{postResult.success ? <CheckCircle size={16} className="mt-0.5 shrink-0" /> : <AlertCircle size={16} className="mt-0.5 shrink-0" />}
|
{postResult.success ? <CheckCircle size={14} className="mt-0.5 shrink-0" /> : <AlertCircle size={14} className="mt-0.5 shrink-0" />}
|
||||||
<div>{postResult.msg}</div>
|
<div>{postResult.msg}</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
@ -219,15 +187,7 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
||||||
disabled={posting || !uploadPostKey}
|
disabled={posting || !uploadPostKey}
|
||||||
className="w-full py-3 bg-primary hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed rounded-xl text-white font-bold transition-all flex items-center justify-center gap-2"
|
className="w-full py-3 bg-primary hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed rounded-xl text-white font-bold transition-all flex items-center justify-center gap-2"
|
||||||
>
|
>
|
||||||
{posting ? (
|
{posting ? <><Loader2 size={16} className="animate-spin" /> Publishing...</> : <><Share2 size={16} /> Publish Now</>}
|
||||||
<>
|
|
||||||
<Loader2 size={18} className="animate-spin" /> Publishing...
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Share2 size={18} /> Publish Now
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,25 @@
|
||||||
@apply bg-primary hover:bg-blue-600 text-white px-6 py-3 rounded-xl font-medium transition-all active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed shadow-lg shadow-primary/20;
|
@apply bg-primary hover:bg-blue-600 text-white px-6 py-3 rounded-xl font-medium transition-all active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed shadow-lg shadow-primary/20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Custom Scrollbar */
|
||||||
|
.custom-scrollbar::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-scrollbar::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-scrollbar::-webkit-scrollbar-thumb {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
/* Custom Animations */
|
/* Custom Animations */
|
||||||
@keyframes scan {
|
@keyframes scan {
|
||||||
0% { top: 0%; opacity: 0; }
|
0% { top: 0%; opacity: 0; }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue