diff options
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/AddingProviderScreen')
4 files changed, 15 insertions, 3 deletions
diff --git a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/index.ts b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/index.ts index 5d5913ffc..0ab275f54 100644 --- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/index.ts +++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/index.ts @@ -16,6 +16,7 @@ import { AuthenticationProviderStatus } from "@gnu-taler/anastasis-core"; import InvalidState from "../../../components/InvalidState.js"; import NoReducer from "../../../components/NoReducer.js"; +import { Notification } from "../../../components/Notifications.js"; import { compose, StateViewMap } from "../../../utils/index.js"; import useComponentState from "./state.js"; import { WithoutProviderType, WithProviderType } from "./views.js"; @@ -44,6 +45,7 @@ interface CommonProps { setProviderURL: (url: string) => Promise<void>; providerURL: string; errors: string | undefined; + notifications: Notification[]; } export interface WithType extends CommonProps { @@ -90,7 +92,7 @@ export async function testProvider( } return; } catch (e) { - console.log("error", e); + console.log("ERROR testProvider", e); const error = e instanceof Error ? Error( diff --git a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/state.ts b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/state.ts index a04c7957b..009ab20a2 100644 --- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/state.ts +++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/state.ts @@ -14,6 +14,7 @@ GNU Anastasis; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ import { useEffect, useRef, useState } from "preact/hooks"; +import { Notification } from "../../../components/Notifications.js"; import { useAnastasisContext } from "../../../context/anastasis.js"; import { authMethods, KnownAuthMethods } from "../authMethod/index.jsx"; import { AuthProvByStatusMap, State, testProvider } from "./index.js"; @@ -21,9 +22,10 @@ import { AuthProvByStatusMap, State, testProvider } from "./index.js"; interface Props { providerType?: KnownAuthMethods; onCancel: () => Promise<void>; + notifications?: Notification[]; } -export default function useComponentState({ providerType, onCancel }: Props): State { +export default function useComponentState({ providerType, onCancel, notifications = [] }: Props): State { const reducer = useAnastasisContext(); const [providerURL, setProviderURL] = useState(""); @@ -128,6 +130,7 @@ export default function useComponentState({ providerType, onCancel }: Props): St setProviderURL: async (s: string) => setProviderURL(s), errors, error, + notifications } if (!providerLabel) { diff --git a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/stories.tsx b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/stories.tsx index 7faaae4d8..dc41d9c1a 100644 --- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/stories.tsx +++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/stories.tsx @@ -53,6 +53,7 @@ export const NewProvider = createExampleWithoutAnastasis(WithoutProviderType, { disabled: [], error: [], }, + notifications: [], }); export const NewProviderWithoutProviderList = createExampleWithoutAnastasis( @@ -64,6 +65,7 @@ export const NewProviderWithoutProviderList = createExampleWithoutAnastasis( disabled: [], error: [], }, + notifications: [], }, ); @@ -75,6 +77,7 @@ export const NewSmsProvider = createExampleWithoutAnastasis(WithProviderType, { error: [], }, providerLabel: "sms", + notifications: [], }); export const NewIBANProvider = createExampleWithoutAnastasis(WithProviderType, { @@ -85,4 +88,5 @@ export const NewIBANProvider = createExampleWithoutAnastasis(WithProviderType, { error: [], }, providerLabel: "IBAN", + notifications: [], }); diff --git a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/views.tsx b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/views.tsx index bb1283a82..e397e0b65 100644 --- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/views.tsx +++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/views.tsx @@ -20,6 +20,7 @@ import { import { h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; import { TextInput } from "../../../components/fields/TextInput.js"; +import { Notifications } from "../../../components/Notifications.js"; import { AnastasisClientFrame } from "../index.js"; import { testProvider, WithoutType, WithType } from "./index.js"; @@ -31,6 +32,7 @@ export function WithProviderType(props: WithType): VNode { hideNext={props.errors} > <div> + <Notifications notifications={props.notifications} /> <p>Add a provider url for a {props.providerLabel} service</p> <div class="container"> <TextInput @@ -108,10 +110,11 @@ export function WithoutProviderType(props: WithoutType): VNode { return ( <AnastasisClientFrame hideNav - title="Backup: Manage providers2" + title="Backup: Manage providers" hideNext={props.errors} > <div> + <Notifications notifications={props.notifications} /> <p>Add a provider url</p> <div class="container"> <TextInput |