import { useRouter } from 'next/router';
import Layout from '../components/Layout';
import AdminLayout from '../components/AdminLayout';
import CookieBanner from '../components/CookieBanner';
import '../styles/globals.css';

function MyApp({ Component, pageProps }) {
  const router = useRouter();
  
  // Prüfen ob es sich um eine Admin-Seite handelt
  const isAdminPage = router.pathname.startsWith('/admin');
  
  if (isAdminPage) {
    return (
      <AdminLayout>
        <Component {...pageProps} />
      </AdminLayout>
    );
  }
  
  return (
    <Layout>
      <Component {...pageProps} />
      <CookieBanner />
    </Layout>
  );
}

export default MyApp;
