import { TranslationProvider } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact";
import { ExchangeAmlFrame, Main } from "./Dashboard.js";
import "./scss/main.css";
import { ExchangeApiProvider } from "./context/config.js";
import { getInitialBackendBaseURL } from "./hooks/useBackend.js";

export function App(): VNode {
  const baseUrl = getInitialBackendBaseURL();
  return (
    <TranslationProvider source={{}}>
      <ExchangeApiProvider baseUrl={baseUrl} frameOnError={ExchangeAmlFrame}>
        <ExchangeAmlFrame>
          <Main />
        </ExchangeAmlFrame>
      </ExchangeApiProvider>
    </TranslationProvider>
  );
}
