mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-09 21:14:22 +00:00
feat(ui): add Local Server Cloud upgrade prompts (#11982)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
import type { CloudUpgradeFeature } from "@/types/cloud-upgrade";
|
||||
|
||||
interface CloudUpgradeStoreState {
|
||||
activeFeature: CloudUpgradeFeature | null;
|
||||
returnFocusElement: HTMLElement | null;
|
||||
openCloudUpgrade: (
|
||||
feature: CloudUpgradeFeature,
|
||||
returnFocusElement?: HTMLElement,
|
||||
) => void;
|
||||
closeCloudUpgrade: () => void;
|
||||
}
|
||||
|
||||
// Upgrade prompts are ephemeral and shared so only one modal can be open.
|
||||
export const useCloudUpgradeStore = create<CloudUpgradeStoreState>((set) => ({
|
||||
activeFeature: null,
|
||||
returnFocusElement: null,
|
||||
openCloudUpgrade: (activeFeature, requestedReturnFocusElement) =>
|
||||
set({
|
||||
activeFeature,
|
||||
returnFocusElement:
|
||||
requestedReturnFocusElement ??
|
||||
(document.activeElement instanceof HTMLElement
|
||||
? document.activeElement
|
||||
: null),
|
||||
}),
|
||||
closeCloudUpgrade: () => set({ activeFeature: null }),
|
||||
}));
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./cloud-upgrade/store";
|
||||
export * from "./organizations/store";
|
||||
export * from "./provider-wizard/store";
|
||||
export * from "./scans/store";
|
||||
|
||||
Reference in New Issue
Block a user