This commit is contained in:
Flatlogic Bot 2026-03-01 23:25:55 +00:00
parent eb5f060d78
commit 92c72bfcd0
6 changed files with 342 additions and 574 deletions

View File

@ -89,7 +89,6 @@ module.exports = class Ai_song_requestsDBApi {
return ai_song_requests;
}
static async bulkImport(data, options) {
const currentUser = (options && options.currentUser) || { id: null };
@ -238,6 +237,10 @@ module.exports = class Ai_song_requestsDBApi {
const currentUser = (options && options.currentUser) || { id: null };
const transaction = (options && options.transaction) || undefined;
if (!ids || !Array.isArray(ids) || ids.length === 0) {
return [];
}
const ai_song_requests = await db.ai_song_requests.findAll({
where: {
id: {
@ -342,7 +345,7 @@ module.exports = class Ai_song_requestsDBApi {
{
model: db.users,
as: 'user',
required: !!filter.user,
where: filter.user ? {
[Op.or]: [
{ id: { [Op.in]: filter.user.split('|').map(term => Utils.uuid(term)) } },
@ -352,14 +355,14 @@ module.exports = class Ai_song_requestsDBApi {
}
},
]
} : {},
} : undefined,
},
{
model: db.genres,
as: 'genre',
required: !!filter.genre,
where: filter.genre ? {
[Op.or]: [
{ id: { [Op.in]: filter.genre.split('|').map(term => Utils.uuid(term)) } },
@ -369,14 +372,14 @@ module.exports = class Ai_song_requestsDBApi {
}
},
]
} : {},
} : undefined,
},
{
model: db.projects,
as: 'project',
required: !!filter.project,
where: filter.project ? {
[Op.or]: [
{ id: { [Op.in]: filter.project.split('|').map(term => Utils.uuid(term)) } },
@ -386,7 +389,7 @@ module.exports = class Ai_song_requestsDBApi {
}
},
]
} : {},
} : undefined,
},
@ -634,4 +637,4 @@ module.exports = class Ai_song_requestsDBApi {
}
};
};

View File

@ -230,6 +230,10 @@ module.exports = class ProjectsDBApi {
const currentUser = (options && options.currentUser) || { id: null };
const transaction = (options && options.transaction) || undefined;
if (!ids || !Array.isArray(ids) || ids.length === 0) {
return [];
}
const projects = await db.projects.findAll({
where: {
id: {
@ -380,7 +384,7 @@ module.exports = class ProjectsDBApi {
{
model: db.users,
as: 'owner',
required: !!filter.owner,
where: filter.owner ? {
[Op.or]: [
{ id: { [Op.in]: filter.owner.split('|').map(term => Utils.uuid(term)) } },
@ -390,14 +394,14 @@ module.exports = class ProjectsDBApi {
}
},
]
} : {},
} : undefined,
},
{
model: db.genres,
as: 'genre',
required: !!filter.genre,
where: filter.genre ? {
[Op.or]: [
{ id: { [Op.in]: filter.genre.split('|').map(term => Utils.uuid(term)) } },
@ -407,7 +411,7 @@ module.exports = class ProjectsDBApi {
}
},
]
} : {},
} : undefined,
},

View File

@ -16,10 +16,11 @@ module.exports = class Ai_song_requestsService {
const isCustom = data.is_custom === true || data.is_custom === 'true';
const voiceType = data.voice_type || 'female';
const style = data.style || 'Pop';
const instrumental = data.instrumental === true || data.instrumental === 'true';
let prompt = '';
if (isCustom) {
prompt = `Based on these lyrics: "${data.lyrics}", and style: "${style}".
prompt = `Based on these lyrics: "${data.lyrics}", and style: "${style}". ${instrumental ? 'This should be an instrumental track.' : ''}
Create a full professional song configuration.
Return ONLY a JSON object with:
"title": "${data.title || 'a creative song title'}",
@ -40,7 +41,7 @@ module.exports = class Ai_song_requestsService {
"outro": "..."
}`;
} else {
prompt = `Create a full song based on this idea: "${data.prompt_text}". Style: ${style}.
prompt = `Create a full song based on this idea: "${data.prompt_text}". Style: ${style}. ${instrumental ? 'This should be an instrumental track.' : ''}
Return ONLY a JSON object with:
"title": "a creative song title",
"bpm": a number between 60-180,
@ -74,13 +75,21 @@ module.exports = class Ai_song_requestsService {
key: 'C Major',
description: 'Professional AI Production',
tags: ['Global', 'AI', style],
lyrics: { verse1: '...', chorus: '...' }
lyrics: { verse1: '...', chorus: '...' },
original_request: {
style,
voiceType,
isCustom,
instrumental,
prompt_text: data.prompt_text,
lyrics: data.lyrics
}
};
if (aiResponse.success) {
try {
const decoded = LocalAIApi.decodeJsonFromResponse(aiResponse);
if (decoded) aiData = { ...aiData, ...decoded };
if (decoded) aiData = { ...aiData, ...decoded, original_request: aiData.original_request };
} catch (e) {
console.error("Failed to decode AI response", e);
}

View File

@ -8,13 +8,13 @@ const countryLanguageDetector = {
name: 'countryLanguageDetector',
lookup() {
if (typeof window !== 'undefined' && window.localStorage) {
return localStorage.getItem('detected_country_lang');
return window.localStorage.getItem('detected_country_lang');
}
return undefined;
},
cacheUserLanguage(lng: string) {
if (typeof window !== 'undefined' && window.localStorage) {
localStorage.setItem('detected_country_lang', lng);
window.localStorage.setItem('detected_country_lang', lng);
}
}
};
@ -44,7 +44,7 @@ i18n
});
// Perform country detection asynchronously if not already detected
if (typeof window !== 'undefined' && window.localStorage && !localStorage.getItem('detected_country_lang')) {
if (typeof window !== 'undefined' && window.localStorage && !window.localStorage.getItem('detected_country_lang')) {
fetch('https://ipapi.co/json/')
.then(res => res.json())
.then(data => {
@ -53,9 +53,11 @@ if (typeof window !== 'undefined' && window.localStorage && !localStorage.getIte
const languages = data.languages.split(',');
if (languages.length > 0) {
const baseLang = languages[0].split('-')[0];
localStorage.setItem('detected_country_lang', baseLang);
if (!localStorage.getItem('app_lang_')) {
i18n.changeLanguage(baseLang);
if (typeof window !== 'undefined' && window.localStorage) {
window.localStorage.setItem('detected_country_lang', baseLang);
if (!window.localStorage.getItem('app_lang_')) {
i18n.changeLanguage(baseLang);
}
}
}
}

View File

@ -13,7 +13,7 @@ import ErrorBoundary from "../components/ErrorBoundary";
import DevModeBadge from '../components/DevModeBadge';
import 'intro.js/introjs.css';
import { appWithTranslation } from 'next-i18next';
import '../i18n';
// import '../i18n';
import IntroGuide from '../components/IntroGuide';
import { appSteps, loginSteps, usersSteps, rolesSteps } from '../stores/introSteps';
@ -40,27 +40,33 @@ function MyApp({ Component, pageProps }: AppPropsWithLayout) {
const [stepName, setStepName] = React.useState('');
const [steps, setSteps] = React.useState([]);
axios.interceptors.request.use(
config => {
const token = localStorage.getItem('token');
React.useEffect(() => {
const requestInterceptor = axios.interceptors.request.use(
config => {
const token = typeof window !== 'undefined' ? localStorage.getItem('token') : null;
if (token) {
config.headers.Authorization = `Bearer ${token}`;
} else {
delete config.headers.Authorization;
if (token) {
config.headers.Authorization = `Bearer ${token}`;
} else {
delete config.headers.Authorization;
}
return config;
},
error => {
return Promise.reject(error);
}
);
return config;
},
error => {
return Promise.reject(error);
}
);
return () => {
axios.interceptors.request.eject(requestInterceptor);
};
}, []);
// TODO: Remove this code in future releases
React.useEffect(() => {
const allowedOrigin = (() => {
if (!document.referrer) {
if (typeof window === 'undefined' || !document.referrer) {
return null;
}
try {
@ -115,7 +121,7 @@ function MyApp({ Component, pageProps }: AppPropsWithLayout) {
// Tour is disabled by default in generated projects.
return;
const isCompleted = (stepKey: string) => {
return localStorage.getItem(`completed_${stepKey}`) === 'true';
return typeof window !== 'undefined' ? localStorage.getItem(`completed_${stepKey}`) === 'true' : false;
};
if (router.pathname === '/login' && !isCompleted('loginSteps')) {
setSteps(loginSteps);

View File

@ -24,52 +24,45 @@ import {
mdiZipBox,
mdiTune,
mdiInstrumentTriangle,
mdiSparkles
mdiEarth,
mdiDotsVertical,
mdiSkipNext,
mdiSkipPrevious,
mdiVolumeMedium,
mdiVolumeMute
} from '@mdi/js';
import Head from 'next/head';
import React, { ReactElement, useEffect, useState, useRef } from 'react';
import CardBox from '../components/CardBox';
import LayoutAuthenticated from '../layouts/Authenticated';
import SectionMain from '../components/SectionMain';
import { getPageTitle } from '../config';
import BaseIcon from '../components/BaseIcon';
import BaseButton from '../components/BaseButton';
import axios from 'axios';
import { useAppSelector } from '../stores/hooks';
import { toast, ToastContainer } from 'react-toastify';
const GENRES = [
'Pop', 'Rock', 'Hip-Hop', 'Trap', 'Electronic', 'Jazz', 'Reggae',
'Classical', 'Bossa Nova', 'Metal', 'Lo-Fi', 'Reggaeton', 'Country',
'Synthwave', 'Phonk', 'K-Pop', 'R&B', 'Disco', 'Funk', 'Soul', 'Gospel'
];
import 'react-toastify/dist/ReactToastify.css';
const SunoStudio = () => {
const { currentUser } = useAppSelector((state) => state.auth);
// Create State
const [activeTab, setActiveTab] = useState<'create' | 'library' | 'explore'>('create');
const [isCustom, setIsCustom] = useState(false);
const [instrumental, setInstrumental] = useState(false);
const [lyrics, setLyrics] = useState('');
const [prompt, setPrompt] = useState('');
const [style, setStyle] = useState('Pop');
const [title, setTitle] = useState('');
const [voiceType, setVoiceType] = useState('female');
const [isPromptRefining, setIsPromptRefining] = useState(false);
// Library State
const [library, setLibrary] = useState<any[]>([]);
const [loading, setLoading] = useState(false);
const [generating, setGenerating] = useState(false);
const [generationStep, setGenerationStep] = useState(0);
const [isGenerating, setIsGenerating] = useState(false);
// Player State
const [currentTrack, setCurrentTrack] = useState<any>(null);
const [isPlaying, setIsPlaying] = useState(false);
const audioRef = useRef<HTMLAudioElement | null>(null);
const [progress, setProgress] = useState(0);
const [duration, setDuration] = useState(0);
const [currentTime, setCurrentTime] = useState(0);
const [showLyrics, setShowLyrics] = useState(false);
const [duration, setDuration] = useState(0);
const [volume, setVolume] = useState(0.8);
useEffect(() => {
fetchLibrary();
@ -87,68 +80,49 @@ const SunoStudio = () => {
}
};
const handleCreate = async () => {
if (!isCustom && !prompt) {
toast.error('Descreva sua ideia para a música');
return;
}
if (isCustom && !lyrics) {
toast.error('Insira a letra da música');
return;
}
const handleGenerate = async () => {
if (isGenerating) return;
try {
setGenerating(true);
setGenerationStep(1); // Writing Lyrics & Composition
await new Promise(r => setTimeout(r, 3000));
setGenerationStep(2); // Arrangement & Instruments
await new Promise(r => setTimeout(r, 3500));
setGenerationStep(3); // Vocal Synthesis & Tuning
await new Promise(r => setTimeout(r, 4000));
setGenerationStep(4); // Final Master & Rendering
const response = await axios.post('/ai_song_requests', {
setIsGenerating(true);
const payload = {
data: {
prompt_text: prompt,
lyrics: lyrics,
style: style,
title: title || `AI Project - ${style}`,
title: title || 'New AI Hit',
prompt_text: isCustom ? lyrics : prompt,
lyrics: isCustom ? lyrics : '',
style,
is_custom: isCustom,
voice_type: voiceType
voice_type: voiceType,
instrumental
}
});
};
const newProject = response.data;
toast.success('HIT MUNDIAL GERADO COM SUCESSO!');
const response = await axios.post('/ai_song_requests', payload);
fetchLibrary();
playTrack(newProject);
// Reset form
setPrompt('');
setLyrics('');
setTitle('');
if (response.status === 200) {
toast.success('Sua música está sendo gerada!', { theme: 'dark' });
fetchLibrary();
setActiveTab('library');
}
} catch (error) {
console.error('Error generating song:', error);
toast.error('Erro no motor de geração. Verifique sua conexão.');
toast.error('Erro ao gerar música. Tente novamente.', { theme: 'dark' });
} finally {
setGenerating(false);
setGenerationStep(0);
setIsGenerating(false);
}
};
const playTrack = (track: any) => {
if (currentTrack?.id === track.id) {
togglePlayback();
return;
}
setCurrentTrack(track);
setIsPlaying(true);
const audioUrl = track.audio_url || 'https://cdn.pixabay.com/audio/2023/10/24/audio_333458421d.mp3';
if (audioRef.current) {
audioRef.current.src = audioUrl;
audioRef.current.play().catch(e => console.error("Playback failed", e));
audioRef.current.src = track?.audio_url;
audioRef.current.load();
audioRef.current.play().catch((e: any) => console.error('Playback error:', e));
}
};
@ -157,7 +131,7 @@ const SunoStudio = () => {
if (isPlaying) {
audioRef.current.pause();
} else {
audioRef.current.play();
audioRef.current.play().catch((e: any) => console.error('Playback error:', e));
}
setIsPlaying(!isPlaying);
};
@ -165,14 +139,17 @@ const SunoStudio = () => {
const handleTimeUpdate = () => {
if (audioRef.current) {
setCurrentTime(audioRef.current.currentTime);
const p = (audioRef.current.currentTime / audioRef.current.duration) * 100;
setProgress(p || 0);
setDuration(audioRef.current.duration || 0);
setProgress((audioRef.current.currentTime / audioRef.current.duration) * 100 || 0);
}
};
const handleLoadedMetadata = () => {
const handleSeek = (e: React.ChangeEvent<HTMLInputElement>) => {
const val = parseFloat(e.target.value);
if (audioRef.current) {
setDuration(audioRef.current.duration);
const newTime = (val / 100) * (audioRef.current.duration || 0);
audioRef.current.currentTime = newTime;
setProgress(val);
}
};
@ -183,522 +160,289 @@ const SunoStudio = () => {
return `${mins}:${secs.toString().padStart(2, '0')}`;
};
const handleProgressChange = (e: React.ChangeEvent<HTMLInputElement>) => {
if (audioRef.current) {
const newTime = (parseFloat(e.target.value) / 100) * audioRef.current.duration;
audioRef.current.currentTime = newTime;
setProgress(parseFloat(e.target.value));
}
};
const handleDownload = (track: any = currentTrack) => {
if (!track) return;
const url = track.audio_url || 'https://cdn.pixabay.com/audio/2023/10/24/audio_333458421d.mp3';
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', `${track.title || 'AI_Music_Studio'}.mp3`);
link.setAttribute('target', '_blank');
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
toast.info(`Baixando: ${track.title}`);
};
const handleDownloadAll = () => {
if (library.length === 0) return;
toast.info('Iniciando download de todas as criações...');
library.forEach((track, index) => {
setTimeout(() => {
handleDownload(track);
}, index * 1000); // Small delay to avoid browser blocking multiple downloads
});
};
const handleDelete = async (id: string) => {
if (confirm('Deseja excluir permanentemente este hit?')) {
try {
await axios.post('/projects/deleteByIds', { ids: [id] });
setLibrary(library.filter(t => t.id !== id));
if (currentTrack?.id === id) {
setCurrentTrack(null);
setIsPlaying(false);
}
toast.info('Hit removido da biblioteca');
} catch (e) {
toast.error('Erro ao excluir');
const deleteTrack = async (id: string) => {
if (!confirm('Deseja excluir esta música?')) return;
try {
await axios.delete(`/projects/${id}`);
fetchLibrary();
if (currentTrack?.id === id) {
setCurrentTrack(null);
setIsPlaying(false);
}
toast.info('Música removida', { theme: 'dark' });
} catch (error) {
toast.error('Erro ao excluir', { theme: 'dark' });
}
};
return (
<div className="flex h-screen bg-[#050505] text-gray-200 overflow-hidden font-sans selection:bg-[#00E5FF]/30">
<div className="flex flex-col h-[calc(100vh-60px)] bg-[#050505] text-gray-200 overflow-hidden font-sans">
<Head>
<title>{getPageTitle('STUDIO PRO - Global AI Music Engine')}</title>
<title>{getPageTitle('STUDIO AI')}</title>
</Head>
<ToastContainer position="top-right" autoClose={3000} />
{/* Left Sidebar */}
<aside className="w-[380px] bg-[#0A0A0A] border-r border-white/5 flex flex-col p-8 overflow-y-auto aside-scrollbars z-30">
<div className="flex items-center space-x-4 mb-12 px-2">
<div className="w-12 h-12 bg-gradient-to-br from-[#00E5FF] to-[#7000FF] rounded-2xl flex items-center justify-center shadow-[0_0_30px_rgba(0,229,255,0.4)] border border-white/10">
<BaseIcon path={mdiMusic} className="text-black" size={28} />
</div>
<div>
<span className="text-xl font-black text-white tracking-tighter uppercase leading-none block">STUDIO PRO</span>
<span className="text-[10px] font-black text-[#00E5FF] uppercase tracking-[0.4em] opacity-80 mt-1 block">Global Hit Engine</span>
</div>
</div>
<div className="space-y-10 flex-1">
<div className="flex items-center justify-between px-2">
<h2 className="text-[11px] font-black text-white uppercase tracking-widest flex items-center">
<BaseIcon path={mdiSparkles} size={16} className="mr-3 text-[#00E5FF] animate-pulse" />
CONSTRUTOR DE HITS
</h2>
<div className="flex items-center space-x-1 bg-white/5 p-1 rounded-xl border border-white/5">
<button
onClick={() => setIsCustom(false)}
className={`px-4 py-1.5 rounded-lg text-[9px] font-black uppercase transition-all ${!isCustom ? 'bg-[#00E5FF] text-black shadow-lg shadow-[#00E5FF]/20' : 'text-gray-500 hover:text-white'}`}
>
Auto
</button>
<button
onClick={() => setIsCustom(true)}
className={`px-4 py-1.5 rounded-lg text-[9px] font-black uppercase transition-all ${isCustom ? 'bg-[#7000FF] text-white shadow-lg shadow-[#7000FF]/20' : 'text-gray-500 hover:text-white'}`}
>
Lyrics
</button>
</div>
</div>
<div className="space-y-8">
<div className="space-y-3">
<label className="text-[10px] font-black text-gray-500 uppercase px-3 tracking-widest flex items-center">
<BaseIcon path={mdiTune} size={14} className="mr-2" />
Gênero / Estilo Mundial
</label>
<div className="grid grid-cols-3 gap-2 px-1">
{GENRES.slice(0, 9).map(g => (
<button
key={g}
onClick={() => setStyle(g)}
className={`py-2 rounded-xl text-[9px] font-black uppercase transition-all border ${style === g ? 'bg-white text-black border-white' : 'bg-white/5 text-gray-500 border-white/5 hover:border-white/20 hover:text-white'}`}
>
{g}
</button>
))}
</div>
<div className="relative mt-4">
<input
type="text"
className="w-full bg-[#111] border border-white/5 text-sm text-white rounded-2xl p-4 pl-12 focus:border-[#00E5FF]/50 outline-none placeholder:text-gray-700 transition-all shadow-inner"
placeholder="Ou digite qualquer estilo (ex: K-Pop, Synthwave...)"
value={style}
onChange={(e) => setStyle(e.target.value)}
/>
<BaseIcon path={mdiInstrumentTriangle} className="absolute left-4 top-4 text-gray-700" size={18} />
<div className="flex flex-1 overflow-hidden">
{/* Creation Sidebar */}
<aside className="w-[400px] bg-[#0A0A0A] border-r border-white/5 flex flex-col overflow-y-auto aside-scrollbars">
<div className="p-6 space-y-6">
<div className="flex items-center justify-between mb-4">
<h2 className="text-xl font-black tracking-tighter uppercase italic">Criar Música</h2>
<div className="flex bg-white/5 rounded-full p-1">
<button
onClick={() => setIsCustom(false)}
className={`px-4 py-1 rounded-full text-[10px] font-black uppercase transition-all ${!isCustom ? 'bg-white text-black' : 'text-gray-500'}`}
>
Simples
</button>
<button
onClick={() => setIsCustom(true)}
className={`px-4 py-1 rounded-full text-[10px] font-black uppercase transition-all ${isCustom ? 'bg-white text-black' : 'text-gray-500'}`}
>
Custom
</button>
</div>
</div>
{isCustom ? (
<div className="space-y-3 animate-fade-in">
<label className="text-[10px] font-black text-gray-500 uppercase px-3 tracking-widest">Letra Customizada (Estrutura Completa)</label>
<textarea
className="w-full bg-[#111] border border-white/5 text-sm text-white rounded-2xl p-5 focus:border-[#7000FF]/50 transition-all outline-none resize-none placeholder:text-gray-700 h-[300px] aside-scrollbars"
placeholder="[Intro]\n[Verse 1]\n[Chorus]\n[Outro]..."
value={lyrics}
onChange={(e) => setLyrics(e.target.value)}
/>
<div className="space-y-4">
<div>
<label className="text-[10px] font-black uppercase text-gray-500 mb-2 block">Letras da Música</label>
<textarea
value={lyrics}
onChange={(e) => setLyrics(e.target.value)}
placeholder="Insira suas letras aqui..."
className="w-full h-48 bg-white/5 border border-white/10 rounded-2xl p-4 text-sm focus:border-[#00E5FF] outline-none transition-all resize-none"
/>
</div>
<div>
<label className="text-[10px] font-black uppercase text-gray-500 mb-2 block">Estilo de Música</label>
<input
type="text"
value={style}
onChange={(e) => setStyle(e.target.value)}
placeholder="Ex: Pop, Rock, Cinematic, etc."
className="w-full bg-white/5 border border-white/10 rounded-xl p-3 text-sm focus:border-[#00E5FF] outline-none transition-all"
/>
</div>
<div>
<label className="text-[10px] font-black uppercase text-gray-500 mb-2 block">Título</label>
<input
type="text"
value={title}
onChange={(e) => setTitle(e.target.value)}
placeholder="Dê um nome ao seu hit"
className="w-full bg-white/5 border border-white/10 rounded-xl p-3 text-sm focus:border-[#00E5FF] outline-none transition-all"
/>
</div>
</div>
) : (
<div className="space-y-3 animate-fade-in">
<label className="text-[10px] font-black text-gray-500 uppercase px-3 tracking-widest">Prompt Criativo da IA</label>
<div>
<label className="text-[10px] font-black uppercase text-gray-500 mb-2 block">Descrição da Música</label>
<textarea
className="w-full bg-[#111] border border-white/5 text-sm text-white rounded-2xl p-6 focus:border-[#00E5FF]/50 transition-all outline-none resize-none placeholder:text-gray-700 shadow-inner h-[180px]"
placeholder="Ex: Um Synthwave melancólico dos anos 80 sobre neon e chuva, com baixo potente..."
value={prompt}
onChange={(e) => setPrompt(e.target.value)}
placeholder="Descreva a música que você quer criar... Ex: Um pop animado sobre o verão."
className="w-full h-48 bg-white/5 border border-white/10 rounded-2xl p-4 text-sm focus:border-[#00E5FF] outline-none transition-all resize-none"
/>
</div>
)}
<div className="space-y-3">
<label className="text-[10px] font-black text-gray-500 uppercase px-3 tracking-widest">Inteligência Vocal</label>
<div className="grid grid-cols-2 gap-3 bg-white/5 p-1.5 rounded-2xl border border-white/5">
<button
onClick={() => setVoiceType('female')}
className={`py-4 rounded-xl text-[10px] font-black uppercase transition-all flex items-center justify-center ${voiceType === 'female' ? 'bg-white text-black shadow-xl shadow-white/10' : 'text-gray-500 hover:text-white'}`}
>
<BaseIcon path={mdiMicrophone} size={16} className="mr-3" />
Voz Feminina
</button>
<button
onClick={() => setVoiceType('male')}
className={`py-4 rounded-xl text-[10px] font-black uppercase transition-all flex items-center justify-center ${voiceType === 'male' ? 'bg-white text-black shadow-xl shadow-white/10' : 'text-gray-500 hover:text-white'}`}
>
<BaseIcon path={mdiMicrophone} size={16} className="mr-3" />
Voz Masculina
</button>
<div className="flex items-center justify-between p-4 bg-white/5 rounded-2xl">
<span className="text-[10px] font-black uppercase text-gray-400">Instrumental</span>
<button
onClick={() => setInstrumental(!instrumental)}
className={`w-12 h-6 rounded-full transition-all relative ${instrumental ? 'bg-[#00E5FF]' : 'bg-white/10'}`}
>
<div className={`absolute top-1 w-4 h-4 bg-white rounded-full transition-all ${instrumental ? 'left-7' : 'left-1'}`} />
</button>
</div>
<div className="space-y-2">
<label className="text-[10px] font-black uppercase text-gray-500 block">Voz</label>
<div className="grid grid-cols-2 gap-2">
<button onClick={() => setVoiceType('female')} className={`py-2 rounded-xl text-[10px] font-black uppercase border ${voiceType === 'female' ? 'bg-white text-black border-white' : 'bg-white/5 text-gray-500 border-transparent'}`}>Feminina</button>
<button onClick={() => setVoiceType('male')} className={`py-2 rounded-xl text-[10px] font-black uppercase border ${voiceType === 'male' ? 'bg-white text-black border-white' : 'bg-white/5 text-gray-500 border-transparent'}`}>Masculina</button>
</div>
</div>
<button
disabled={generating}
onClick={handleCreate}
className={`w-full font-black py-6 rounded-2xl transition-all flex flex-col items-center justify-center relative overflow-hidden group border border-white/10 ${generating ? 'bg-white/5 cursor-not-allowed' : 'bg-[#00E5FF] hover:bg-[#00FFEE] text-black shadow-[0_20px_60px_rgba(0,229,255,0.3)] hover:scale-[1.03] active:scale-95'}`}
onClick={handleGenerate}
disabled={isGenerating || (!isCustom && !prompt) || (isCustom && (!lyrics || !style))}
className={`w-full py-6 rounded-2xl font-black uppercase tracking-widest text-lg transition-all flex items-center justify-center gap-3 ${isGenerating ? 'bg-gray-800 text-gray-600 cursor-not-allowed' : 'bg-[#00E5FF] text-black hover:scale-[1.02] active:scale-[0.98]'}`}
>
{generating ? (
<div className="w-full px-8 space-y-3">
<div className="flex justify-between items-center text-[9px] font-black uppercase tracking-tighter text-[#00E5FF]">
<span className="animate-pulse">{generationStep === 1 ? 'Gerando Letras...' : generationStep === 2 ? 'Arranjando Instrumentos...' : generationStep === 3 ? 'Sintetizando Vocais IA...' : 'Renderizando Master...'}</span>
<span>{generationStep * 25}%</span>
</div>
<div className="w-full h-2 bg-white/10 rounded-full overflow-hidden">
<div className="h-full bg-[#00E5FF] shadow-[0_0_20px_#00E5FF] transition-all duration-1000 ease-in-out" style={{ width: `${generationStep * 25}%` }} />
</div>
</div>
{isGenerating ? (
<>
<BaseIcon path={mdiRefresh} size={24} className="animate-spin" />
Gerando...
</>
) : (
<>
<span className="flex items-center text-sm uppercase tracking-[0.25em] font-black italic"><BaseIcon path={mdiCreation} className="mr-3" /> GERAR HIT REAL</span>
<span className="text-[9px] opacity-70 uppercase font-black mt-2 tracking-widest">Global Music Engine V4.0</span>
<BaseIcon path={mdiCreation} size={24} />
Criar Música
</>
)}
</button>
</div>
</div>
</aside>
</aside>
{/* Main Feed */}
<main className="flex-1 flex flex-col bg-[#050505] overflow-hidden">
<header className="h-24 flex items-center justify-between px-12 bg-[#050505]/90 backdrop-blur-3xl border-b border-white/5 z-20">
<div className="flex items-center space-x-12">
<button className="text-white font-black text-xs uppercase tracking-[0.4em] border-b-2 border-[#00E5FF] py-9">Sua Biblioteca</button>
<button className="text-gray-600 hover:text-white font-black text-xs uppercase tracking-[0.4em] py-9 transition-colors">Top Global</button>
<button className="text-gray-600 hover:text-white font-black text-xs uppercase tracking-[0.4em] py-9 transition-colors">Comunidade</button>
{/* Main Content */}
<main className="flex-1 flex flex-col bg-[#050505] overflow-hidden">
<header className="h-20 flex items-center px-8 border-b border-white/5 justify-between">
<div className="flex gap-8">
<button onClick={() => setActiveTab('explore')} className={`text-sm font-black uppercase tracking-wider transition-all ${activeTab === 'explore' ? 'text-white border-b-2 border-[#00E5FF] pb-2' : 'text-gray-500 hover:text-white'}`}>Explorar</button>
<button onClick={() => setActiveTab('library')} className={`text-sm font-black uppercase tracking-wider transition-all ${activeTab === 'library' ? 'text-white border-b-2 border-[#00E5FF] pb-2' : 'text-gray-500 hover:text-white'}`}>Minha Biblioteca</button>
</div>
</header>
<div className="flex-1 overflow-y-auto p-8 aside-scrollbars">
{activeTab === 'library' ? (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
{loading ? (
Array(8).fill(0).map((_, i) => (
<div key={i} className="bg-[#0D0D0D] rounded-3xl p-6 border border-white/5 animate-pulse h-64" />
))
) : library.length > 0 ? (
library.map((track) => (
<div key={track.id} className="group bg-[#0D0D0D] rounded-3xl p-6 border border-white/5 hover:border-white/10 transition-all relative overflow-hidden">
<div className="absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-[#00E5FF] to-purple-500 opacity-0 group-hover:opacity-100 transition-all" />
<div className="aspect-square bg-gradient-to-br from-[#1A1A1A] to-[#0A0A0A] rounded-2xl mb-4 flex items-center justify-center relative">
<BaseIcon path={mdiMusic} size={48} className="text-white/10" />
<button
onClick={() => playTrack(track)}
className="absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 group-hover:opacity-100 transition-all"
>
<div className="w-16 h-16 rounded-full bg-[#00E5FF] flex items-center justify-center text-black">
<BaseIcon path={currentTrack?.id === track.id && isPlaying ? mdiPause : mdiPlay} size={32} />
</div>
</button>
</div>
<div className="flex justify-between items-start">
<div className="flex-1 min-w-0">
<h3 className="font-black text-white text-lg uppercase italic truncate">{track?.title}</h3>
<p className="text-[10px] font-bold text-gray-500 uppercase truncate mt-1">
{track?.ai_data?.style || 'AI GEN'} {track?.key_signature || 'N/A'} {track?.bpm || '128'} BPM
</p>
</div>
<button onClick={() => deleteTrack(track.id)} className="p-2 hover:bg-white/5 rounded-full text-gray-600 hover:text-red-500 transition-all">
<BaseIcon path={mdiDelete} size={18} />
</button>
</div>
<div className="mt-4 flex items-center justify-between text-gray-600">
<div className="flex gap-4">
<button className="hover:text-white"><BaseIcon path={mdiHeart} size={18} /></button>
<button className="hover:text-white"><BaseIcon path={mdiShare} size={18} /></button>
</div>
<div className="text-[10px] font-mono">{new Date(track.createdAt).toLocaleDateString()}</div>
</div>
</div>
))
) : (
<div className="col-span-full py-20 flex flex-col items-center text-gray-600">
<BaseIcon path={mdiLibrary} size={64} className="mb-4 opacity-20" />
<p className="font-black uppercase italic tracking-widest">Sua biblioteca está vazia</p>
<button onClick={() => setActiveTab('create')} className="mt-4 text-[#00E5FF] text-[10px] font-black uppercase hover:underline">Comece a criar agora</button>
</div>
)}
</div>
) : (
<div className="flex flex-col items-center justify-center h-full text-gray-600 space-y-4">
<BaseIcon path={mdiEarth} size={64} className="opacity-20" />
<p className="font-black uppercase italic tracking-widest">Explore hits da comunidade</p>
<span className="text-[10px] uppercase font-bold px-4 py-1 bg-white/5 rounded-full">Em Breve</span>
</div>
)}
</div>
<div className="flex items-center space-x-8">
<button
onClick={handleDownloadAll}
className="px-6 py-2.5 rounded-xl bg-white/5 hover:bg-white/10 border border-white/5 flex items-center text-[10px] font-black uppercase tracking-widest transition-all text-gray-400 hover:text-[#00E5FF]"
>
<BaseIcon path={mdiZipBox} size={18} className="mr-3" />
Baixar Tudo
</button>
<div className="w-12 h-12 rounded-2xl bg-gradient-to-tr from-gray-800 to-gray-900 border border-white/10 flex items-center justify-center overflow-hidden cursor-pointer hover:border-[#00E5FF] transition-all group">
<BaseIcon path={mdiAccountCircle} className="text-gray-400 group-hover:text-white transition-colors" size={28} />
</main>
</div>
{/* Global Player */}
{currentTrack && (
<div className="h-[120px] bg-[#0A0A0A]/95 border-t border-white/5 flex items-center px-8 z-[200]">
<div className="flex items-center w-[300px] gap-4">
<div className="w-16 h-16 rounded-xl bg-gradient-to-br from-[#00E5FF] to-purple-600 flex items-center justify-center flex-shrink-0">
<BaseIcon path={mdiMusic} size={32} className="text-white" />
</div>
<div className="min-w-0">
<h4 className="text-white font-black text-lg uppercase italic truncate">{currentTrack?.title}</h4>
<p className="text-[10px] font-bold text-gray-500 uppercase truncate">AI Generated Artist</p>
</div>
</div>
</header>
<div className="flex-1 overflow-y-auto p-12 aside-scrollbars bg-[#050505]">
<div className="mb-12">
<h1 className="text-4xl font-black text-white italic tracking-tighter uppercase mb-2">Seu Estúdio de Hits</h1>
<p className="text-gray-600 font-black text-[10px] uppercase tracking-[0.5em]">Gerenciamento de composições IA em tempo real</p>
</div>
<div className="flex-1 flex flex-col items-center max-w-2xl mx-auto">
<div className="flex items-center gap-6 mb-2">
<button className="text-gray-500 hover:text-white transition-all"><BaseIcon path={mdiSkipPrevious} size={28} /></button>
<button
onClick={togglePlayback}
className="w-12 h-12 rounded-full bg-white flex items-center justify-center text-black hover:scale-110 transition-all"
>
<BaseIcon path={isPlaying ? mdiPause : mdiPlay} size={28} />
</button>
<button className="text-gray-500 hover:text-white transition-all"><BaseIcon path={mdiSkipNext} size={28} /></button>
</div>
<div className="w-full flex items-center gap-3">
<span className="text-[10px] font-mono text-gray-500 w-10 text-right">{formatTime(currentTime)}</span>
<input
type="range"
min="0"
max="100"
value={progress}
onChange={handleSeek}
className="flex-1 h-1 bg-white/10 rounded-full appearance-none cursor-pointer accent-[#00E5FF]"
/>
<span className="text-[10px] font-mono text-gray-500 w-10">{formatTime(duration)}</span>
</div>
</div>
{loading ? (
<div className="flex flex-col items-center justify-center h-[60vh] space-y-6">
<div className="w-16 h-16 border-4 border-[#00E5FF] border-t-transparent rounded-full animate-spin shadow-[0_0_30px_#00E5FF/20]" />
<span className="text-[11px] font-black text-gray-500 uppercase tracking-[0.4em] animate-pulse">Sincronizando Banco de Dados Global...</span>
</div>
) : (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-10 pb-40">
{library.map((track) => (
<div
key={track.id}
className={`group relative bg-[#0D0D0D] rounded-[2.8rem] overflow-hidden border border-white/5 hover:border-white/20 transition-all duration-700 shadow-2xl ${currentTrack?.id === track.id ? 'ring-2 ring-[#00E5FF] bg-[#151515]' : 'hover:-translate-y-3'}`}
>
<div className="aspect-square bg-[#151515] relative overflow-hidden">
<div className="absolute inset-0 bg-gradient-to-tr from-black via-transparent to-white/10" />
{/* Artwork Placeholder */}
<div className="absolute inset-0 flex items-center justify-center">
<BaseIcon path={mdiMusic} size={80} className="text-white/5 group-hover:text-white/10 transition-colors" />
</div>
<div className="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-all duration-500 bg-black/60 backdrop-blur-xl">
<button
onClick={() => playTrack(track)}
className="w-20 h-20 rounded-full bg-white flex items-center justify-center text-black hover:scale-110 active:scale-90 transition-all shadow-[0_0_50px_rgba(255,255,255,0.5)]"
>
<BaseIcon path={(currentTrack?.id === track.id && isPlaying) ? mdiPause : mdiPlay} size={48} />
</button>
</div>
<div className="absolute top-6 left-6 flex space-x-2">
<div className="px-4 py-1.5 bg-black/80 backdrop-blur-md rounded-full border border-white/10 text-[9px] font-black text-[#00E5FF] uppercase tracking-[0.25em] shadow-xl">
{track.bpm || '128'} BPM
</div>
</div>
{currentTrack?.id === track.id && isPlaying && (
<div className="absolute bottom-6 left-1/2 -translate-x-1/2 flex items-end space-x-1.5 h-12">
{[...Array(8)].map((_, i) => (
<div key={i} className="w-2 bg-[#00E5FF] rounded-full animate-music-bar shadow-[0_0_15px_#00E5FF]" style={{ animationDelay: `${i * 0.1}s` }} />
))}
</div>
)}
</div>
<div className="p-8">
<div className="flex justify-between items-start mb-3">
<h3 className="font-black text-white text-lg uppercase tracking-tighter truncate leading-none italic pr-4">{track.title}</h3>
<button onClick={() => handleDelete(track.id)} className="shrink-0">
<BaseIcon path={mdiDelete} size={18} className="text-gray-800 hover:text-red-500 transition-colors" />
</button>
</div>
<div className="flex flex-wrap gap-2 mb-6">
<span className="text-[8px] font-black text-gray-500 uppercase tracking-widest bg-white/5 px-2 py-1 rounded-md border border-white/5">
{track.key_signature || 'C Major'}
</span>
<span className="text-[8px] font-black text-[#7000FF] uppercase tracking-widest bg-[#7000FF]/10 px-2 py-1 rounded-md border border-[#7000FF]/20">
HI-FI AI
</span>
</div>
<div className="flex items-center justify-between pt-6 border-t border-white/5">
<button
onClick={() => { setCurrentTrack(track); setShowLyrics(true); }}
className="flex items-center text-[9px] font-black text-white/40 hover:text-[#00E5FF] uppercase tracking-widest transition-colors"
>
<BaseIcon path={mdiPlaylistMusic} size={14} className="mr-2" />
VER LETRA
</button>
<button onClick={() => handleDownload(track)}>
<BaseIcon path={mdiDownload} size={18} className="text-gray-700 hover:text-white transition-colors" />
</button>
</div>
</div>
</div>
))}
{library.length === 0 && !loading && (
<div className="col-span-full py-60 text-center">
<div className="w-28 h-28 bg-white/5 rounded-[2.5rem] flex items-center justify-center mx-auto mb-10 border border-white/5 shadow-2xl">
<BaseIcon path={mdiSparkles} size={50} className="text-gray-800" />
</div>
<h3 className="text-3xl font-black text-gray-700 uppercase tracking-[0.2em] italic">O Silêncio dos Gênios</h3>
<p className="text-gray-800 uppercase text-xs font-black tracking-[0.5em] mt-8 opacity-60">Seu primeiro Hit Global começa com um prompt...</p>
<BaseButton
label="INICIAR CRIAÇÃO"
color="info"
className="mt-12 px-12 py-4 rounded-2xl font-black italic tracking-widest"
onClick={() => setIsCustom(false)}
/>
</div>
)}
</div>
)}
</div>
</main>
{/* Full Lyrics Portal */}
{showLyrics && currentTrack && (
<div className="fixed inset-0 z-[150] flex justify-end bg-black/80 backdrop-blur-2xl transition-all" onClick={() => setShowLyrics(false)}>
<aside className="w-[600px] h-full bg-[#080808] border-l border-white/10 flex flex-col p-16 animate-slide-in-right overflow-y-auto aside-scrollbars relative shadow-[-50px_0_100px_rgba(0,0,0,0.5)]" onClick={e => e.stopPropagation()}>
<div className="flex items-center justify-between mb-20">
<div>
<h2 className="text-xs font-black text-white uppercase tracking-[0.6em] mb-4 flex items-center">
<div className="w-12 h-1 bg-[#00E5FF] mr-6 shadow-[0_0_15px_#00E5FF]" />
COMPOSIÇÃO COMPLETA
</h2>
<h1 className="text-3xl font-black text-[#7000FF] uppercase italic tracking-tighter">{currentTrack.title}</h1>
<div className="flex space-x-6 mt-4 opacity-50">
<span className="text-[10px] font-black uppercase tracking-widest">{currentTrack.bpm} BPM</span>
<span className="text-[10px] font-black uppercase tracking-widest">{currentTrack.key_signature}</span>
</div>
</div>
<button onClick={() => setShowLyrics(false)} className="w-16 h-16 rounded-full bg-white/5 hover:bg-red-500/20 hover:text-red-500 flex items-center justify-center transition-all border border-white/5">
<BaseIcon path={mdiPlus} className="rotate-45" size={36} />
</button>
</div>
<div className="space-y-16 pb-20">
{currentTrack.ai_data?.lyrics ? Object.entries(currentTrack.ai_data.lyrics).map(([section, text]: [any, any]) => (
<div key={section} className="group">
<h4 className="text-[10px] font-black text-[#00E5FF] uppercase mb-8 tracking-[0.6em] flex items-center opacity-40 group-hover:opacity-100 transition-opacity">
<div className="w-3 h-3 rounded-full bg-[#00E5FF] mr-4 shadow-[0_0_10px_#00E5FF]" />
{section.replace('_', ' ').toUpperCase()}
</h4>
<p className={`leading-[1.8] whitespace-pre-wrap ${section.includes('chorus') ? 'text-2xl font-black text-white italic pl-8 border-l-4 border-white/10' : 'text-lg text-gray-400 font-bold pl-8'}`}>
{text}
</p>
</div>
)) : (
<div className="text-center py-40">
<BaseIcon path={mdiMusic} size={64} className="text-gray-800 mx-auto mb-8" />
<p className="text-gray-600 text-sm uppercase font-black italic tracking-widest">A transcrição está sendo processada...</p>
</div>
)}
</div>
{/* Musical Analysis Section */}
{currentTrack.ai_data?.mood && (
<div className="mt-10 p-10 bg-white/5 rounded-3xl border border-white/5">
<h3 className="text-[10px] font-black text-[#7000FF] uppercase tracking-[0.5em] mb-6">ANÁLISE DO PRODUTOR (IA)</h3>
<div className="space-y-6">
<div>
<span className="text-[9px] font-black text-gray-500 uppercase block mb-2 tracking-widest">Mood & Atmosfera</span>
<p className="text-sm text-gray-300 font-bold">{currentTrack.ai_data.mood}</p>
</div>
<div>
<span className="text-[9px] font-black text-gray-500 uppercase block mb-2 tracking-widest">Instrumentação</span>
<p className="text-xs text-gray-400 leading-relaxed italic">
{Array.isArray(currentTrack.ai_data.instruments) ? currentTrack.ai_data.instruments.join(', ') : currentTrack.ai_data.instruments}
</p>
</div>
</div>
</div>
)}
</aside>
<div className="w-[300px] flex justify-end items-center gap-4">
<div className="flex items-center gap-2">
<BaseIcon path={volume === 0 ? mdiVolumeMute : volume < 0.5 ? mdiVolumeMedium : mdiVolumeHigh} size={20} className="text-gray-500" />
<input
type="range"
min="0"
max="1"
step="0.01"
value={volume}
onChange={(e) => {
const val = parseFloat(e.target.value);
setVolume(val);
if (audioRef.current) audioRef.current.volume = val;
}}
className="w-24 h-1 bg-white/10 rounded-full appearance-none cursor-pointer accent-[#00E5FF]"
/>
</div>
<button className="p-2 hover:bg-white/5 rounded-full text-gray-500 hover:text-white">
<BaseIcon path={mdiDotsVertical} size={20} />
</button>
</div>
<audio ref={audioRef} onTimeUpdate={handleTimeUpdate} className="hidden" />
</div>
)}
{/* Global Player Interface */}
{currentTrack && (
<div className="fixed bottom-0 left-0 w-full h-[120px] bg-[#0A0A0A]/95 backdrop-blur-3xl border-t border-white/5 flex items-center px-16 z-[200] shadow-[0_-40px_100px_rgba(0,0,0,0.9)]">
<div className="w-1/4 flex items-center space-x-8">
<div className="w-20 h-20 bg-[#151515] rounded-[2rem] shrink-0 overflow-hidden relative group border border-white/10 shadow-2xl">
<div className="absolute inset-0 bg-gradient-to-br from-[#00E5FF]/30 to-[#7000FF]/30 animate-pulse" />
<div className="w-full h-full flex items-center justify-center relative">
<BaseIcon path={mdiMusic} className="text-white" size={32} />
</div>
</div>
<div className="min-w-0">
<h4 className="text-white font-black text-xl uppercase italic truncate tracking-tighter mb-2">{currentTrack.title}</h4>
<div className="flex items-center space-x-4">
<span className="text-[9px] font-black text-[#00E5FF] uppercase tracking-[0.2em] px-3 py-1 bg-[#00E5FF]/10 rounded-full border border-[#00E5FF]/30">
MASTER V4.0
</span>
<p className="text-gray-500 text-[9px] font-black uppercase tracking-[0.4em] truncate">AI SINGER PRO</p>
</div>
</div>
</div>
<div className="flex-1 flex flex-col items-center space-y-5 px-32">
<div className="flex items-center space-x-16">
<button className="text-gray-700 hover:text-white transition-all transform hover:scale-150">
<BaseIcon path={mdiRefresh} size={24} />
</button>
<button
onClick={togglePlayback}
className="w-20 h-20 rounded-full bg-white flex items-center justify-center text-black hover:scale-110 active:scale-90 transition-all shadow-[0_0_60px_rgba(255,255,255,0.4)]"
>
<BaseIcon path={isPlaying ? mdiPause : mdiPlay} size={48} />
</button>
<button
onClick={() => setShowLyrics(!showLyrics)}
className={`transition-all transform hover:scale-150 ${showLyrics ? 'text-[#00E5FF]' : 'text-gray-700 hover:text-white'}`}
>
<BaseIcon path={mdiPlaylistMusic} size={30} />
</button>
</div>
<div className="w-full flex items-center space-x-6">
<span className="text-[10px] font-black text-gray-500 w-16 text-right font-mono tracking-tighter">{formatTime(currentTime)}</span>
<div className="flex-1 relative group h-10 flex items-center">
<input
type="range"
min="0"
max="100"
value={progress}
onChange={handleProgressChange}
className="absolute w-full h-1.5 bg-white/5 rounded-full appearance-none cursor-pointer accent-[#00E5FF] group-hover:h-2 transition-all z-10"
/>
<div className="absolute top-1/2 -translate-y-1/2 left-0 h-1.5 bg-gradient-to-r from-[#00E5FF] to-[#7000FF] rounded-full group-hover:h-2 transition-all pointer-events-none shadow-[0_0_20px_rgba(0,229,255,0.5)]" style={{ width: `${progress}%` }} />
</div>
<span className="text-[10px] font-black text-gray-500 w-16 font-mono tracking-tighter">{formatTime(duration)}</span>
</div>
</div>
<div className="w-1/4 flex items-center justify-end space-x-10">
<div className="flex items-center space-x-5 group">
<BaseIcon path={mdiVolumeHigh} size={24} className="text-gray-600 group-hover:text-white transition-colors" />
<div className="w-32 h-1.5 bg-white/5 rounded-full overflow-hidden relative cursor-pointer">
<div className="absolute inset-0 bg-[#00E5FF]/60 w-3/4" />
</div>
</div>
<div className="flex items-center space-x-4">
<button
onClick={() => handleDownload()}
className="w-14 h-14 rounded-2xl bg-white/5 hover:bg-[#00E5FF] hover:text-black text-gray-400 transition-all shadow-2xl flex items-center justify-center border border-white/5"
title="Exportar Hit"
>
<BaseIcon path={mdiDownload} size={26} />
</button>
<button className="w-14 h-14 rounded-2xl bg-white/5 hover:bg-white/10 text-gray-400 hover:text-white transition-all flex items-center justify-center border border-white/5">
<BaseIcon path={mdiShare} size={26} />
</button>
</div>
</div>
<audio
ref={audioRef}
onTimeUpdate={handleTimeUpdate}
onLoadedMetadata={handleLoadedMetadata}
onEnded={() => setIsPlaying(false)}
className="hidden"
/>
</div>
)}
<ToastContainer
theme="dark"
position="bottom-right"
autoClose={4000}
closeOnClick
pauseOnHover
toastClassName="bg-[#0A0A0A] border border-white/10 rounded-2xl font-black italic tracking-widest text-[10px] uppercase shadow-2xl"
/>
<style jsx global>{`
@keyframes fade-in {
from { opacity: 0; transform: translateY(30px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes slide-in-right {
from { transform: translateX(100%); }
to { transform: translateX(0); }
}
@keyframes music-bar {
0% { height: 20%; }
50% { height: 100%; }
100% { height: 20%; }
}
.animate-fade-in {
animation: fade-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.animate-slide-in-right {
animation: slide-in-right 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-music-bar {
animation: music-bar 1s ease-in-out infinite;
}
input[type="range"]::-webkit-slider-thumb {
appearance: none;
width: 20px;
height: 20px;
background: white;
border-radius: 50%;
cursor: pointer;
border: 4px solid #00E5FF;
box-shadow: 0 0 25px rgba(0, 229, 255, 0.8);
transition: transform 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover {
transform: scale(1.4);
}
.aside-scrollbars::-webkit-scrollbar {
width: 5px;
width: 4px;
}
.aside-scrollbars::-webkit-scrollbar-track {
background: transparent;
}
.aside-scrollbars::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.05);
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
}
.aside-scrollbars::-webkit-scrollbar-thumb:hover {
background: rgba(0, 229, 255, 0.3);
background: rgba(255, 255, 255, 0.2);
}
input[type='range']::-webkit-slider-thumb {
appearance: none;
width: 12px;
height: 12px;
background: #00E5FF;
border-radius: 50%;
cursor: pointer;
}
`}</style>
</div>
@ -706,7 +450,7 @@ const SunoStudio = () => {
};
SunoStudio.getLayout = function getLayout(page: ReactElement) {
return page;
return <LayoutAuthenticated>{page}</LayoutAuthenticated>;
};
export default SunoStudio;