aboutsummaryrefslogtreecommitdiff
path: root/packages/aml-backoffice-ui/src/Routing.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/aml-backoffice-ui/src/Routing.tsx')
-rw-r--r--packages/aml-backoffice-ui/src/Routing.tsx65
1 files changed, 40 insertions, 25 deletions
diff --git a/packages/aml-backoffice-ui/src/Routing.tsx b/packages/aml-backoffice-ui/src/Routing.tsx
index f38fc29c2..d69b47184 100644
--- a/packages/aml-backoffice-ui/src/Routing.tsx
+++ b/packages/aml-backoffice-ui/src/Routing.tsx
@@ -15,6 +15,7 @@
*/
import {
+ decodeCrockFromURI,
urlPattern,
useCurrentLocation,
useNavigationContext,
@@ -22,15 +23,16 @@ import {
} from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
-import { assertUnreachable } from "@gnu-taler/taler-util";
+import { assertUnreachable, parsePaytoUri, PaytoString } from "@gnu-taler/taler-util";
import { useEffect } from "preact/hooks";
import { ExchangeAmlFrame } from "./ExchangeAmlFrame.js";
import { useOfficer } from "./hooks/officer.js";
-import { Cases } from "./pages/Cases.js";
+import { Cases, CasesUnderInvestigation } from "./pages/Cases.js";
import { Officer } from "./pages/Officer.js";
import { CaseDetails } from "./pages/CaseDetails.js";
import { CaseUpdate, SelectForm } from "./pages/CaseUpdate.js";
import { HandleAccountNotReady } from "./pages/HandleAccountNotReady.js";
+import { Search } from "./pages/Search.js";
export function Routing(): VNode {
const session = useOfficer();
@@ -62,15 +64,14 @@ function PublicRounting(): VNode {
// const [notification, notify, handleError] = useLocalNotification();
const session = useOfficer();
- if (location === undefined) {
- if (session.state !== "ready") {
- return <HandleAccountNotReady officer={session}/>;
- } else {
- return <div />
- }
- }
-
switch (location.name) {
+ case undefined: {
+ if (session.state !== "ready") {
+ return <HandleAccountNotReady officer={session} />;
+ } else {
+ return <div />;
+ }
+ }
case "config": {
return (
<Fragment>
@@ -95,8 +96,10 @@ function PublicRounting(): VNode {
}
export const privatePages = {
- account: urlPattern(/\/account/, () => "#/account"),
- cases: urlPattern(/\/cases/, () => "#/cases"),
+ profile: urlPattern(/\/profile/, () => "#/profile"),
+ search: urlPattern(/\/search/, () => "#/search"),
+ investigation: urlPattern(/\/investigation/, () => "#/investigation"),
+ active: urlPattern(/\/active/, () => "#/active"),
caseUpdate: urlPattern<{ cid: string; type: string }>(
/\/case\/(?<cid>[a-zA-Z0-9]+)\/new\/(?<type>[a-zA-Z0-9_.]+)/,
({ cid, type }) => `#/case/${cid}/new/${type}`,
@@ -105,6 +108,10 @@ export const privatePages = {
/\/case\/(?<cid>[a-zA-Z0-9]+)\/new/,
({ cid }) => `#/case/${cid}/new`,
),
+ caseDetailsNewAccount: urlPattern<{ cid: string, payto: string }>(
+ /\/case\/(?<cid>[a-zA-Z0-9]+)\/(?<payto>[a-zA-Z0-9]+)/,
+ ({ cid, payto }) => `#/case/${cid}/${payto}`,
+ ),
caseDetails: urlPattern<{ cid: string }>(
/\/case\/(?<cid>[a-zA-Z0-9]+)/,
({ cid }) => `#/case/${cid}`,
@@ -115,36 +122,44 @@ function PrivateRouting(): VNode {
const { navigateTo } = useNavigationContext();
const location = useCurrentLocation(privatePages);
useEffect(() => {
- if (location === undefined) {
- navigateTo(privatePages.account.url({}));
+ if (location.name === undefined) {
+ navigateTo(privatePages.profile.url({}));
}
}, [location]);
- if (location === undefined) {
- return <Fragment />;
- }
-
switch (location.name) {
- case "account": {
+ case undefined: {
+ return <Fragment />;
+ }
+ case "profile": {
return <Officer />;
}
+ case "caseUpdate": {
+ return (
+ <CaseUpdate account={location.values.cid} type={location.values.type} />
+ );
+ }
case "caseDetails": {
return <CaseDetails account={location.values.cid} />;
}
- case "caseUpdate": {
+ case "caseDetailsNewAccount": {
+ console.log(location.values)
return (
- <CaseUpdate
- account={location.values.cid}
- type={location.values.type}
- />
+ <CaseDetails account={location.values.cid} paytoString={decodeCrockFromURI(location.values.payto)} />
);
}
case "caseNew": {
return <SelectForm account={location.values.cid} />;
}
- case "cases": {
+ case "investigation": {
+ return <CasesUnderInvestigation />;
+ }
+ case "active": {
return <Cases />;
}
+ case "search": {
+ return <Search />;
+ }
default:
assertUnreachable(location);
}