taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit e040eb7378d25f0ae9cb72a6c7dd6750a9bb0cbd
parent 139c752a30aaf16c9525c019e52efb972331cd8a
Author: Sebastian <sebasjm@gmail.com>
Date:   Wed,  7 Aug 2024 12:35:55 -0300

fix product suggestion place

Diffstat:
Mpackages/merchant-backoffice-ui/src/components/form/InputArray.tsx | 33+++++++++++++++++----------------
Mpackages/merchant-backoffice-ui/src/paths/instance/categories/update/UpdatePage.tsx | 3+--
Mpackages/taler-util/src/types-taler-merchant.ts | 5-----
Mpackages/taler-wallet-webextension/src/wallet/DestinationSelection/state.ts | 3+--
4 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/packages/merchant-backoffice-ui/src/components/form/InputArray.tsx b/packages/merchant-backoffice-ui/src/components/form/InputArray.tsx @@ -124,6 +124,23 @@ export function InputArray<T>({ </div> {help} {error && <p class="help is-danger"> {error} </p>} + + {suggestions.length > 0 ? ( + <div> + <DropdownList + name={currentValue} + list={suggestions} + onSelect={(p): void => { + if (!unique || array.indexOf(p as any) === -1) { + onChange([p, ...array] as T[keyof T]); + } + setCurrentValue(""); + setSuggestions([]); + }} + withImage={false} + /> + </div> + ) : undefined} {array.map((v, i) => ( <div key={i} class="tags has-addons mt-3 mb-0"> <span @@ -141,22 +158,6 @@ export function InputArray<T>({ /> </div> ))} - {suggestions.length > 0 ? ( - <div> - <DropdownList - name={currentValue} - list={suggestions} - onSelect={(p): void => { - if (!unique || array.indexOf(p as any) === -1) { - onChange([p, ...array] as T[keyof T]); - } - setCurrentValue(""); - setSuggestions([]); - }} - withImage={false} - /> - </div> - ) : undefined} </div> </div> </div> diff --git a/packages/merchant-backoffice-ui/src/paths/instance/categories/update/UpdatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/categories/update/UpdatePage.tsx @@ -72,12 +72,11 @@ export function UpdatePage({ category, onUpdate, onBack }: Props): VNode { .then((res) => { return res.type === "fail" ? undefined - : { id: String(prod), description: res.body.description }; + : { id: String(prod.product_id), description: res.body.description }; }); }); Promise.all(ps).then((all) => { const product_map = all.filter(notEmpty); - console.log(product_map); setState({ ...state, product_map }); }); }, []); diff --git a/packages/taler-util/src/types-taler-merchant.ts b/packages/taler-util/src/types-taler-merchant.ts @@ -1492,11 +1492,6 @@ export interface ProductSummary { // Product ID to use. product_id: string; - // Human-readable product description. - // description: string; - - // Map from IETF BCP 47 language tags to localized descriptions. - // description_i18n?: { [lang_tag: string]: string }; } export interface CategoryCreateRequest { diff --git a/packages/taler-wallet-webextension/src/wallet/DestinationSelection/state.ts b/packages/taler-wallet-webextension/src/wallet/DestinationSelection/state.ts @@ -17,11 +17,10 @@ import { AmountJson, Amounts, - ExchangeEntryStatus, ExchangeUpdateStatus, ScopeType, parseScopeInfoShort, - stringifyScopeInfoShort, + stringifyScopeInfoShort } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useTranslationContext } from "@gnu-taler/web-util/browser";