-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(partnerConfig): adjustment of styling and text modifications
- Loading branch information
Showing
12 changed files
with
575 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,94 @@ | ||
import { InputAdornment, OutlinedInput, Typography } from '@mui/material' | ||
import React, { useMemo } from 'react' | ||
import { actionTypes, usePartnerConfigurationContext } from '../helpers/partnerConfigurationContext' | ||
import useWalletBalance from '../helpers/useWalletBalance' | ||
|
||
const Input = ({ ...rest }) => { | ||
const { state, dispatch } = usePartnerConfigurationContext() | ||
const error = useMemo(() => { | ||
if (!state.balance) return true | ||
let balance = parseFloat(state.balance) | ||
return balance < 100 | ||
}, [state]) | ||
|
||
const { balance: maxBalance } = useWalletBalance() | ||
const handleChange = e => { | ||
const newAmount = e.target.value | ||
if (newAmount === '' || /^\d*\.?\d*$/.test(newAmount)) { | ||
dispatch({ | ||
type: actionTypes.UPDATE_BALANCE, | ||
payload: { | ||
newValue: e.target.value, | ||
newValue: newAmount, | ||
}, | ||
}) | ||
} | ||
} | ||
const error = useMemo(() => { | ||
if (!state.balance) return true | ||
let balance = parseFloat(state.balance) | ||
return balance < 100 || balance > parseFloat(maxBalance) - 0.5 | ||
}, [state, maxBalance]) | ||
|
||
return ( | ||
<OutlinedInput | ||
value={state.balance} | ||
onChange={handleChange} | ||
error={error} | ||
inputProps={{ | ||
inputMode: 'decimal', | ||
pattern: '[0-9]*', | ||
}} | ||
startAdornment={ | ||
<InputAdornment | ||
position="start" | ||
sx={{ | ||
width: 'fit-content', | ||
color: theme => theme.palette.text.primary, | ||
}} | ||
> | ||
<Typography variant="body2">Prefund Amount:</Typography> | ||
</InputAdornment> | ||
} | ||
endAdornment={ | ||
error ? ( | ||
<InputAdornment position="end" sx={{ width: 'fit-content' }}> | ||
<svg | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M12 2C17.53 2 22 6.47 22 12C22 17.53 17.53 22 12 22C6.47 22 2 17.53 2 12C2 6.47 6.47 2 12 2ZM15.59 7L12 10.59L8.41 7L7 8.41L10.59 12L7 15.59L8.41 17L12 13.41L15.59 17L17 15.59L13.41 12L17 8.41L15.59 7Z" | ||
fill="#E5431F" | ||
/> | ||
</svg> | ||
</InputAdornment> | ||
) : ( | ||
<InputAdornment position="end" sx={{ width: 'fit-content' }}> | ||
<svg | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M12 2C6.5 2 2 6.5 2 12C2 17.5 6.5 22 12 22C17.5 22 22 17.5 22 12C22 6.5 17.5 2 12 2ZM10 17L5 12L6.41 10.59L10 14.17L17.59 6.58L19 8L10 17Z" | ||
fill="#18B728" | ||
/> | ||
</svg> | ||
<> | ||
<OutlinedInput | ||
value={state.balance} | ||
onChange={handleChange} | ||
error={error} | ||
inputProps={{ | ||
inputMode: 'decimal', | ||
pattern: '[0-9]*', | ||
}} | ||
startAdornment={ | ||
<InputAdornment | ||
position="start" | ||
sx={{ | ||
width: 'fit-content', | ||
color: theme => theme.palette.text.primary, | ||
}} | ||
> | ||
<Typography variant="body2">Prefund Amount:</Typography> | ||
</InputAdornment> | ||
) | ||
} | ||
{...rest} | ||
/> | ||
} | ||
endAdornment={ | ||
error ? ( | ||
<InputAdornment position="end" sx={{ width: 'fit-content' }}> | ||
<svg | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M12 2C17.53 2 22 6.47 22 12C22 17.53 17.53 22 12 22C6.47 22 2 17.53 2 12C2 6.47 6.47 2 12 2ZM15.59 7L12 10.59L8.41 7L7 8.41L10.59 12L7 15.59L8.41 17L12 13.41L15.59 17L17 15.59L13.41 12L17 8.41L15.59 7Z" | ||
fill="#E5431F" | ||
/> | ||
</svg> | ||
</InputAdornment> | ||
) : ( | ||
<InputAdornment position="end" sx={{ width: 'fit-content' }}> | ||
<svg | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M12 2C6.5 2 2 6.5 2 12C2 17.5 6.5 22 12 22C17.5 22 22 17.5 22 12C22 6.5 17.5 2 12 2ZM10 17L5 12L6.41 10.59L10 14.17L17.59 6.58L19 8L10 17Z" | ||
fill="#18B728" | ||
/> | ||
</svg> | ||
</InputAdornment> | ||
) | ||
} | ||
{...rest} | ||
/> | ||
{error && ( | ||
<Typography variant="caption" color="error"> | ||
{parseFloat(state.balance) < 100 || !state.balance || state.balance === '0' | ||
? 'Balance must be at least 100' | ||
: `Balance cannot exceed ${parseFloat(maxBalance) - 0.5}`} | ||
</Typography> | ||
)} | ||
</> | ||
) | ||
} | ||
|
||
export default Input | ||
//8 279.81669975 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import { Box, Link, Toolbar, Typography } from '@mui/material' | ||
import { Box, Button, Link, Toolbar, Typography } from '@mui/material' | ||
|
||
import { Paper } from '@mui/material' | ||
import { ethers } from 'ethers' | ||
import React, { useEffect } from 'react' | ||
import { Navigate, Outlet, useNavigate, useParams } from 'react-router' | ||
import store from 'wallet/store' | ||
import CMAccount from '../helpers/CMAccountManagerModule#CMAccount.json' | ||
import { PartnerConfigurationProvider } from '../helpers/partnerConfigurationContext' | ||
import { SmartContractProvider } from '../helpers/useSmartContract' | ||
import { useAppSelector } from '../hooks/reduxHooks' | ||
|
@@ -15,6 +13,15 @@ import { getActiveNetwork } from '../redux/slices/network' | |
import Links from '../views/settings/Links' | ||
|
||
const ClaimProfile = () => { | ||
const generateEmail = () => { | ||
const subject = 'Claim a Partner' | ||
const body = `This is to claim a Partner record and associate it to the wallet with C-Chain address .Please add your name, contact details, the Partner name, and attach any evidence of your affiliation with the Partner.` | ||
|
||
const mailtoLink = `mailto:${emailAddress}?subject=${encodeURIComponent( | ||
subject, | ||
)}&body=${encodeURIComponent(body)}` | ||
window.location.href = mailtoLink | ||
} | ||
const emailAddress = '[email protected]' | ||
return ( | ||
<Box | ||
|
@@ -29,36 +36,31 @@ const ClaimProfile = () => { | |
> | ||
<Typography variant="h5">Claim a profile</Typography> | ||
<Typography variant="body2" textAlign={'center'}> | ||
To manage and configure your Camino Messenger, you need to claim an account. | ||
To manage and configure your Camino Messenger, you need to claim a Partner record | ||
first. | ||
</Typography> | ||
<Typography variant="body2" textAlign={'center'}> | ||
Contact the Camino Network Foundation via{' '} | ||
<Link href={`mailto:${emailAddress}`} target="_blank" rel="noopener noreferrer"> | ||
</Link>{' '} | ||
Contact the Camino Network Foundation via <Link onClick={generateEmail}>email</Link>{' '} | ||
to proceed. | ||
</Typography> | ||
<Button | ||
onClick={generateEmail} | ||
sx={{ | ||
padding: '10px 16px', | ||
borderRadius: '8px', | ||
background: 'linear-gradient(90deg, #0085FF 0%, #B440FC 100%)', | ||
backgroundColor: theme => | ||
theme.palette.mode === 'dark' ? '#020617' : '#F1F5F9', | ||
}} | ||
> | ||
<Typography fontSize={14} fontWeight={600} lineHeight={'20px'}> | ||
Contact | ||
</Typography> | ||
</Button> | ||
</Box> | ||
) | ||
} | ||
|
||
// Function to create a contract instance | ||
function getPartnerContract(address, provider) { | ||
return new ethers.Contract(address, CMAccount, provider) | ||
} | ||
|
||
// Main function to get services from multiple partner contracts | ||
// async function getPartnerServices(partnerAddresses: string[], providerUrl: string) { | ||
// const provider = new ethers.JsonRpcProvider(providerUrl) | ||
// for (const address of partnerAddresses) { | ||
// const contract = getPartnerContract(address, provider) | ||
// try { | ||
// const result = await contract.getSupportedServices() | ||
// console.log(result) | ||
// } catch (error) {} | ||
// } | ||
// } | ||
|
||
const PartnersLayout = () => { | ||
const path = window.location.pathname | ||
const { data, isLoading } = useIsPartnerQuery({ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.