From f50157964473a9bf9dba85f456eda03c516a8210 Mon Sep 17 00:00:00 2001 From: Katja Lutz Date: Tue, 18 Oct 2022 14:38:09 +0200 Subject: [PATCH] feat: implement apply bank address buttons --- src/components/Address.tsx | 8 ++++++ src/components/Settings/Overlay.tsx | 42 +++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/components/Address.tsx b/src/components/Address.tsx index 22b1db6..bad9606 100644 --- a/src/components/Address.tsx +++ b/src/components/Address.tsx @@ -71,4 +71,12 @@ const Address: Component<{ address: PostalAddressData }> = (props) => ( ); +export const applyAddress = (target: AddressData, values: AddressData) => { + target.name = values.name; + target.line1 = values.line1; + target.line2 = values.line2; + target.zip = values.zip; + target.city = values.city; +}; + export default Address; diff --git a/src/components/Settings/Overlay.tsx b/src/components/Settings/Overlay.tsx index 91f4d7b..f61b335 100644 --- a/src/components/Settings/Overlay.tsx +++ b/src/components/Settings/Overlay.tsx @@ -12,7 +12,7 @@ import { onCleanup, mergeProps, } from "solid-js"; -import { createStore, reconcile, unwrap } from "solid-js/store"; +import { createStore, produce, reconcile, unwrap } from "solid-js/store"; import { format, fromUnixTime, getUnixTime } from "date-fns"; import z from "myzod"; import Big from "big.js"; @@ -52,7 +52,11 @@ import { storeSchema, UiStoreContext, } from "~/stores"; -import { isStructuredAddress, PostalAddressData } from "../Address"; +import { + applyAddress, + isStructuredAddress, + PostalAddressData, +} from "../Address"; import PositionsIcon from "~icons/carbon/show-data-cards"; import YouIcon from "~icons/carbon/face-wink"; import DesignIcon from "~icons/carbon/paint-brush"; @@ -603,6 +607,23 @@ const SettingsOverlay: Component = () => { }} address={() => localState.customAddress} /> +
+ +
@@ -727,6 +748,23 @@ const SettingsOverlay: Component = () => { setter={createCustomerAddressSetter(true)} address={() => state.customer.alternativeAddress} /> +
+ +