import styles from "./ExtensionWidgetPanel.module.css";

interface ExtensionWidgetPanelProps {
	widgets: Record<string, string[]>;
}

export function ExtensionWidgetPanel({ widgets }: ExtensionWidgetPanelProps) {
	const entries = Object.entries(widgets).filter(([, lines]) => lines.length > 0);
	if (entries.length === 0) return null;

	return (
		<div className={styles.panel}>
			{entries.map(([key, lines]) => (
				<div key={key} className={styles.widget}>
					<div className={styles.widgetKey}>{key}</div>
					{lines.join("\n")}
				</div>
			))}
		</div>
	);
}
