From f25d43439498fe09cfa76763bdf8a329aa8fc313 Mon Sep 17 00:00:00 2001 From: aeddaqqa Date: Fri, 20 Sep 2024 04:47:32 +0100 Subject: [PATCH] fix(partnerConfig): add alerts for estimating creation of CMAccount & fix matching with fresh accounts --- src/components/Alert.tsx | 30 +++++++++++++++++++--- src/helpers/useSmartContract.tsx | 3 --- src/redux/services/partners.ts | 2 +- src/views/partners/ConfigurSupplier.tsx | 1 - src/views/partners/Configuration.tsx | 19 +++++++++++++- src/views/partners/MyMessenger.tsx | 33 +++++++++++++++++++++++-- src/views/partners/Partner.tsx | 8 +++--- 7 files changed, 81 insertions(+), 15 deletions(-) diff --git a/src/components/Alert.tsx b/src/components/Alert.tsx index c2f315dc..6d8f5166 100644 --- a/src/components/Alert.tsx +++ b/src/components/Alert.tsx @@ -1,14 +1,16 @@ -import { Box, Typography } from '@mui/material' +import { Box, SxProps, Typography } from '@mui/material' import React from 'react' const Alert = ({ variant, title, content, + sx, }: { - variant: 'info' | 'negative' + variant: 'info' | 'negative' | 'warning' title?: string content: string + sx?: SxProps }) => { return ( @@ -55,6 +66,17 @@ const Alert = ({ /> )} + {variant === 'warning' && ( + + + + )} {title && ( diff --git a/src/helpers/useSmartContract.tsx b/src/helpers/useSmartContract.tsx index 8987e344..8a03a4c8 100644 --- a/src/helpers/useSmartContract.tsx +++ b/src/helpers/useSmartContract.tsx @@ -126,9 +126,6 @@ export const SmartContractProvider: React.FC = ({ ch ) setProvider(ethersProvider) setManagerReadContract(managerReadOnlyContract) - // const allCMAccounts = await getCMAccountMappings() - // let result = allCMAccounts.getAllMappings() - // console.log(result) } catch (error) { console.error('User denied account access:', error) } diff --git a/src/redux/services/partners.ts b/src/redux/services/partners.ts index c188ef67..3a91d3d7 100644 --- a/src/redux/services/partners.ts +++ b/src/redux/services/partners.ts @@ -93,7 +93,7 @@ async function getContractMappings(): Promise> { function checkMatch(data): boolean { if (data.supportedResult.length === 0 && data.wantedResult.length === 0) { - return true + return false } const supportedResultSet = new Set(data.supportedResult.map(getServiceName)) diff --git a/src/views/partners/ConfigurSupplier.tsx b/src/views/partners/ConfigurSupplier.tsx index 7fbefad2..4c8ba5dc 100644 --- a/src/views/partners/ConfigurSupplier.tsx +++ b/src/views/partners/ConfigurSupplier.tsx @@ -294,7 +294,6 @@ export const BasicSupportedServices = () => { }) useEffect(() => { if (partner) { - console.log({ supportedServices: partner.supportedServices }) dispatchSupplierState({ type: actionTypes.UPDATE_SUPPORTED_SERVICES, payload: { services: partner.supportedServices, reset: true }, diff --git a/src/views/partners/Configuration.tsx b/src/views/partners/Configuration.tsx index 7d65ab45..a6079b87 100644 --- a/src/views/partners/Configuration.tsx +++ b/src/views/partners/Configuration.tsx @@ -29,12 +29,14 @@ const Content = () => { const { state, dispatch } = usePartnerConfigurationContext() const [loading, setLoading] = useState(false) const partnerConfig = usePartnerConfig() + async function submit() { setLoading(true) await partnerConfig.CreateConfiguration(state) setLoading(false) } const { balance } = useWalletBalance() + if (contractCMAccountAddress) return return ( { )} - + Create Configuration + + + {state.step === 0 && ( diff --git a/src/views/partners/MyMessenger.tsx b/src/views/partners/MyMessenger.tsx index 92364f6d..af855e53 100644 --- a/src/views/partners/MyMessenger.tsx +++ b/src/views/partners/MyMessenger.tsx @@ -454,7 +454,11 @@ const MyMessenger = () => { Offered Services - {getServicesNames(state.stepsConfig[1]?.services)} + {state.stepsConfig[1]?.services.length > 0 ? ( + getServicesNames(state.stepsConfig[1]?.services) + ) : ( + <>None + )} @@ -462,7 +466,11 @@ const MyMessenger = () => { Wanted Services - {getServicesNames(state.stepsConfig[2]?.services)} + {state.stepsConfig[2]?.services.length > 0 ? ( + getServicesNames(state.stepsConfig[2]?.services) + ) : ( + <>None + )} {/* { )} + {state.stepsConfig[1]?.services.length == 0 && ( + + )} + {state.stepsConfig[2]?.services.length == 0 && ( + + )} + {bots.length == 0 && ( + + )} - None. - +
  • + + None. + +
  • )} ) : (