PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 1.0.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v1.0.0
2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.10.0 All 48 releases
thinkrank / src / admin / index.js

index.js in ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO 1.0.0, at src/admin/index.js

62 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Admin Dashboard Entry Point
3 *
4 * Main entry point for React admin interface
5 *
6 * @package ThinkRank
7 * @since 1.0.0
8 */
9
10 import { createRoot } from '@wordpress/element';
11 import { __ } from '@wordpress/i18n';
12 import './stores';
13 import './styles/admin.scss';
14 import './styles/sitemap.xsl';
15 import './styles/sitemap-index.xsl';
16 import App from './components/App';
17
18 /**
19 * Initialize admin interface
20 */
21 document.addEventListener('DOMContentLoaded', () => {
22 // Find admin containers
23 const containers = {
24 dashboard: document.getElementById('thinkrank-dashboard'),
25 'essential-seo': document.getElementById('thinkrank-essential-seo'),
26 'ai-tools': document.getElementById('thinkrank-ai-tools'),
27 settings: document.getElementById('thinkrank-settings'),
28 credits: document.getElementById('thinkrank-credits'),
29 analytics: document.getElementById('thinkrank-analytics'),
30 };
31
32 // Render appropriate component based on container
33 Object.entries(containers).forEach(([page, container]) => {
34 if (container) {
35 renderAdminPage(page, container);
36 }
37 });
38 });
39
40 /**
41 * Render admin page component
42 *
43 * @param {string} page Page identifier
44 * @param {Element} container DOM container
45 */
46 function renderAdminPage(page, container) {
47 try {
48 // Create root and render component using React 18 API
49 const root = createRoot(container);
50 root.render(<App page={page} />);
51 } catch (error) {
52 console.error('ThinkRank: Failed to render admin page', error);
53
54 // Fallback error display
55 container.innerHTML = `
56 <div class="notice notice-error">
57 <p>${__('Failed to load ThinkRank interface. Please refresh the page.', 'thinkrank')}</p>
58 </div>
59 `;
60 }
61 }
62