Unrestricted Open-source alternative to AI video platforms — Free AI image & video generation studio with 600+ models (Flux, Midjourney, Kling, Sora, Veo). No content filters. Self-hosted, MIT licensed.
JavaScript ai-art-generatorai-image-generationai-video-generationfal-ai-alternativegenerative-aiimage-to-videoinvideo-alternativekling-ailipsynclitellm-alternativemidjourney-alternativemuapiopen-sourceopenrouter-alternativeseedance2sora-alternativetext-to-imagetext-to-videouncensoredwan-video
feat(studio): add animated 3D avatar preview carousel to MarketingStudio
Jaya Prasad Kavurue883f92f5094
diff --git a/packages/studio/src/components/MarketingStudio.jsx b/packages/studio/src/components/MarketingStudio.jsxindex 611a7e38..f587c82f 100644--- a/packages/studio/src/components/MarketingStudio.jsx+++ b/packages/studio/src/components/MarketingStudio.jsx@@ -144,7 +144,7 @@ function UploadSlot({ icon, url, progress, label, onUpload, onClear, multiple =);}-function Dropdown({ isOpen, title, items, selectedId, onSelect, onClose, isVideo = false }) {+function Dropdown({ isOpen, title, items, selectedId, onSelect, onClose, isVideo = false, onPreview = null }) {const ref = useRef(null);useEffect(() => {@@ -173,6 +173,25 @@ function Dropdown({ isOpen, title, items, selectedId, onSelect, onClose, isVideoselectedId === item.id || selectedId === item.url ? 'border-primary shadow-glow' : 'border-white/5 hover:border-white/20'}`}>+ {onPreview && !isVideo && (+ <button+ type="button"+ title="Enlarge preview"+ onClick={(e) => {+ e.stopPropagation();+ onPreview(item);+ }}+ className="absolute top-1.5 left-1.5 w-6 h-6 bg-black/60 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 hover:bg-[#22d3ee] hover:text-black transition-all border border-white/10 z-20 text-white"+ >+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">+ <circle cx="11" cy="11" r="8" />+ <line x1="21" y1="21" x2="16.65" y2="16.65" />+ <line x1="11" y1="8" x2="11" y2="14" />+ <line x1="8" y1="11" x2="14" y2="11" />+ </svg>+ </button>+ )}+{isVideo ? (<video src={item.url} autoPlay loop muted className="w-full aspect-[3/4] object-cover group-hover:scale-105 transition-all duration-500" />) : (@@ -252,6 +271,8 @@ export default function MarketingStudio({ apiKey, droppedFiles, onFilesHandled }const [dropdown, setDropdown] = useState(null); // 'format' | 'avatar' | 'ratio' | 'res' | 'duration'const [uploadProgress, setUploadProgress] = useState({ product: 0, avatar: 0, additional: 0 });const [fullscreenUrl, setFullscreenUrl] = useState(null);+ const [previewAvatar, setPreviewAvatar] = useState(null);+ const [slideDirection, setSlideDirection] = useState("next"); // 'next' | 'prev'const textareaRef = useRef(null);@@ -566,7 +587,7 @@ export default function MarketingStudio({ apiKey, droppedFiles, onFilesHandled }</div>{/* Avatar Preset Button */}- <div className="relative">+ <div className="relative flex items-center gap-1.5"><buttononClick={(e) => { e.stopPropagation(); setDropdown(dropdown === 'avatar' ? null : 'avatar'); }}className={`flex items-center gap-2 px-3 py-2 bg-white/[0.03] hover:bg-white/[0.08] rounded border transition-all group whitespace-nowrap ${dropdown === 'avatar' ? 'border-primary/50' : 'border-white/5'}`}@@ -579,12 +600,38 @@ export default function MarketingStudio({ apiKey, droppedFiles, onFilesHandled }</span><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="4" className="opacity-20 group-hover:opacity-100 transition-opacity"><path d="M6 9l6 6 6-6" /></svg></button>++ {avatarImage && (+ <button+ type="button"+ title="Enlarge selected avatar"+ onClick={(e) => {+ e.stopPropagation();+ const currentAvatar = ASSETS.avatar.find(a => a.url === avatarImage);+ if (currentAvatar) {+ setPreviewAvatar(currentAvatar);+ } else {+ setPreviewAvatar({ id: "custom", name: "Custom Uploaded Avatar", url: avatarImage });+ }+ }}+ className="h-[34px] w-[34px] flex items-center justify-center bg-white/[0.03] hover:bg-white/[0.08] rounded border border-white/5 text-white/40 hover:text-primary transition-all"+ >+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">+ <circle cx="11" cy="11" r="8" />+ <line x1="21" y1="21" x2="16.65" y2="16.65" />+ <line x1="11" y1="8" x2="11" y2="14" />+ <line x1="8" y1="11" x2="14" y2="11" />+ </svg>+ </button>+ )}+<DropdownisOpen={dropdown === 'avatar'}title="Avatar Presets"items={ASSETS.avatar}selectedId={avatarImage}onSelect={(item) => setAvatarImage(item.url)}+ onPreview={(item) => setPreviewAvatar(item)}onClose={() => setDropdown(null)}/></div>@@ -635,6 +682,187 @@ export default function MarketingStudio({ apiKey, droppedFiles, onFilesHandled }<video src={fullscreenUrl} controls autoPlay className="max-w-[95vw] max-h-[95vh] rounded-lg shadow-4xl animate-scale-up" onClick={e => e.stopPropagation()} /></div>)}++ {/* ── AVATAR FULLSCREEN PREVIEW MODAL ── */}+ {previewAvatar && (+ <div+ className="fixed inset-0 z-[100] flex items-center justify-center bg-black/40 backdrop-blur-md animate-fade-in select-none"+ onClick={() => setPreviewAvatar(null)}+ >+ {/* Close button (cross) in the right corner */}+ <button+ type="button"+ className="absolute top-6 right-6 p-3 bg-white/10 hover:bg-white/20 rounded-full text-white transition-colors border border-white/10 z-50 animate-fade-in"+ onClick={(e) => {+ e.stopPropagation();+ setPreviewAvatar(null);+ }}+ >+ <CloseSvg />+ </button>++ {/* Inject dynamic CSS animation keyframes */}+ <style>{`+ @keyframes slide-in-next {+ 0% {+ transform: translateX(80px) scale(0.95);+ filter: blur(4px);+ opacity: 0.5;+ }+ 100% {+ transform: translateX(0) scale(1);+ filter: blur(0);+ opacity: 1;+ }+ }+ @keyframes slide-in-prev {+ 0% {+ transform: translateX(-80px) scale(0.95);+ filter: blur(4px);+ opacity: 0.5;+ }+ 100% {+ transform: translateX(0) scale(1);+ filter: blur(0);+ opacity: 1;+ }+ }+ .animate-slide-next {+ animation: slide-in-next 350ms cubic-bezier(0.16, 1, 0.3, 1) forwards;+ }+ .animate-slide-prev {+ animation: slide-in-prev 350ms cubic-bezier(0.16, 1, 0.3, 1) forwards;+ }+ `}</style>++ {/* Left Arrow Button */}+ {previewAvatar.id !== "custom" && (+ <button+ type="button"+ className="absolute left-6 p-4 bg-white/5 hover:bg-white/10 hover:text-primary rounded-full text-white transition-all border border-white/10 z-50"+ onClick={(e) => {+ e.stopPropagation();+ const currentIndex = ASSETS.avatar.findIndex(a => a.id === previewAvatar.id);+ if (currentIndex !== -1) {+ const prevAvatar = ASSETS.avatar[(currentIndex - 1 + ASSETS.avatar.length) % ASSETS.avatar.length];+ setSlideDirection("prev");+ setPreviewAvatar(prevAvatar);+ }+ }}+ >+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round">+ <polyline points="15 18 9 12 15 6" />+ </svg>+ </button>+ )}++ {/* Right Arrow Button */}+ {previewAvatar.id !== "custom" && (+ <button+ type="button"+ className="absolute right-6 p-4 bg-white/5 hover:bg-white/10 hover:text-primary rounded-full text-white transition-all border border-white/10 z-50"+ onClick={(e) => {+ e.stopPropagation();+ const currentIndex = ASSETS.avatar.findIndex(a => a.id === previewAvatar.id);+ if (currentIndex !== -1) {+ const nextAvatar = ASSETS.avatar[(currentIndex + 1) % ASSETS.avatar.length];+ setSlideDirection("next");+ setPreviewAvatar(nextAvatar);+ }+ }}+ >+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round">+ <polyline points="9 18 15 12 9 6" />+ </svg>+ </button>+ )}++ {/* Enlarged Image Card and side displays */}+ <div className="flex items-center gap-6 md:gap-12 max-w-[95vw] justify-center relative">+ {/* Previous Avatar Card (Left side) */}+ {previewAvatar.id !== "custom" && (+ <div+ onClick={(e) => {+ e.stopPropagation();+ const currentIndex = ASSETS.avatar.findIndex(a => a.id === previewAvatar.id);+ if (currentIndex !== -1) {+ const prevAvatar = ASSETS.avatar[(currentIndex - 1 + ASSETS.avatar.length) % ASSETS.avatar.length];+ setSlideDirection("prev");+ setPreviewAvatar(prevAvatar);+ }+ }}+ className="hidden md:flex flex-col items-center opacity-50 hover:opacity-60 scale-75 hover:scale-80 transition-all duration-300 cursor-pointer select-none max-w-[15vw] max-h-[50vh] rounded-xl overflow-hidden border border-white/5 bg-[#0d0d0f]/50"+ >+ <img+ src={ASSETS.avatar[(ASSETS.avatar.findIndex(a => a.id === previewAvatar.id) - 1 + ASSETS.avatar.length) % ASSETS.avatar.length].url}+ alt="Previous Avatar"+ className="w-full h-full object-cover aspect-[3/4]"+ />+ </div>+ )}++ {/* Main Active Avatar Card */}+ <div+ key={previewAvatar.id}+ className={`relative flex flex-col items-center max-w-[90vw] md:max-w-[45vw] max-h-[85vh] z-10 ${+ slideDirection === "next" ? "animate-slide-next" : "animate-slide-prev"+ }`}+ onClick={(e) => e.stopPropagation()}+ >+ <div className="relative rounded-2xl overflow-hidden border border-white/10 bg-[#0d0d0f] shadow-2xl">+ <img+ src={previewAvatar.url}+ alt={previewAvatar.name}+ className="max-w-[80vw] md:max-w-[40vw] max-h-[70vh] md:max-h-[65vh] object-contain"+ />++ {/* Overlay with Name of the Avatar */}+ <div className="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/90 via-black/50 to-transparent p-4 pt-10 flex flex-col items-center justify-end gap-3">+ <h2 className="text-xl font-black text-white tracking-wide uppercase">+ {previewAvatar.name}+ </h2>++ {/* Select button on the enlarged image */}+ <button+ type="button"+ onClick={() => {+ setAvatarImage(previewAvatar.url);+ setPreviewAvatar(null);+ setDropdown(null);+ }}+ className="bg-[#22d3ee] text-black px-6 py-2.5 rounded-full font-black text-sm hover:opacity-95 hover:scale-105 active:scale-95 transition-all flex items-center justify-center gap-1.5 shadow-lg shadow-[#22d3ee]/20"+ >+ <CheckSvg />+ Select Avatar+ </button>+ </div>+ </div>+ </div>++ {/* Next Avatar Card (Right side) */}+ {previewAvatar.id !== "custom" && (+ <div+ onClick={(e) => {+ e.stopPropagation();+ const currentIndex = ASSETS.avatar.findIndex(a => a.id === previewAvatar.id);+ if (currentIndex !== -1) {+ const nextAvatar = ASSETS.avatar[(currentIndex + 1) % ASSETS.avatar.length];+ setSlideDirection("next");+ setPreviewAvatar(nextAvatar);+ }+ }}+ className="hidden md:flex flex-col items-center opacity-50 hover:opacity-60 scale-75 hover:scale-80 transition-all duration-300 cursor-pointer select-none max-w-[15vw] max-h-[50vh] rounded-xl overflow-hidden border border-white/5 bg-[#0d0d0f]/50"+ >+ <img+ src={ASSETS.avatar[(ASSETS.avatar.findIndex(a => a.id === previewAvatar.id) + 1) % ASSETS.avatar.length].url}+ alt="Next Avatar"+ className="w-full h-full object-cover aspect-[3/4]"+ />+ </div>+ )}+ </div>+ </div>+ )}</div>);}