/**
 * WordPress dependencies
 */
import domReady from '@safe-wordpress/dom-ready';
import { render } from '@safe-wordpress/element';
import * as icons from '@safe-wordpress/icons';

/**
 * WordPress dependencies
 */
import './style.scss';

const {
	Icon: _,
	// Deprecated aliases
	warning: __,
	...availableIcons
} = icons;

domReady( () => {
	[
		...document.querySelectorAll(
			'#nelio-content-dashboard-overview .nelio-content-post__status-icon'
		),
	].forEach( ( el ) => {
		const iconName = el.getAttribute( 'data-icon' ) ?? '';
		const icon = availableIcons[ iconName as keyof typeof availableIcons ];
		if ( ! icon ) {
			return;
		}
		render( <>{ icon }</>, el );
	} );
} );
