import { createMemo, Show } from 'solid-js'; import { Switch, Meter } from '@components'; import { useSettings, useLicense } from '@util/context'; export default function Basic() { const { settings, saveSettings } = useSettings(); const { isLocked, shakePromo } = useLicense(); /** * Handle Admin SPA toggle with full page reload. * This breaks out of iframe and reloads to apply/remove the iframe wrapper. */ const handleAdminSpaToggle = (value) => { const previousValue = settings.enable_admin_spa; settings.enable_admin_spa = value; // Only reload if value actually changed after successful save if (previousValue !== value) { saveSettings().then((result) => { if (result?.success) { setTimeout(() => { window.top.location.reload(); }, 300); } }); } }; // WordPress 7.0 navigates the dashboard itself, so the plugin's Admin SPA // is redundant there - and two navigators on one screen invite conflicts. // Below 7.0 it is the only way to get it, so it stays a selling point. const wp = window.ajaxpress_admin_vars?.wp || {}; const wpHasNativeAdminSpa = () => !!wp.has_native_admin_spa; const meterSpeed = createMemo(() => { if (settings.enable_navigation && settings.enable_prefetch) { return 100; } if (settings.enable_navigation) { return 77.5; } return 27.5; }); return (
settings.enable_navigation = v} subtitle="Smooth navigation, forms, and search. Everything without refresh." instantSave={true} tooltip={ <> Enables SPA (Single Page Application) mode for your entire frontend.

• Smooth navigation: pages, posts, and products load instantly
• Smooth form submissions: contact forms, checkouts without refresh
• Smooth search: search results appear seamlessly

Everything works without a full page reload, creating an app-like experience.

Learn more } > Enable SPA for Frontend
isLocked() ? shakePromo() : handleAdminSpaToggle(v)} subtitle={ wpHasNativeAdminSpa() ? `WordPress ${wp.version} navigates the dashboard on its own. Best left off.` : 'Smooth admin navigation and form saves. No refresh needed.' } locked={isLocked()} tooltip={ <> Enables SPA mode for WordPress admin area.

• Smooth navigation: admin pages load instantly
• Smooth form submissions: settings save without refresh
• Faster workflows: seamless editing experience

Everything works without a full page reload.

Beta: May not work with all plugins.} > WordPress {wp.version} already does this natively, so leaving this off is recommended. Running two navigators at once can conflict. } badge={Beta} content={ WordPress {wp.version} has no dashboard navigation of its own. This is the only way to get instant admin page loads.
} >
WordPress {wp.version} ships its own dashboard navigation, so this is no longer needed. Turning it off is recommended - two navigators on the same screen can conflict.
} > Enable SPA for Admin Dashboard isLocked() ? shakePromo() : settings.enable_prefetch = v} subtitle="Prefetch pages when users hover over links for instant loading." locked={isLocked()} tooltip={ <> Prefetches page content when users hover over links.

When enabled, AjaxPress will fetch page content in the background as users hover over links. When they click, the page loads instantly.

Significantly improves perceived performance with minimal bandwidth cost. } > Enable Prefetch
settings.disable_for_admins = v} subtitle="Logged in admins see normal page loads on frontend." tooltip={ <> Disables SPA mode for administrators on the frontend.

When enabled, logged in admin users will experience normal page reloads instead of SPA navigation. Useful for debugging or testing.

Regular visitors still get the full SPA experience. } > Load Frontend Normally for Admins
isLocked() ? shakePromo() : settings.block_keyboard_reload = v} subtitle="Block Ctrl+R, Cmd+R, and F5 from reloading the page." locked={isLocked()} tooltip={ <> Block keyboard reload shortcuts on the frontend.

Prevents visitors from accidentally reloading the page using keyboard shortcuts like Ctrl+R, Cmd+R, or F5.

Useful for radio stations and media sites where reload interrupts playback. } > Block Keyboard Reload
settings.bypass_auth_forms = v} subtitle="Reload the page on sign-in instead of submitting over ajax." tooltip={ <> Submits login and registration forms as a full page load instead of over ajax.

Leave this off for the normal app-like experience: signing in, registering, and password forms all submit over ajax without a refresh.

Turn it on only if your sign-in flow needs a real page load, for example a security or membership plugin that redirects or challenges on login.

Applies to WooCommerce My Account, checkout account creation, and any form with a password field. } badge={New} > Full Page Reload on Login & Registration
); }