mirror of
https://github.com/Qortal/qapp-core.git
synced 2025-06-14 17:41:20 +00:00
switch utils to direct imports
This commit is contained in:
parent
fa97fd2fec
commit
0fe689300e
@ -2,36 +2,21 @@ import React, { createContext, CSSProperties, useContext, useMemo } from "react"
|
|||||||
import { useAuth, UseAuthProps } from "../hooks/useAuth";
|
import { useAuth, UseAuthProps } from "../hooks/useAuth";
|
||||||
import { useResources } from "../hooks/useResources";
|
import { useResources } from "../hooks/useResources";
|
||||||
import { useAppInfo } from "../hooks/useAppInfo";
|
import { useAppInfo } from "../hooks/useAppInfo";
|
||||||
import { addAndEncryptSymmetricKeys, decryptWithSymmetricKeys, encryptWithSymmetricKeys } from "../utils/encryption";
|
|
||||||
import { useIdentifiers } from "../hooks/useIdentifiers";
|
import { useIdentifiers } from "../hooks/useIdentifiers";
|
||||||
import { objectToBase64 } from "../utils/base64";
|
|
||||||
import { base64ToObject } from "../utils/publish";
|
|
||||||
import { generateBloomFilterBase64, isInsideBloom } from "../utils/bloomFilter";
|
|
||||||
import { formatTimestamp } from "../utils/time";
|
|
||||||
import { Toaster } from "react-hot-toast";
|
import { Toaster } from "react-hot-toast";
|
||||||
import { useLocalStorage } from "../hooks/useLocalStorage";
|
import { useLocalStorage } from "../hooks/useLocalStorage";
|
||||||
|
|
||||||
|
|
||||||
const utils = {
|
|
||||||
objectToBase64,
|
|
||||||
base64ToObject,
|
|
||||||
addAndEncryptSymmetricKeys,
|
|
||||||
encryptWithSymmetricKeys,
|
|
||||||
decryptWithSymmetricKeys,
|
|
||||||
generateBloomFilterBase64,
|
|
||||||
isInsideBloom,
|
|
||||||
formatTimestamp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ✅ Define Global Context Type
|
// ✅ Define Global Context Type
|
||||||
interface GlobalContextType {
|
interface GlobalContextType {
|
||||||
auth: ReturnType<typeof useAuth>;
|
auth: ReturnType<typeof useAuth>;
|
||||||
lists: ReturnType<typeof useResources>;
|
lists: ReturnType<typeof useResources>;
|
||||||
appInfo: ReturnType<typeof useAppInfo>;
|
appInfo: ReturnType<typeof useAppInfo>;
|
||||||
identifierOperations: ReturnType<typeof useIdentifiers>
|
identifierOperations: ReturnType<typeof useIdentifiers>
|
||||||
localStorageOperations: ReturnType<typeof useLocalStorage>
|
localStorageOperations: ReturnType<typeof useLocalStorage>
|
||||||
utils: typeof utils
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +46,7 @@ export const GlobalProvider = ({ children, config, toastStyle = {} }: GlobalProv
|
|||||||
const identifierOperations = useIdentifiers(config.publicSalt, config.appName)
|
const identifierOperations = useIdentifiers(config.publicSalt, config.appName)
|
||||||
const localStorageOperations = useLocalStorage(config.publicSalt, config.appName)
|
const localStorageOperations = useLocalStorage(config.publicSalt, config.appName)
|
||||||
// ✅ Merge all hooks into a single `contextValue`
|
// ✅ Merge all hooks into a single `contextValue`
|
||||||
const contextValue = useMemo(() => ({ auth, lists, appInfo, identifierOperations, utils, localStorageOperations }), [auth, lists, appInfo, identifierOperations, localStorageOperations]);
|
const contextValue = useMemo(() => ({ auth, lists, appInfo, identifierOperations, localStorageOperations }), [auth, lists, appInfo, identifierOperations, localStorageOperations]);
|
||||||
return (
|
return (
|
||||||
<GlobalContext.Provider value={contextValue}>
|
<GlobalContext.Provider value={contextValue}>
|
||||||
<Toaster
|
<Toaster
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React, { useCallback, useEffect, useMemo } from "react";
|
import React, { useCallback } from "react";
|
||||||
import { useAppStore } from "../state/app";
|
|
||||||
import { buildIdentifier, buildSearchPrefix, EnumCollisionStrength, hashWord } from "../utils/encryption";
|
import { buildIdentifier, buildSearchPrefix, EnumCollisionStrength, hashWord } from "../utils/encryption";
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
export { useResourceStatus } from './hooks/useResourceStatus';
|
export { useResourceStatus } from './hooks/useResourceStatus';
|
||||||
import './index.css'
|
import './index.css'
|
||||||
|
export { objectToBase64 } from './utils/base64';
|
||||||
|
export { generateBloomFilterBase64, isInsideBloom } from './utils/bloomFilter';
|
||||||
|
export { addAndEncryptSymmetricKeys, decryptWithSymmetricKeys, encryptWithSymmetricKeys } from './utils/encryption';
|
||||||
|
export { base64ToObject } from './utils/publish';
|
||||||
|
export { formatTimestamp } from './utils/time';
|
||||||
export { EnumCollisionStrength } from './utils/encryption';
|
export { EnumCollisionStrength } from './utils/encryption';
|
||||||
export { showLoading, dismissToast, showError, showSuccess } from './utils/toast';
|
export { showLoading, dismissToast, showError, showSuccess } from './utils/toast';
|
||||||
export { processText, sanitizedContent, extractComponents, handleClickText} from './utils/text';
|
export { processText, sanitizedContent, extractComponents, handleClickText} from './utils/text';
|
||||||
@ -14,3 +19,5 @@ export {Resource} from './hooks/useResources'
|
|||||||
export {Service} from './types/interfaces/resources'
|
export {Service} from './types/interfaces/resources'
|
||||||
export {ListItem} from './state/cache'
|
export {ListItem} from './state/cache'
|
||||||
export {SymmetricKeys} from './utils/encryption'
|
export {SymmetricKeys} from './utils/encryption'
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user