feat(admin): Einstellungsseite überarbeitet, auch für das Handy
Verbindung: Probleme vor der Anleitung. Tools: Suche, Filter, Alle ein-/ausklappen, Zurücksetzen je Gruppe. Divi-Reiter in Klartext mit Statussymbolen. Rollenhinweise, Hilfe-Tab, Reiter als Raster und Karten auf dem Handy, Kontrast, Tippflächen, einheitliche Du-Anrede. Bestätigungen über data-lit-mcp-confirm statt Inline-onclick. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
165e61d7fe
commit
96fa58188b
@@ -44,6 +44,7 @@ final class SettingsPage
|
||||
add_action('admin_menu', [$this, 'addMenu']);
|
||||
add_action('admin_init', [$this, 'registerSettings']);
|
||||
add_action('admin_enqueue_scripts', [$this, 'enqueueAssets']);
|
||||
add_filter('removable_query_args', [$this, 'removableQueryArgs']);
|
||||
foreach ($this->tabs() as $tab) {
|
||||
$tab->registerActions();
|
||||
}
|
||||
@@ -51,13 +52,72 @@ final class SettingsPage
|
||||
|
||||
public function addMenu(): void
|
||||
{
|
||||
add_options_page(
|
||||
$hook = add_options_page(
|
||||
__('LIT MCP', 'wp-lit-mcp'),
|
||||
__('LIT MCP', 'wp-lit-mcp'),
|
||||
'manage_options',
|
||||
self::SLUG,
|
||||
[$this, 'render']
|
||||
);
|
||||
if (is_string($hook)) {
|
||||
add_action('load-' . $hook, [$this, 'addHelpTab']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WordPress removes these from the address bar after the page loaded, so a reload or a copied link
|
||||
* does not show a finished action's notice again.
|
||||
*
|
||||
* @param array<int, string> $args
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function removableQueryArgs(array $args): array
|
||||
{
|
||||
$args[] = 'lit_mcp_notice';
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/** Short "Hilfe" panel at the top right; the tabs explain themselves, this only says where to start. */
|
||||
public function addHelpTab(): void
|
||||
{
|
||||
$screen = get_current_screen();
|
||||
if ($screen !== null) {
|
||||
$this->helpTabFor($screen);
|
||||
}
|
||||
}
|
||||
|
||||
/** @param object $screen A WP_Screen. */
|
||||
public function helpTabFor(object $screen): void
|
||||
{
|
||||
$items = [
|
||||
__('Verbinden', 'wp-lit-mcp') => __(
|
||||
'Tab „Verbindung“: Server-URL kopieren und im KI-Assistenten als MCP-Server hinzufügen.',
|
||||
'wp-lit-mcp'
|
||||
),
|
||||
__('Wer darf?', 'wp-lit-mcp') => __(
|
||||
'Tab „Zugriff“: Rollen festlegen und bestehende Verbindungen widerrufen.',
|
||||
'wp-lit-mcp'
|
||||
),
|
||||
__('Was darf der Assistent?', 'wp-lit-mcp') => __(
|
||||
'Tab „Tools“: jedes Tool direkt, indirekt oder aus; ganze Gruppen auf „nur lesen“ stellen.',
|
||||
'wp-lit-mcp'
|
||||
),
|
||||
__('Was ist passiert?', 'wp-lit-mcp') => __(
|
||||
'Tab „Protokoll“: jede Änderung des Assistenten mit Benutzer, Ergebnis und Zeitpunkt.',
|
||||
'wp-lit-mcp'
|
||||
),
|
||||
];
|
||||
$content = '';
|
||||
foreach ($items as $title => $text) {
|
||||
$content .= sprintf('<p><strong>%s</strong> %s</p>', esc_html($title), esc_html($text));
|
||||
}
|
||||
|
||||
$screen->add_help_tab([
|
||||
'id' => 'lit-mcp-overview',
|
||||
'title' => __('Überblick', 'wp-lit-mcp'),
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
|
||||
public function registerSettings(): void
|
||||
@@ -87,6 +147,10 @@ final class SettingsPage
|
||||
wp_enqueue_script('lit-mcp-admin', $base . '/js/admin.js', $deps, $this->version, true);
|
||||
wp_localize_script('lit-mcp-admin', 'litMcpAdmin', [
|
||||
'copied' => __('Die URL wurde in die Zwischenablage kopiert.', 'wp-lit-mcp'),
|
||||
/* translators: %d: number of tools matching the filter */
|
||||
'toolsShown' => __('%d Tools angezeigt', 'wp-lit-mcp'),
|
||||
'toolShown' => __('1 Tool angezeigt', 'wp-lit-mcp'),
|
||||
'groupReset' => __('Gruppe auf Standard zurückgesetzt. Noch nicht gespeichert.', 'wp-lit-mcp'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -200,7 +264,7 @@ final class SettingsPage
|
||||
],
|
||||
'divi_withdrawn' => [
|
||||
'success',
|
||||
__('Freigabe zurückgezogen; schreibende Divi-Werkzeuge sind wieder gesperrt.', 'wp-lit-mcp'),
|
||||
__('Freigabe zurückgezogen; schreibende Divi-Tools sind wieder gesperrt.', 'wp-lit-mcp'),
|
||||
],
|
||||
'divi_withdraw_failed' => [
|
||||
'error',
|
||||
|
||||
Reference in New Issue
Block a user