diff --git a/app/Views/layouts/base.twig b/app/Views/layouts/base.twig index 9c153de..93b8338 100644 --- a/app/Views/layouts/base.twig +++ b/app/Views/layouts/base.twig @@ -213,6 +213,18 @@ background: var(--primary); color: #fff; } + .htmx-active { + z-index: 9999; + position: fixed; + bottom: 63px; + right: 10px; + background: #eef; + border: 1px solid #ccd; + padding: 0.5rem; + font-family: monospace; + font-size: 0.8rem; + border-radius: 4px; + } #sprout-btn { position: relative; overflow: hidden; @@ -373,7 +385,7 @@ {% if config('app.env', 'local') == 'local' %} -
+
⚡ HTMX Active
📃 diff --git a/core/Support/Debugbar.php b/core/Support/Debugbar.php index 06351f9..3555d00 100644 --- a/core/Support/Debugbar.php +++ b/core/Support/Debugbar.php @@ -12,10 +12,10 @@ class Debugbar public static function isAjaxRequest(): bool { return ( - isset($_SERVER['HTTP_X_REQUESTED_WITH']) && + isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest' ) || ( - isset($_SERVER['HTTP_HX_REQUEST']) && + isset($_SERVER['HTTP_HX_REQUEST']) && $_SERVER['HTTP_HX_REQUEST'] === 'true' ); } @@ -27,7 +27,7 @@ public static function resetForRequest() { // Reset query log for this specific request DB::resetQueryLog(); - + // Set new start time for this request if (!defined('REQUEST_START')) { define('REQUEST_START', microtime(true)); @@ -36,7 +36,8 @@ public static function resetForRequest() public static function render() { - if (!env('APP_DEBUG')) return; + if (!env('APP_DEBUG')) + return; $endTime = microtime(true); $startTime = defined('REQUEST_START') ? REQUEST_START : SPROUT_START; @@ -45,20 +46,40 @@ public static function render() $queries = DB::getQueries(); $totalQueryTime = round(array_sum(array_column($queries, 'duration')), 2); - echo "
"; + echo ""; + + // End debugbar div + + // Floating show button (initially hidden) + echo ""; + // Inline script to update URI after HTMX navigation echo ""; + + // Inline script for toggle + + echo ""; } }