HEX
Server: LiteSpeed
System: Linux server902.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: deshuvsd (2181)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/deshuvsd/www/wp-content/plugins/surerank/src/apps/seo-popup/components/settings-root.js
import { useSelect } from '@wordpress/data';
import { STORE_NAME } from '@/store/constants';
import { TABS } from '@SeoPopup/modal/tabs';
import { useMemo } from '@wordpress/element';
import { isPageBuilderActive } from '@SeoPopup/components/page-seo-checks/analyzer/utils/page-builder';

// Tabs related logic will be handled through this component.
const SettingsRoot = () => {
	const { currentTab } = useSelect(
		( select ) => select( STORE_NAME ).getAppSettings(),
		[]
	);

	const RenderTab = useMemo( () => {
		const tab = TABS[ currentTab ?? 'optimize' ];
		const isPageBuilder = isPageBuilderActive();

		if ( isPageBuilder ) {
			return tab?.pageBuilderComponent || tab?.component;
		}

		return tab?.component;
	}, [ currentTab ] );

	return <RenderTab />;
};

export default SettingsRoot;