import { useState } from 'react';
import type { ScatDetail } from './scatTypes';
import { sensColor, statusColor } from './scatConstants';
interface ScatRightPanelProps {
detail: ScatDetail | null;
loading: boolean;
onOpenReport?: () => void;
onNewSurvey?: () => void;
}
const tabs = [
{ id: 0, label: '๊ตฌ๊ฐ ์์ธ', icon: '๐' },
{ id: 1, label: 'ํ์ฅ ์ฌ์ง', icon: '๐ท' },
{ id: 2, label: '๋ฐฉ์ ๊ถ๊ณ ', icon: '๐ก๏ธ' },
] as const;
export default function ScatRightPanel({ detail, loading, onOpenReport, onNewSurvey }: ScatRightPanelProps) {
const [activeTab, setActiveTab] = useState(0);
if (!detail && !loading) {
return (
๐๏ธ
์ข์ธก ๋ชฉ๋ก์์ ๊ตฌ๊ฐ์
์ ํํ๋ฉด ์์ธ ์ ๋ณด๊ฐ
์ฌ๊ธฐ์ ํ์๋ฉ๋๋ค.
);
}
return (
{/* ํค๋ */}
{detail ? (
{detail.esi}
{detail.name}
{detail.code}
) : (
๋ก๋ฉ ์ค...
)}
{/* ํญ ๋ฐ */}
{tabs.map(tab => (
))}
{/* ์คํฌ๋กค ์์ญ */}
{loading ? (
๋ฐ์ดํฐ ๋ก๋ฉ ์ค...
) : detail ? (
<>
{activeTab === 0 &&
}
{activeTab === 1 &&
}
{activeTab === 2 &&
}
>
) : null}
{/* ํ๋จ ๋ฒํผ */}
);
}
/* โโโ ํญ 0: ๊ตฌ๊ฐ ์์ธ โโโ */
function DetailTab({ detail }: { detail: ScatDetail }) {
return (
{/* ๊ธฐ๋ณธ ์ ๋ณด */}
{/* ์ ๊ทผ์ฑ */}
{/* ๋ฏผ๊ฐ ์์ */}
{detail.sensitive && detail.sensitive.length > 0 && (
{detail.sensitive.map((s, i) => (
{s.t}
{s.v}
))}
)}
);
}
/* โโโ ํญ 1: ํ์ฅ ์ฌ์ง โโโ */
function PhotoTab() {
return (
๐ท
ํ์ฅ ์ฌ์ง ๊ธฐ๋ฅ์
์ถํ ์
๋ฐ์ดํธ ์์ ์
๋๋ค.
์ฌ์ง ์
๋ก๋ API ์ฐ๋ ์์
);
}
/* โโโ ํญ 2: ๋ฐฉ์ ๊ถ๊ณ โโโ */
function CleanupTab({ detail }: { detail: ScatDetail }) {
return (
{/* ๋ฐฉ์ ๋ฐฉ๋ฒ */}
{detail.cleanup && detail.cleanup.length > 0 ? (
{detail.cleanup.map((method, i) => (
{method}
))}
) : (
๋ฑ๋ก๋ ๋ฐฉ์ ๋ฐฉ๋ฒ ์์
)}
{/* ์ข
๋ฃ ๊ธฐ์ค */}
{detail.endCriteria && detail.endCriteria.length > 0 ? (
{detail.endCriteria.map((c, i) => (
โ
{c}
))}
) : (
๋ฑ๋ก๋ ์ข
๋ฃ ๊ธฐ์ค ์์
)}
{/* ์ฐธ๊ณ ์ฌํญ */}
{detail.notes && detail.notes.length > 0 ? (
{detail.notes.map((note, i) => (
{note}
))}
) : (
๋ฑ๋ก๋ ์ฐธ๊ณ ์ฌํญ ์์
)}
);
}
/* โโโ ๊ณตํต UI โโโ */
function Section({ title, children }: { title: string; children: React.ReactNode }) {
return (
);
}
function InfoRow({ label, value, valueColor }: { label: string; value: string; valueColor?: string }) {
return (
{label}
{value}
);
}