mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-11-08 20:33:41 +00:00
feat(ui): offer Lighthouse AI help in the add-provider wizard (#13178)
This commit is contained in:
1 parent
d7bffba4ac
commit
4eb468619f
50 files changed
+2214
-170
No files matched your search
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
import { useMediaQuery } from "@/hooks/use-media-query";
|
||||
import { useStore } from "@/hooks/use-store";
|
||||
import { isLighthouseChatRoute } from "@/lib/lighthouse-routes";
|
||||
import {
|
||||
clampSidePanelWidth,
|
||||
SIDE_PANEL_PUSH_MEDIA_QUERY,
|
||||
} from "@/lib/ui-layout";
|
||||
import { useSidePanelStore } from "@/store/side-panel";
|
||||
|
||||
// Pixels the open side panel takes from the right edge; undefined while it is
|
||||
// closed, overlays full-width (below `sm`) or does not exist (full-page chat).
|
||||
export function useSidePanelPushWidth(): number | undefined {
|
||||
const pathname = usePathname();
|
||||
const isOpen = useStore(useSidePanelStore, (state) => state.isOpen);
|
||||
const width = useStore(useSidePanelStore, (state) => state.width);
|
||||
const isPushViewport = useMediaQuery(SIDE_PANEL_PUSH_MEDIA_QUERY);
|
||||
|
||||
if (!isOpen || width === undefined || !isPushViewport) return undefined;
|
||||
if (isLighthouseChatRoute(pathname)) return undefined;
|
||||
// Re-clamp at consumption: a persisted width from a larger monitor
|
||||
// rehydrates raw and would otherwise collapse the page on this viewport.
|
||||
return clampSidePanelWidth(width);
|
||||
}
|
||||
Reference in new issue
Block a user