File size: 1,610 Bytes
cc7330c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
47
48
'use client';

import { usePathname } from 'next/navigation';
import { Header, SurveyHeader, LoadingOverlay, ErrorMessage } from '../components/layout/Common';
import { useDiagnosis } from './contexts/DiagnosisContext';

export default function LayoutContent({ children }: { children: React.ReactNode }) {
  const pathname = usePathname();
  const { currentIndex, surveyItems, loading, error, setError } = useDiagnosis();

  const isSurvey = pathname === '/survey';
  const isResult = pathname === '/result';

  return (
    <div className="min-h-screen flex flex-col bg-slate-50 font-sans text-slate-900 selection:bg-cyan-100 selection:text-cyan-900">
      {loading && <LoadingOverlay />}
      
      {isSurvey ? (
        <SurveyHeader current={currentIndex + 1} total={surveyItems.length || 10} />
      ) : isResult ? null : (
        <Header />
      )}

      <main className="relative flex-grow bg-slate-50 px-3 sm:px-4 py-6 sm:py-8">
        {error ? (
          <div className="max-w-xl mx-auto mt-20">
            <ErrorMessage 
              message={error} 
              onRetry={() => {
                setError(null);
                window.location.reload();
              }} 
            />
          </div>
        ) : (
          children
        )}
      </main>

      <footer className="min-h-20 border-t border-slate-100 bg-white flex items-center justify-center shrink-0 px-4 py-4">
        <p className="text-center text-xs sm:text-sm font-medium text-slate-500">
          © 2026 시앤피컨설팅 주식회사. All rights reserved.
        </p>
      </footer>
    </div>
  );
}