一键导入
react-page
Create a new React admin page for the Saman SEO plugin dashboard. Use when adding new settings pages, tool interfaces, or admin features that need a UI.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a new React admin page for the Saman SEO plugin dashboard. Use when adding new settings pages, tool interfaces, or admin features that need a UI.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add a new WordPress filter hook to the Saman SEO plugin with proper documentation. Use when making functionality extensible, allowing third-party customization, or adding developer hooks.
Add a new SEO audit metric to the scoring system. Use when extending the SEO analysis, adding new quality checks, or improving the audit dashboard.
Add a new schema.org structured data type to the Saman SEO plugin. Use when adding support for new schema types like Recipe, Event, Product, etc.
Review code changes in the Saman SEO plugin for quality, security, and adherence to WordPress coding standards. Use when reviewing PRs, checking code quality, or before committing changes.
Generate a pull request title and description from the current branch's commits. Produces a concise summary, optional feature highlights, and collapsible technical details.
Generate a new SEO service class following the Saman SEO plugin architecture. Use when creating new features that need a dedicated service, adding functionality to the plugin, or extending plugin capabilities.
| name | react-page |
| description | Create a new React admin page for the Saman SEO plugin dashboard. Use when adding new settings pages, tool interfaces, or admin features that need a UI. |
Generate a new React page component for the Saman SEO admin interface.
$ARGUMENTS should contain: page name (e.g., "KeywordPlanner") and descriptionAnalyze the request to determine:
Create the React page at src-v2/pages/{PageName}.js
Follow this template:
/**
* {PageName} page component.
*
* {Description}
*
* @package Saman SEO
*/
import { useState, useEffect, useCallback } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import apiFetch from '@wordpress/api-fetch';
import Header from '../components/Header';
/**
* {PageName} component.
*
* @return {JSX.Element} The rendered component.
*/
const {PageName} = () => {
// State
const [isLoading, setIsLoading] = useState(true);
const [isSaving, setIsSaving] = useState(false);
const [data, setData] = useState(null);
const [error, setError] = useState(null);
// Fetch data on mount
useEffect(() => {
fetchData();
}, []);
/**
* Fetch data from API.
*/
const fetchData = useCallback(async () => {
setIsLoading(true);
setError(null);
try {
const response = await apiFetch({
path: '/saman-seo/v1/{endpoint}',
});
setData(response);
} catch (err) {
setError(err.message || __('Failed to load data.', 'saman-seo'));
console.error('Error fetching data:', err);
} finally {
setIsLoading(false);
}
}, []);
/**
* Save data to API.
*/
const handleSave = useCallback(async () => {
setIsSaving(true);
setError(null);
try {
await apiFetch({
path: '/saman-seo/v1/{endpoint}',
method: 'POST',
data: data,
});
// Show success notice
} catch (err) {
setError(err.message || __('Failed to save.', 'saman-seo'));
console.error('Error saving:', err);
} finally {
setIsSaving(false);
}
}, [data]);
// Loading state
if (isLoading) {
return (
<div className="samanseo-admin-page">
<Header
title={__('{Page Title}', 'saman-seo')}
description={__('{Page description}', 'saman-seo')}
/>
<div className="samanseo-loading">
<span className="spinner is-active"></span>
{__('Loading...', 'saman-seo')}
</div>
</div>
);
}
// Error state
if (error) {
return (
<div className="samanseo-admin-page">
<Header
title={__('{Page Title}', 'saman-seo')}
description={__('{Page description}', 'saman-seo')}
/>
<div className="notice notice-error">
<p>{error}</p>
</div>
</div>
);
}
return (
<div className="samanseo-admin-page">
<Header
title={__('{Page Title}', 'saman-seo')}
description={__('{Page description}', 'saman-seo')}
/>
<div className="samanseo-content">
{/* Page content here */}
</div>
<div className="samanseo-footer">
<button
type="button"
className="button button-primary"
onClick={handleSave}
disabled={isSaving}
>
{isSaving
? __('Saving...', 'saman-seo')
: __('Save Changes', 'saman-seo')
}
</button>
</div>
</div>
);
};
export default {PageName};
// Add lazy import at the top
const {PageName} = lazy(() => import('./pages/{PageName}'));
// Add route in the pages array
{ path: '{page-slug}', component: {PageName} },
Register the page in Admin_V2 PHP (includes/class-saman-seo-admin-v2.php):
'saman-seo-{slug}' => '{view-name}' to the $view_map property (maps WP page slug to React view name)'{slug}' => __( '{Page Title}', 'saman-seo' ) to the $hidden_subpages array inside register_menu() (registers a hidden WP submenu so direct-URL / refresh works)add_submenu_page() for the same slug — this causes a routing conflict that breaks the React SPA on refreshCreate styles if needed in src-v2/less/pages/{page-name}.less
@wordpress/element, @wordpress/i18n, @wordpress/api-fetchuseState, useEffect, useCallback)apiFetch() for REST API calls__() or _n() for translationsamanseo- prefixHeader - Page header with title and descriptionSearchPreview - SERP preview componentTemplateInput - Input with template variable supportVariablePicker - Template variable selectorAiGenerateModal - AI content generation modal/react-page KeywordPlanner Plan and manage target keywords for content