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 / common / Header.js

Header.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/common/Header.js

99 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Header Component
3 *
4 * Compact header for admin pages with page title integration
5 *
6 * @package ThinkRank
7 * @since 1.0.0
8 */
9
10 import { __ } from '@wordpress/i18n';
11 import { useSelect } from '@wordpress/data';
12
13 /**
14 * ThinkRank Icon Component
15 * Same icon used in WordPress admin menu
16 */
17 const ThinkRankIcon = ({ className = '', size = 22 }) => (
18 <svg
19 className={className}
20 xmlns="http://www.w3.org/2000/svg"
21 width={size}
22 height={size}
23 viewBox="0 0 24 24"
24 fill="none"
25 stroke="currentColor"
26 strokeWidth="2"
27 strokeLinecap="round"
28 strokeLinejoin="round"
29 >
30 <path d="m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72"/>
31 <path d="m14 7 3 3"/>
32 <path d="M5 6v4"/>
33 <path d="M19 14v4"/>
34 <path d="M10 2v2"/>
35 <path d="M7 8H3"/>
36 <path d="M21 16h-4"/>
37 <path d="M11 3H9"/>
38 </svg>
39 );
40
41 /**
42 * Header Component
43 */
44 const Header = ({ pageTitle, pageDescription, showHelp = false }) => {
45 const { credits, pluginVersion, hasApiKey } = useSelect((select) => {
46 try {
47 const coreStore = select('thinkrank/core');
48 const creditsStore = select('thinkrank/credits');
49 const settingsStore = select('thinkrank/settings');
50
51 // Safely get settings
52 const settings = settingsStore?.getSettings?.() || {};
53
54 return {
55 credits: creditsStore?.getBalance?.() || 0,
56 pluginVersion: coreStore?.getPluginVersion?.() || '1.0.0',
57 hasApiKey: Boolean(settings.openai_api_key || settings.claude_api_key),
58 };
59 } catch (error) {
60 console.warn('ThinkRank Header: Error accessing stores', error);
61 return {
62 credits: 0,
63 pluginVersion: '1.0.0',
64 hasApiKey: false,
65 };
66 }
67 }, []);
68
69 return (
70 <div className="thinkrank-header-compact">
71 <div className="header-main">
72 <div className="header-branding">
73 <div className="brand-info">
74 <h1 className="brand-name">
75 <ThinkRankIcon className="brand-icon" size={22} />
76 {__('ThinkRank', 'thinkrank')}
77 </h1>
78 </div>
79
80 {pageTitle && (
81 <div className="page-info">
82 <h2 className="page-title">{pageTitle}</h2>
83 {pageDescription && (
84 <p className="page-description">{pageDescription}</p>
85 )}
86 </div>
87 )}
88 </div>
89
90 <div className="header-actions">
91 <span className="version-info">v{pluginVersion}</span>
92 </div>
93 </div>
94 </div>
95 );
96 };
97
98 export default Header;
99