⚡ 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 "
";
+
+ // Toggle button
+ // Top-right of debugbar
+ // When hidden, show a floating button at bottom right
+
+ echo "";
echo "🌿 SproutPHP DebugBar ";
echo " | Method: " . $_SERVER['REQUEST_METHOD'] . "";
@@ -86,6 +107,26 @@ public static function render()
}
echo "
";
+
+ // End debugbar div
+
+ // Floating show button (initially hidden)
+ echo "
";
+
// Inline script to update URI after HTMX navigation
echo "";
+
+ // Inline script for toggle
+
+ echo "";
}
}