/**
 * Production Presentation Page
 * URL: /p/[projectSlug] (e.g., /p/cardiff)
 */

import { ReactElement } from 'react';
import { useRouter } from 'next/router';
import RuntimePresentation from '../../../components/RuntimePresentation';
import LayoutGuest from '../../../layouts/Guest';

export default function ProductionPresentation() {
  const router = useRouter();
  const { projectSlug } = router.query;

  if (!projectSlug || typeof projectSlug !== 'string') {
    return (
      <div className='flex items-center justify-center min-h-screen bg-gray-900'>
        <div className='text-white'>Loading...</div>
      </div>
    );
  }

  return (
    <RuntimePresentation projectSlug={projectSlug} environment='production' />
  );
}

ProductionPresentation.getLayout = function getLayout(page: ReactElement) {
  return <LayoutGuest>{page}</LayoutGuest>;
};
