From 2ad681ade151abf4a64581a63d32fe9d2c4153ca Mon Sep 17 00:00:00 2001 From: BuzzLightyear <11892559+swift1337@users.noreply.github.com> Date: Tue, 25 Jul 2023 18:18:04 +0300 Subject: [PATCH] Re-apply links fix (#17) --- .../src/components/link-input/link-input.tsx | 24 ++++++++++--------- .../merchant-form/merchant-form.tsx | 8 +------ .../webhook-settings-form.tsx | 2 +- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/ui-dashboard/src/components/link-input/link-input.tsx b/ui-dashboard/src/components/link-input/link-input.tsx index 724afc8..bfe5f64 100644 --- a/ui-dashboard/src/components/link-input/link-input.tsx +++ b/ui-dashboard/src/components/link-input/link-input.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import {Form, Select, Space, FormRule, Input} from "antd"; +import {Form, Select, FormRule, Input} from "antd"; interface Props { placeholder: string; @@ -44,16 +44,18 @@ const LinkInput: React.FC = (props: Props) => { style={{width: 300}} required={props.required} > - - - + + } + placeholder={props.placeholder} + /> ); }; diff --git a/ui-dashboard/src/components/merchant-form/merchant-form.tsx b/ui-dashboard/src/components/merchant-form/merchant-form.tsx index f3ac926..ad155db 100644 --- a/ui-dashboard/src/components/merchant-form/merchant-form.tsx +++ b/ui-dashboard/src/components/merchant-form/merchant-form.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import {useMount} from "react-use"; import {Form, Input, Button, Space, FormInstance} from "antd"; import {Merchant, MerchantBase} from "src/types"; import {sleep} from "src/utils"; @@ -17,14 +16,9 @@ const linkPrefix = "https://"; const MerchantForm: React.FC = (props: Props) => { const [form] = Form.useForm(); - useMount(() => { - if (props.activeMerchant) { - form.setFieldsValue(props.activeMerchant); - } - }); - React.useEffect(() => { if (props.activeMerchant) { + props.activeMerchant.website = props.activeMerchant.website.slice(8); form.setFieldsValue(props.activeMerchant); } }, [props.activeMerchant]); diff --git a/ui-dashboard/src/components/webhook-settings-form/webhook-settings-form.tsx b/ui-dashboard/src/components/webhook-settings-form/webhook-settings-form.tsx index 8257228..5d1d503 100644 --- a/ui-dashboard/src/components/webhook-settings-form/webhook-settings-form.tsx +++ b/ui-dashboard/src/components/webhook-settings-form/webhook-settings-form.tsx @@ -18,7 +18,7 @@ const WebhookSettingsForm: React.FC = (props: Props) => { React.useEffect(() => { if (props.webhookSettings) { - form.setFieldsValue(props.webhookSettings); + form.setFieldsValue({...props.webhookSettings, url: props.webhookSettings.url.slice(8)}); } }, [props.webhookSettings]);