ecda46caa5
* feat: add network-switcher lib * feat: add env variables for some deployed app urls * feat: add network processing to environment hoook * refactor: network handling * refactor: remove dialog from provider and add env setter * feat: add network switcher dialog to the trading app * refactor: add network redirect to dialog connect callback * fix: lint * fix: jsonify env variable for possible networks * fix: add formatter file * fix: assign correct global state to network swicther * feat: add network-switcher lib * feat: add env variables for some deployed app urls * feat: add network processing to environment hoook * refactor: network handling * refactor: remove dialog from provider and add env setter * feat: add network switcher dialog to the trading app * refactor: add network redirect to dialog connect callback * fix: lint * fix: jsonify env variable for possible networks * fix: add formatter file * fix: assign correct global state to network swicther * fix: failing tests from UI changes * fix: lint * fix: lint Co-authored-by: Joe <joe@vega.xyz> Co-authored-by: Dexter <dexter.edwards93@gmail.com>
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import type { SetState } from 'zustand';
|
|
import create from 'zustand';
|
|
|
|
interface GlobalStore {
|
|
vegaWalletConnectDialog: boolean;
|
|
setVegaWalletConnectDialog: (isOpen: boolean) => void;
|
|
vegaWalletManageDialog: boolean;
|
|
setVegaWalletManageDialog: (isOpen: boolean) => void;
|
|
vegaNetworkSwitcherDialog: boolean;
|
|
setVegaNetworkSwitcherDialog: (isOpen: boolean) => void;
|
|
landingDialog: boolean;
|
|
setLandingDialog: (isOpen: boolean) => void;
|
|
}
|
|
|
|
export const useGlobalStore = create((set: SetState<GlobalStore>) => ({
|
|
vegaWalletConnectDialog: false,
|
|
setVegaWalletConnectDialog: (isOpen: boolean) => {
|
|
set({ vegaWalletConnectDialog: isOpen });
|
|
},
|
|
vegaWalletManageDialog: false,
|
|
setVegaWalletManageDialog: (isOpen: boolean) => {
|
|
set({ vegaWalletManageDialog: isOpen });
|
|
},
|
|
vegaNetworkSwitcherDialog: false,
|
|
setVegaNetworkSwitcherDialog: (isOpen: boolean) => {
|
|
set({ vegaNetworkSwitcherDialog: isOpen });
|
|
},
|
|
landingDialog: false,
|
|
setLandingDialog: (isOpen: boolean) => {
|
|
set({ landingDialog: isOpen });
|
|
},
|
|
}));
|