aboutsummaryrefslogtreecommitdiff
path: root/packages/anastasis-webui/src/utils/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/anastasis-webui/src/utils/index.tsx')
-rw-r--r--packages/anastasis-webui/src/utils/index.tsx57
1 files changed, 1 insertions, 56 deletions
diff --git a/packages/anastasis-webui/src/utils/index.tsx b/packages/anastasis-webui/src/utils/index.tsx
index 4cf839473..88bcac551 100644
--- a/packages/anastasis-webui/src/utils/index.tsx
+++ b/packages/anastasis-webui/src/utils/index.tsx
@@ -21,67 +21,12 @@ import {
ReducerState,
ReducerStateRecovery,
} from "@gnu-taler/anastasis-core";
-import { ComponentChildren, FunctionalComponent, h, VNode } from "preact";
-import { AnastasisProvider } from "../context/anastasis.js";
+import { VNode } from "preact";
const noop = async (): Promise<void> => {
return;
};
-export function createExampleWithoutAnastasis<Props>(
- Component: FunctionalComponent<Props>,
- props: Partial<Props> | (() => Partial<Props>),
-): ComponentChildren {
- //FIXME: props are evaluated on build time
- // in some cases we want to evaluated the props on render time so we can get some relative timestamp
- // check how we can build evaluatedProps in render time
- const evaluatedProps = typeof props === "function" ? props() : props;
- const Render = (args: any): VNode => h(Component, args);
- return {
- component: Render,
- props: evaluatedProps,
- };
-}
-
-export function createExample<Props>(
- Component: FunctionalComponent<Props>,
- currentReducerState?: ReducerState,
- props?: Partial<Props>,
-): ComponentChildren {
- const Render = (args: Props): VNode => {
- return (
- <AnastasisProvider
- value={{
- currentReducerState,
- discoverMore: noop,
- discoverStart: noop,
- discoveryState: {
- state: "finished",
- },
- currentError: undefined,
- back: noop,
- dismissError: noop,
- reset: noop,
- runTransaction: noop,
- startBackup: noop,
- startRecover: noop,
- transition: noop,
- exportState: () => {
- return "{}";
- },
- importState: noop,
- }}
- >
- <Component {...(args as any)} />
- </AnastasisProvider>
- );
- };
- return {
- component: Render,
- props: props,
- };
-}
-
const base = {
continents: [
{