'use client';

/**
 * Pages Editor Layout
 *
 * Full-width layout for the Puck editor, bypassing the standard dashboard layout constraints.
 * Authentication is still handled by the parent dashboard layout.
 *
 * When the impersonation (Support Mode) banner is active, the layout offsets from the top
 * to prevent the banner from covering the editor's toolbar buttons.
 */

import { useSession } from 'next-auth/react';
import styles from './editor-layout.module.css';

export default function PagesEditorLayout({ children }: { children: React.ReactNode }) {
  const { data: session } = useSession();
  const isImpersonating = session?.impersonation?.isActive;

  return (
    <div
      className={`${styles.editorLayout} ${isImpersonating ? styles.editorLayoutWithBanner : ''}`}
    >
      {children}
    </div>
  );
}
