File size: 1,313 Bytes
9dd9a58 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | import React, { useState } from 'react';
import Sidebar from './Sidebar';
import CreationCenter from '../Sections/CreationCenter';
import ProjectManagement from '../Sections/ProjectManagement';
import AIModels from '../Sections/AIModels';
import Settings from '../Sections/Settings';
import AdminPanel from '../Sections/AdminPanel';
import { useAuth } from '../../hooks/useAuth';
const Layout: React.FC = () => {
const [activeSection, setActiveSection] = useState('creation');
const { user } = useAuth();
const renderSection = () => {
switch (activeSection) {
case 'creation':
return <CreationCenter />;
case 'projects':
return <ProjectManagement />;
case 'ai-models':
return <AIModels />;
case 'settings':
return <Settings />;
case 'admin':
return user?.role === 'admin' ? <AdminPanel /> : <CreationCenter />;
default:
return <CreationCenter />;
}
};
return (
<div className="flex min-h-screen bg-primary-bg">
<Sidebar
activeSection={activeSection}
onSectionChange={setActiveSection}
/>
<main className="flex-1 ml-80 p-8">
<div className="max-w-7xl mx-auto">
{renderSection()}
</div>
</main>
</div>
);
};
export default Layout; |