Hidable triggers/conditions

This commit is contained in:
ari committed 2022-09-24 14:24:03 -04:00
1 parent 51bac6f0e9
commit 8fea6f1082
25 files changed
+704 -300

No files matched your search

+13
View File
@@ -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: {},
};
}
};
+1
View File
@@ -112,6 +112,7 @@ export const useProfileMockAPI = (
initialProfile: UserProfile = {
lang: "eng",
theme: "dark",
flags: {},
},
makeRef = useRef,
returnErrors: boolean = false
+4
View File
@@ -40,4 +40,8 @@ export interface ApiState {
export type UserProfile = {
theme: string;
lang: string;
flags: Partial<{
useNodesRow: boolean;
flipped: boolean;
}>;
};