Hidable triggers/conditions
This commit is contained in:
1 parent
51bac6f0e9
commit
8fea6f1082
25 files changed
+704
-300
No files matched your search
@@ -6,6 +6,7 @@ import { useAutoMockAPI, useProfileMockAPI } from "./mock";
|
||||
import { createContext, useContext, useRef } from "react";
|
||||
import { makeProfileAPI } from "./profile";
|
||||
import { ApiState } from "./types";
|
||||
import { UserProfile } from "services/api/types";
|
||||
|
||||
const locationPrefixWeb = window.location.pathname.match(/(\/.+\/)web/i);
|
||||
const baseURL = new URL(
|
||||
@@ -33,3 +34,15 @@ const ApiStateContext = createContext<ApiState>({
|
||||
});
|
||||
export const ApiStateProvider = ApiStateContext.Provider;
|
||||
export const useApiState = () => useContext(ApiStateContext);
|
||||
export const useUserProfile = (): UserProfile => {
|
||||
const apiUserProfile = useApiState().userProfile;
|
||||
if (apiUserProfile.ready && apiUserProfile.ok) {
|
||||
return apiUserProfile.data;
|
||||
} else {
|
||||
return {
|
||||
lang: "eng",
|
||||
theme: "dark",
|
||||
flags: {},
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -112,6 +112,7 @@ export const useProfileMockAPI = (
|
||||
initialProfile: UserProfile = {
|
||||
lang: "eng",
|
||||
theme: "dark",
|
||||
flags: {},
|
||||
},
|
||||
makeRef = useRef,
|
||||
returnErrors: boolean = false
|
||||
|
||||
@@ -40,4 +40,8 @@ export interface ApiState {
|
||||
export type UserProfile = {
|
||||
theme: string;
|
||||
lang: string;
|
||||
flags: Partial<{
|
||||
useNodesRow: boolean;
|
||||
flipped: boolean;
|
||||
}>;
|
||||
};
|
||||
@@ -31,6 +31,7 @@
|
||||
"STATE": "State",
|
||||
"SEARCH": "Search",
|
||||
"FLIPP": "Flip",
|
||||
"FLIPP_GRAPH": "Flip Graph",
|
||||
"CANCEL": "Cancel",
|
||||
"CREATE": "Create",
|
||||
"OR": "Or",
|
||||
@@ -179,5 +180,7 @@
|
||||
"HOW_MANY_TIMES": "How many times?",
|
||||
|
||||
"READONLY_MODE": "Read Only Mode",
|
||||
"READONLY_CANNOT_UPDATE": "Cannot update in readonly mode"
|
||||
"READONLY_CANNOT_UPDATE": "Cannot update in readonly mode",
|
||||
|
||||
"NODES_ROW": "Do not inlcude automation triggers & conditions in graph."
|
||||
}
|
||||
@@ -34,6 +34,7 @@
|
||||
"STATE": "Statut",
|
||||
"SEARCH": "Chercher",
|
||||
"FLIPP": "Retourner",
|
||||
"FLIPP_GRAPH": "Inverser le graphique",
|
||||
"CANCEL": "Annuler",
|
||||
"CREATE": "Créer",
|
||||
"OR": "Ou",
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
"STATE": "Stato",
|
||||
"SEARCH": "Cerca",
|
||||
"FLIPP": "Flip",
|
||||
"FLIPP_GRAPH": "Capovolgi il grafico",
|
||||
"CANCEL": "Cancella",
|
||||
"CREATE": "Crea",
|
||||
"OR": "Oppure",
|
||||
|
||||
Reference in new issue
Block a user