fix compile
This commit is contained in:
parent
e3d046457b
commit
77fb6c0d88
@ -6,7 +6,7 @@ import { useState } from "preact/hooks";
|
|||||||
|
|
||||||
export function InputSelectMultiple<T extends object, K extends keyof T>(
|
export function InputSelectMultiple<T extends object, K extends keyof T>(
|
||||||
props: {
|
props: {
|
||||||
choices: Choice[];
|
choices: Choice<T[K]>[];
|
||||||
unique?: boolean;
|
unique?: boolean;
|
||||||
max?: number;
|
max?: number;
|
||||||
} & UIFormProps<T, K>,
|
} & 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 [filter, setFilter] = useState<string | undefined>(undefined);
|
||||||
const regex = new RegExp(`.*${filter}.*`, "i");
|
const regex = new RegExp(`.*${filter}.*`, "i");
|
||||||
const choiceMap = choices.reduce((prev, curr) => {
|
const choiceMap = choices.reduce((prev, curr) => {
|
||||||
return { ...prev, [curr.value]: curr.label };
|
return { ...prev, [curr.value as string]: curr.label };
|
||||||
}, {} as Record<string, string>);
|
}, {} as Record<string, string>);
|
||||||
|
|
||||||
const list = (value ?? []) as string[];
|
const list = (value ?? []) as string[];
|
||||||
@ -111,14 +111,14 @@ export function InputSelectMultiple<T extends object, K extends keyof T>(
|
|||||||
role="option"
|
role="option"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setFilter(undefined);
|
setFilter(undefined);
|
||||||
if (unique && list.indexOf(v.value) !== -1) {
|
if (unique && list.indexOf(v.value as string) !== -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (max !== undefined && list.length >= max) {
|
if (max !== undefined && list.length >= max) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const newValue = [...list];
|
const newValue = [...list];
|
||||||
newValue.splice(0, 0, v.value);
|
newValue.splice(0, 0, v.value as string);
|
||||||
onChange(newValue as T[K]);
|
onChange(newValue as T[K]);
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import { useState } from "preact/hooks";
|
|||||||
|
|
||||||
export function InputSelectOne<T extends object, K extends keyof T>(
|
export function InputSelectOne<T extends object, K extends keyof T>(
|
||||||
props: {
|
props: {
|
||||||
choices: Choice[];
|
choices: Choice<T[K]>[];
|
||||||
} & UIFormProps<T, K>,
|
} & UIFormProps<T, K>,
|
||||||
): VNode {
|
): VNode {
|
||||||
const { name, label, choices, placeholder, tooltip, required } = props;
|
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 [filter, setFilter] = useState<string | undefined>(undefined);
|
||||||
const regex = new RegExp(`.*${filter}.*`, "i");
|
const regex = new RegExp(`.*${filter}.*`, "i");
|
||||||
const choiceMap = choices.reduce((prev, curr) => {
|
const choiceMap = choices.reduce((prev, curr) => {
|
||||||
return { ...prev, [curr.value]: curr.label };
|
return { ...prev, [curr.value as string]: curr.label };
|
||||||
}, {} as Record<string, string>);
|
}, {} as Record<string, string>);
|
||||||
|
|
||||||
const filteredChoices =
|
const filteredChoices =
|
||||||
|
@ -126,24 +126,14 @@ function getEventsFromAmlHistory(
|
|||||||
prev.push({
|
prev.push({
|
||||||
type: "kyc-collection",
|
type: "kyc-collection",
|
||||||
title: "collection" as TranslatedString,
|
title: "collection" as TranslatedString,
|
||||||
when: {
|
when: AbsoluteTime.fromProtocolTimestamp(k.collection_time),
|
||||||
t_ms:
|
|
||||||
k.collection_time.t_s === "never"
|
|
||||||
? "never"
|
|
||||||
: k.collection_time.t_s * 1000,
|
|
||||||
},
|
|
||||||
values: !k.attributes ? {} : k.attributes,
|
values: !k.attributes ? {} : k.attributes,
|
||||||
provider: k.provider_section,
|
provider: k.provider_section,
|
||||||
});
|
});
|
||||||
prev.push({
|
prev.push({
|
||||||
type: "kyc-expiration",
|
type: "kyc-expiration",
|
||||||
title: "expired" as TranslatedString,
|
title: "expired" as TranslatedString,
|
||||||
when: {
|
when: AbsoluteTime.fromProtocolTimestamp(k.expiration_time),
|
||||||
t_ms:
|
|
||||||
k.expiration_time.t_s === "never"
|
|
||||||
? "never"
|
|
||||||
: k.expiration_time.t_s * 1000,
|
|
||||||
},
|
|
||||||
fields: !k.attributes ? [] : Object.keys(k.attributes),
|
fields: !k.attributes ? [] : Object.keys(k.attributes),
|
||||||
});
|
});
|
||||||
return prev;
|
return prev;
|
||||||
|
@ -3,7 +3,7 @@ import { allForms } from "./AntiMoneyLaunderingForm.js";
|
|||||||
import { Pages } from "../pages.js";
|
import { Pages } from "../pages.js";
|
||||||
import { NiceForm } from "../NiceForm.js";
|
import { NiceForm } from "../NiceForm.js";
|
||||||
import { AmlState } from "../types.js";
|
import { AmlState } from "../types.js";
|
||||||
import { Amounts } from "@gnu-taler/taler-util";
|
import { AbsoluteTime, Amounts } from "@gnu-taler/taler-util";
|
||||||
|
|
||||||
export function NewFormEntry({
|
export function NewFormEntry({
|
||||||
account,
|
account,
|
||||||
@ -26,9 +26,7 @@ export function NewFormEntry({
|
|||||||
const showingFrom = allForms[selectedForm].impl;
|
const showingFrom = allForms[selectedForm].impl;
|
||||||
const initial = {
|
const initial = {
|
||||||
fullName: "loggedIn_user_fullname",
|
fullName: "loggedIn_user_fullname",
|
||||||
when: {
|
when: AbsoluteTime.now(),
|
||||||
t_ms: new Date().getTime(),
|
|
||||||
},
|
|
||||||
state: AmlState.pending,
|
state: AmlState.pending,
|
||||||
threshold: Amounts.parseOrThrow("USD:10"),
|
threshold: Amounts.parseOrThrow("USD:10"),
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { TranslatedString } from "@gnu-taler/taler-util";
|
import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
notifyError,
|
notifyError,
|
||||||
notifyInfo,
|
notifyInfo,
|
||||||
@ -47,7 +47,7 @@ export function Officer() {
|
|||||||
<CreateAccount
|
<CreateAccount
|
||||||
onNewAccount={(salt, key, pwd) => {
|
onNewAccount={(salt, key, pwd) => {
|
||||||
password.update(pwd);
|
password.update(pwd);
|
||||||
officer.update({ salt, when: { t_ms: Date.now() }, key });
|
officer.update({ salt, when: AbsoluteTime.now(), key });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user