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 / components / pages / EssentialSEO.js

EssentialSEO.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/components/pages/EssentialSEO.js

107 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Essential SEO Page Component
3 *
4 * Single page with tabbed interface for all SEO settings
5 *
6 * @package ThinkRank
7 * @since 1.0.0
8 */
9
10 import { useState, useEffect } from '@wordpress/element';
11 import { __ } from '@wordpress/i18n';
12 import { Spinner, Notice } from '@wordpress/components';
13
14 // New sidebar navigation components
15 import SidebarNavigation from '../essential-seo/SidebarNavigation';
16 import ContentArea from '../essential-seo/ContentArea';
17
18 /**
19 * Essential SEO Component
20 */
21 const EssentialSEO = () => {
22 const [isLoading, setIsLoading] = useState(true);
23 const [hasError, setHasError] = useState(false);
24 const [errorMessage, setErrorMessage] = useState('');
25
26 // Navigation state
27 const [activeSection, setActiveSection] = useState('site-identity');
28 const [activeItem, setActiveItem] = useState('basic-info');
29
30 // Initialize component
31 useEffect(() => {
32 const initializeEssentialSEO = async () => {
33 try {
34 setIsLoading(false);
35 } catch (error) {
36 setHasError(true);
37 setErrorMessage(error.message);
38 setIsLoading(false);
39 }
40 };
41
42 initializeEssentialSEO();
43 }, []);
44
45 // Navigation handlers
46 const handleNavigate = (sectionId, itemId) => {
47 setActiveSection(sectionId);
48 setActiveItem(itemId);
49 };
50
51
52
53 // Render loading state
54 if (isLoading) {
55 return (
56 <div className="thinkrank-loading">
57 <Spinner />
58 <p>{__('Loading Essential SEO settings...', 'thinkrank')}</p>
59 </div>
60 );
61 }
62
63 // Render error state
64 if (hasError) {
65 return (
66 <div className="thinkrank-error">
67 <Notice status="error" isDismissible={false}>
68 <strong>{__('Essential SEO Error:', 'thinkrank')}</strong>
69 <br />
70 {errorMessage}
71 </Notice>
72 </div>
73 );
74 }
75
76 return (
77 <div className="thinkrank-essential-seo">
78 <div className="thinkrank-essential-seo-header thinkrank-mb-2xl">
79 <h1>{__('Essential SEO', 'thinkrank')}</h1>
80 <p className="description">
81 {__('Configure your site-wide SEO settings with AI-powered optimization', 'thinkrank')}
82 </p>
83 </div>
84
85 <div style={{ display: 'flex', gap: '20px' }}>
86 <div style={{ width: '300px', flexShrink: 0 }}>
87 <SidebarNavigation
88 activeSection={activeSection}
89 activeItem={activeItem}
90 onNavigate={handleNavigate}
91 />
92 </div>
93
94 <div style={{ flex: 1 }}>
95 <ContentArea
96 activeSection={activeSection}
97 activeItem={activeItem}
98 onNavigate={handleNavigate}
99 />
100 </div>
101 </div>
102 </div>
103 );
104 };
105
106 export default EssentialSEO;
107