import { createRoot } from 'react-dom/client';
import { HashRouter } from 'react-router-dom';
import SettingsApp from './Admin/App/SettingsApp';
import { SettingsProvider } from './Admin/App/SettingsContext';
import NoWooCommerceComponent from './Admin/components/NoWooCommerceComponent';
import './styles/admin.css';
import './scss/_notice.scss';


document.addEventListener(
	'DOMContentLoaded', function () {
		const rootElementSettings = document.getElementById('echo-rewards-settings-dashboard');

		if (rootElementSettings) {
			const reportsRoot = createRoot(rootElementSettings);
			reportsRoot.render( <SettingsProvider><SettingsApp /></SettingsProvider>);
		}

		// Check for no WooCommerce element
		const noWooCommerceElement = document.getElementById('ecre_no_woocommerce');
		if (noWooCommerceElement) {
		  const noWooCommerceRoot = createRoot(noWooCommerceElement);
		  noWooCommerceRoot.render(<NoWooCommerceComponent />);
		}
	
	} 
);

