summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-05-26 10:09:56 -0300
committerSebastian <sebasjm@gmail.com>2023-05-26 10:09:56 -0300
commit77fb6c0d88e9889199c0e859dbade53f638ddfd4 (patch)
tree889e477fbdcbb9c9803b51eca2b3bf5284ee0b0b
parente3d046457b53fa1dc5b0cd446ebdeb9b22e2dfe7 (diff)
downloadwallet-core-77fb6c0d88e9889199c0e859dbade53f638ddfd4.tar.gz
wallet-core-77fb6c0d88e9889199c0e859dbade53f638ddfd4.tar.bz2
wallet-core-77fb6c0d88e9889199c0e859dbade53f638ddfd4.zip
fix compile
-rw-r--r--packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx8
-rw-r--r--packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx4
-rw-r--r--packages/exchange-backoffice-ui/src/pages/AccountDetails.tsx14
-rw-r--r--packages/exchange-backoffice-ui/src/pages/NewFormEntry.tsx6
-rw-r--r--packages/exchange-backoffice-ui/src/pages/Officer.tsx4
5 files changed, 12 insertions, 24 deletions
diff --git a/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx b/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
index 8369e509d..837744827 100644
--- a/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
+++ b/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
@@ -6,7 +6,7 @@ import { useState } from "preact/hooks";
export function InputSelectMultiple<T extends object, K extends keyof T>(
props: {
- choices: Choice[];
+ choices: Choice<T[K]>[];
unique?: boolean;
max?: number;
} & UIFormProps<T, K>,
@@ -18,7 +18,7 @@ export function InputSelectMultiple<T extends object, K extends keyof T>(
const [filter, setFilter] = useState<string | undefined>(undefined);
const regex = new RegExp(`.*${filter}.*`, "i");
const choiceMap = choices.reduce((prev, curr) => {
- return { ...prev, [curr.value]: curr.label };
+ return { ...prev, [curr.value as string]: curr.label };
}, {} as Record<string, string>);
const list = (value ?? []) as string[];
@@ -111,14 +111,14 @@ export function InputSelectMultiple<T extends object, K extends keyof T>(
role="option"
onClick={() => {
setFilter(undefined);
- if (unique && list.indexOf(v.value) !== -1) {
+ if (unique && list.indexOf(v.value as string) !== -1) {
return;
}
if (max !== undefined && list.length >= max) {
return;
}
const newValue = [...list];
- newValue.splice(0, 0, v.value);
+ newValue.splice(0, 0, v.value as string);
onChange(newValue as T[K]);
}}
diff --git a/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx b/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx
index 9af446e6c..b0e2277d3 100644
--- a/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx
+++ b/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx
@@ -6,7 +6,7 @@ import { useState } from "preact/hooks";
export function InputSelectOne<T extends object, K extends keyof T>(
props: {
- choices: Choice[];
+ choices: Choice<T[K]>[];
} & UIFormProps<T, K>,
): VNode {
const { name, label, choices, placeholder, tooltip, required } = props;
@@ -15,7 +15,7 @@ export function InputSelectOne<T extends object, K extends keyof T>(
const [filter, setFilter] = useState<string | undefined>(undefined);
const regex = new RegExp(`.*${filter}.*`, "i");
const choiceMap = choices.reduce((prev, curr) => {
- return { ...prev, [curr.value]: curr.label };
+ return { ...prev, [curr.value as string]: curr.label };
}, {} as Record<string, string>);
const filteredChoices =
diff --git a/packages/exchange-backoffice-ui/src/pages/AccountDetails.tsx b/packages/exchange-backoffice-ui/src/pages/AccountDetails.tsx
index 8b9b01ae6..b252d2ab0 100644
--- a/packages/exchange-backoffice-ui/src/pages/AccountDetails.tsx
+++ b/packages/exchange-backoffice-ui/src/pages/AccountDetails.tsx
@@ -126,24 +126,14 @@ function getEventsFromAmlHistory(
prev.push({
type: "kyc-collection",
title: "collection" as TranslatedString,
- when: {
- t_ms:
- k.collection_time.t_s === "never"
- ? "never"
- : k.collection_time.t_s * 1000,
- },
+ when: AbsoluteTime.fromProtocolTimestamp(k.collection_time),
values: !k.attributes ? {} : k.attributes,
provider: k.provider_section,
});
prev.push({
type: "kyc-expiration",
title: "expired" as TranslatedString,
- when: {
- t_ms:
- k.expiration_time.t_s === "never"
- ? "never"
- : k.expiration_time.t_s * 1000,
- },
+ when: AbsoluteTime.fromProtocolTimestamp(k.expiration_time),
fields: !k.attributes ? [] : Object.keys(k.attributes),
});
return prev;
diff --git a/packages/exchange-backoffice-ui/src/pages/NewFormEntry.tsx b/packages/exchange-backoffice-ui/src/pages/NewFormEntry.tsx
index 9c143addd..fdb255701 100644
--- a/packages/exchange-backoffice-ui/src/pages/NewFormEntry.tsx
+++ b/packages/exchange-backoffice-ui/src/pages/NewFormEntry.tsx
@@ -3,7 +3,7 @@ import { allForms } from "./AntiMoneyLaunderingForm.js";
import { Pages } from "../pages.js";
import { NiceForm } from "../NiceForm.js";
import { AmlState } from "../types.js";
-import { Amounts } from "@gnu-taler/taler-util";
+import { AbsoluteTime, Amounts } from "@gnu-taler/taler-util";
export function NewFormEntry({
account,
@@ -26,9 +26,7 @@ export function NewFormEntry({
const showingFrom = allForms[selectedForm].impl;
const initial = {
fullName: "loggedIn_user_fullname",
- when: {
- t_ms: new Date().getTime(),
- },
+ when: AbsoluteTime.now(),
state: AmlState.pending,
threshold: Amounts.parseOrThrow("USD:10"),
};
diff --git a/packages/exchange-backoffice-ui/src/pages/Officer.tsx b/packages/exchange-backoffice-ui/src/pages/Officer.tsx
index 79dd8bace..39e368b37 100644
--- a/packages/exchange-backoffice-ui/src/pages/Officer.tsx
+++ b/packages/exchange-backoffice-ui/src/pages/Officer.tsx
@@ -1,4 +1,4 @@
-import { TranslatedString } from "@gnu-taler/taler-util";
+import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
import {
notifyError,
notifyInfo,
@@ -47,7 +47,7 @@ export function Officer() {
<CreateAccount
onNewAccount={(salt, key, pwd) => {
password.update(pwd);
- officer.update({ salt, when: { t_ms: Date.now() }, key });
+ officer.update({ salt, when: AbsoluteTime.now(), key });
}}
/>
);