refactor: remove coexistence mode, use React only
Remove all dual-mode rendering logic since React is now the single admin interface. Focus on implementing full table features in React. Changes: - Remove ?react= query param checks from all page methods - Remove admin notice and footer toggle from ReactAdmin - Simplify asset loading - ReactAdmin handles all assets - Clean up Init.php enqueue method Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -12,8 +12,6 @@ class ReactAdmin {
|
||||
|
||||
add_action( 'admin_enqueue_scripts', [$this, 'enqueue_assets'] );
|
||||
add_filter( 'formipay/admin/data', [$this, 'localize_data'] );
|
||||
add_action( 'admin_notices', [$this, 'version_notice'] );
|
||||
add_filter( 'admin_footer_text', [$this, 'footer_toggle'] );
|
||||
|
||||
}
|
||||
|
||||
@@ -26,12 +24,6 @@ class ReactAdmin {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check coexistence mode - only load React when ?react=1 or option is set
|
||||
$use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false);
|
||||
if ( ! $use_react ) {
|
||||
return; // Classic mode - don't load React assets
|
||||
}
|
||||
|
||||
// Enqueue React build assets
|
||||
$build_dir = FORMIPAY_PATH . 'build';
|
||||
$build_url = FORMIPAY_URL . 'build';
|
||||
@@ -164,58 +156,4 @@ class ReactAdmin {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show admin notice about current admin version
|
||||
*/
|
||||
public function version_notice() {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
// Only show on Formipay admin pages
|
||||
if ( strpos( $screen->id, 'formipay' ) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false);
|
||||
$version = $use_react ? 'React (Beta)' : 'Classic';
|
||||
|
||||
printf(
|
||||
'<div class="notice notice-info inline">
|
||||
<p>
|
||||
<strong>Formipay Admin:</strong> Using %s version.
|
||||
<a href="%s" class="button button-small" style="margin-left: 10px;">Switch to %s</a>
|
||||
</p>
|
||||
</div>',
|
||||
esc_html( $version ),
|
||||
esc_url( add_query_arg( 'react', $use_react ? '0' : '1' ) ),
|
||||
esc_html( $use_react ? 'Classic' : 'React (Beta)' )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add toggle link to admin footer
|
||||
*/
|
||||
public function footer_toggle( $text ) {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
// Only add toggle on Formipay admin pages
|
||||
if ( strpos( $screen->id, 'formipay' ) === false ) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
$use_react = isset($_GET['react']) || get_option('formipay_use_react_admin', false);
|
||||
$toggle_url = add_query_arg( 'react', $use_react ? '0' : '1' );
|
||||
$toggle_text = $use_react ? 'Switch to Classic' : 'Try React (Beta)';
|
||||
|
||||
return sprintf(
|
||||
'%s | <a href="%s">%s</a>',
|
||||
$text,
|
||||
esc_url( $toggle_url ),
|
||||
esc_html( $toggle_text )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user