import React from 'react'; import type { WidgetSlot as WidgetSlotModel } from '../../types/widgetDashboard'; import type { WidgetZoneId } from '../../types/widgetDashboard'; import { getWidgetDefinition, widgetLabel } from '../../widgets/widgetRegistry'; interface Props { slot: WidgetSlotModel; zoneId: WidgetZoneId; onPickWidget: (slotId: string) => void; onClearWidget?: (slotId: string) => void; } const WidgetSlotView: React.FC = ({ slot, zoneId, onPickWidget, onClearWidget, }) => { const def = getWidgetDefinition(slot.widgetType); const category = zoneId === 'center' ? 'center' : 'side'; const Host = def?.Host; const filledEmbed = Boolean(Host); return (
{!filledEmbed && (
{widgetLabel(slot.widgetType)}
{slot.widgetType && onClearWidget && ( )}
)}
{Host ? ( ) : (

{category === 'center' ? '메인 위젯을 추가하세요' : '패널 위젯을 추가하세요'}

)} {Host && ( <> {filledEmbed && onClearWidget && ( )} )}
); }; export default WidgetSlotView;