diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/context')
3 files changed, 30 insertions, 12 deletions
diff --git a/packages/taler-wallet-webextension/src/context/devContext.ts b/packages/taler-wallet-webextension/src/context/devContext.ts index ec79f22d8..fb4781ba0 100644 --- a/packages/taler-wallet-webextension/src/context/devContext.ts +++ b/packages/taler-wallet-webextension/src/context/devContext.ts @@ -29,7 +29,9 @@ interface Type { } const Context = createContext<Type>({ devMode: false, - toggleDevMode: async () => { return; }, + toggleDevMode: async () => { + return; + }, }); export const useDevContext = (): Type => useContext(Context); @@ -55,7 +57,8 @@ export const DevContextProviderForTesting = ({ export const DevContextProvider = ({ children }: { children: any }): VNode => { const [value, setter] = useLocalStorage("devMode"); const devMode = value === "true"; - const toggleDevMode = async (): Promise<void> => setter((v) => (!v ? "true" : undefined)); + const toggleDevMode = async (): Promise<void> => + setter((v) => (!v ? "true" : undefined)); children = children.length === 1 && typeof children === "function" ? children({ devMode }) diff --git a/packages/taler-wallet-webextension/src/context/iocContext.ts b/packages/taler-wallet-webextension/src/context/iocContext.ts index aaf1f8b67..d875d9c76 100644 --- a/packages/taler-wallet-webextension/src/context/iocContext.ts +++ b/packages/taler-wallet-webextension/src/context/iocContext.ts @@ -32,18 +32,31 @@ const Context = createContext<Type>({ /** * Inversion of control Context - * - * This context act as a proxy between API that need to be replaced in + * + * This context act as a proxy between API that need to be replaced in * different environments - * - * @returns + * + * @returns */ export const useIocContext = (): Type => useContext(Context); -export const IoCProviderForTesting = ({ value, children }: { value: Type, children: any }): VNode => { +export const IoCProviderForTesting = ({ + value, + children, +}: { + value: Type; + children: any; +}): VNode => { return h(Context.Provider, { value, children }); }; -export const IoCProviderForRuntime = ({ children }: { children: any }): VNode => { - return h(Context.Provider, { value: { findTalerUriInActiveTab: platform.findTalerUriInActiveTab }, children }); +export const IoCProviderForRuntime = ({ + children, +}: { + children: any; +}): VNode => { + return h(Context.Provider, { + value: { findTalerUriInActiveTab: platform.findTalerUriInActiveTab }, + children, + }); }; diff --git a/packages/taler-wallet-webextension/src/context/translation.ts b/packages/taler-wallet-webextension/src/context/translation.ts index 9d55c918b..edc1f9ca3 100644 --- a/packages/taler-wallet-webextension/src/context/translation.ts +++ b/packages/taler-wallet-webextension/src/context/translation.ts @@ -27,7 +27,7 @@ import { strings } from "../i18n/strings.js"; interface Type { lang: string; - supportedLang: { [id in keyof typeof supportedLang]: string } + supportedLang: { [id in keyof typeof supportedLang]: string }; changeLanguage: (l: string) => void; i18n: typeof i18n; isSaved: boolean; @@ -47,7 +47,6 @@ const supportedLang = { navigator: "Defined by navigator", }; - const initial = { lang: "en", supportedLang, @@ -84,7 +83,10 @@ export const TranslationProvider = ({ } else { setupI18n(lang, strings); } - return h(Context.Provider, { value: { lang, changeLanguage, supportedLang, i18n, isSaved }, children }); + return h(Context.Provider, { + value: { lang, changeLanguage, supportedLang, i18n, isSaved }, + children, + }); }; export const useTranslationContext = (): Type => useContext(Context); |