aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/context
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-06-06 00:09:25 -0300
committerSebastian <sebasjm@gmail.com>2022-06-06 00:09:25 -0300
commitfb6aff76d2152d95caa2ba6cb0d91cb01e0687fe (patch)
tree2dc9b0a4935f60ba7229fd81332ec4a41ad4698c /packages/taler-wallet-webextension/src/context
parent912813fd09ee2f757e4d6d509a911159b46153a7 (diff)
downloadwallet-core-fb6aff76d2152d95caa2ba6cb0d91cb01e0687fe.tar.xz
prettier
Diffstat (limited to 'packages/taler-wallet-webextension/src/context')
-rw-r--r--packages/taler-wallet-webextension/src/context/devContext.ts7
-rw-r--r--packages/taler-wallet-webextension/src/context/iocContext.ts27
-rw-r--r--packages/taler-wallet-webextension/src/context/translation.ts8
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);