'; echo esc_html__( 'Tessera admin bundle not built. Run `npm install && npm run build` from the plugin directory.', 'abilityguard-mcp' ); echo '

'; } /** * Render the admin page shell. The React app takes it from here. */ public static function render_page(): void { if ( ! current_user_can( self::CAPABILITY ) ) { wp_die( esc_html__( 'You do not have permission to view this page.', 'abilityguard-mcp' ) ); } echo '
'; } /** * Build the initial JSON payload the React app reads on boot. * * @return array */ private static function build_boot_payload(): array { $repo = new LogRepository(); $rows = $repo->list( array( 'per_page' => 200 ) ); $enriched = array_map( static function ( array $row ): array { $user_display = ''; if ( ! empty( $row['user_id'] ) ) { $user = get_userdata( (int) $row['user_id'] ); if ( $user ) { $user_display = '' !== $user->display_name ? $user->display_name : $user->user_login; } } $row['user_display_name'] = $user_display; return $row; }, $rows ); return array( 'rows' => $enriched, 'rest' => array( 'url' => esc_url_raw( rest_url( 'abilityguard/v1/' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), ), ); } }