-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create pool redesign - feature branch #2537
base: main
Are you sure you want to change the base?
Conversation
PR deployed in Google Cloud |
PR deployed in Google Cloud |
c962a38
to
4d6c428
Compare
45db2a9
to
19988cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing to see this come together so nicely 🔥
There are a few comments from me and a few from the github bot that are probably worth fixing.
- Here, I'm wondering what the wallet address is for this input? Would that be the pool admin?
- If single is selected, I think we should hide the threshold section underneath.
- The address (single and multisig) should be validated like the rest of the address inputs and show a red error message if it doesn't match
Lastly, I tried to create a pool and it failed with this error message:
Error: createType(Call):: Call: failed decoding poolRegistry.register:: Struct: failed on args: {"admin":"AccountId32","pool_id":"u64","tranche_inputs":"Vec<PalletPoolSystemTranchesTrancheInput>","currency":"{\"_enum\":{\"Native\":\"Null\",\"Tranche\":\"(u64,[u8;16])\",\"__Unused2\":\"Null\",\"AUSD\":\"Null\",\"ForeignAsset\":\"u32\",\"Staking\":\"CfgTypesTokensStakingCurrency\",\"LocalAsset\":\"u32\"}}","max_reserve":"u128","metadata":"Option<Bytes>","write_off_policy":"Vec<PalletLoansPolicyWriteOffRule>","pool_fees":"Vec<(CfgTraitsFeePoolFeeBucket,CfgTypesPoolsPoolFeeInfo)>"}:: Struct: failed on pool_fees: Vec<(CfgTraitsFeePoolFeeBucket,CfgTypesPoolsPoolFeeInfo)>:: Tuple: failed on 1:: Struct: failed on feeType: {"_enum":{"Fixed":"{\"limit\":\"CfgTypesPoolsPoolFeeAmount\"}","ChargedUpTo":"{\"limit\":\"CfgTypesPoolsPoolFeeAmount\"}"}}:: Cannot map Enum JSON, unable to find '' in fixed, chargedupto
I think it should be an easy fix but I'm happy to help you debug tomorrow!
fabric/src/theme/tokens/theme.ts
Outdated
@@ -17,7 +17,7 @@ const statusPromoteBg = '#f8107114' | |||
const colors = { | |||
textPrimary: grayScale[800], | |||
textSecondary: grayScale[500], | |||
textDisabled: grayScale[300], | |||
textDisabled: '#6A7280', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to adjust a value in the grayScale
instead of defining a new one?
) | ||
|
||
const ratings = values.poolRatings.map((rating, index) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be removed
form.setFieldValue(field.name, event.target.value) | ||
} | ||
return props.isUrl ? ( | ||
<URLInput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like the wrong place for this. Also don't think it's needed. You should be able to use the URLInput
as a prop to FieldWithErrorMessage
:
<FieldWithErrorMessage
name="website"
as={URLInput}
label="Website URL"
placeholder="www.example.com"
validate={validate.websiteNotRequired()}
/>
const [, , , , poolId] = args | ||
if (createType === 'immediate') { | ||
setCreatedPoolId(poolId) | ||
navigate(`/pools/${poolId}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should stay in the useEffect like it was before. The data for the newly created pool won't always be immediately loaded, so it should wait for the data of the new pool before navigating to it.
@@ -208,6 +208,7 @@ function AOForm({ | |||
}), | |||
newMetadata ? cent.pools.setMetadata([poolId, newMetadata], { batch: true }) : of(null), | |||
]).pipe( | |||
// THIS IS WHERE PROXIES ARE BEING CREATED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be removed
label, | ||
errorMessage, | ||
extendedClickArea, | ||
variant = 'round', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make sense, checkboxes should always be square. For single choice inputs, you can use RadioButton
2f39697
to
17d3fde
Compare
@@ -279,6 +279,7 @@ export function LoanList({ loans, snapshots }: Props) { | |||
</Text> | |||
} | |||
onChange={(e) => setShowRepaid(!showRepaid)} | |||
variant="square" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prop no longer needed
@@ -56,9 +62,9 @@ export function IssuerMenu({ defaultOpen = false, children }: IssuerMenuProps) { | |||
Issuer | |||
{isLarge && | |||
(open ? ( | |||
<IconChevronDown size={['iconMedium', 'iconMedium', 'iconSmall']} /> | |||
<IconChevronDown size={['iconMedium', 'iconMedium', 'iconSmall']} color="white" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<IconChevronDown size={['iconMedium', 'iconMedium', 'iconSmall']} color="white" /> | |
<IconChevronDown size={['iconMedium', 'iconMedium', 'iconSmall']} color="textInverted" /> |
), | ||
multisigAddr | ||
? api.tx.multisig.asMulti(adminMultisig.threshold, otherMultisigSigners, null, proxiedPoolCreate, 0) | ||
: proxiedPoolCreate, | ||
].filter(Boolean) | ||
) | ||
setMultisigData({ callData: proxiedPoolCreate.method.toHex(), hash: proxiedPoolCreate.method.hash.toHex() }) | ||
return cent.wrapSignAndSend(api, submittable, { ...options, multisig: undefined, proxies: undefined }) | ||
return cent.wrapSignAndSend(api, submittable, { ...options }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was multisig: undefined, proxies: undefined
removed? That should likely remain
} | ||
|
||
export const pinFileIfExists = async (centrifuge: ReturnType<typeof useCentrifuge>, file: File | null) => | ||
file ? pinFile(centrifuge, file) : Promise.resolve(null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file ? pinFile(centrifuge, file) : Promise.resolve(null) | |
file ? pinFile(centrifuge, file) : null |
return { uri: pinned.uri, mime: file.type } | ||
} | ||
|
||
export const pinFileIfExists = async (centrifuge: ReturnType<typeof useCentrifuge>, file: File | null) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Centrifuge type can be imported from CentrifugeJS
const { data: loans, isLoading } = useLoans(poolId) | ||
const { isLoading: isLoadingSnapshots, data: snapshots } = useAllPoolAssetSnapshots(poolId, new Date().toString()) | ||
const { data: loans } = useLoans(poolId) | ||
const { data: snapshots } = useAllPoolAssetSnapshots(poolId, new Date().toString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { data: snapshots } = useAllPoolAssetSnapshots(poolId, new Date().toString()) | |
const { data: snapshots } = useAllPoolAssetSnapshots(poolId, new Date().toISOString().slice(0, 10)) |
Now this will fetch every render because the date will be different every time
], | ||
options?: TransactionOptions | ||
) { | ||
const [admin, poolId, tranches, currency, maxReserve, metadata, fees] = args | ||
const trancheInput = tranches.map((t, i) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem like the right move to move this responsibility to the client. Was there a reason for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was Sophia's previous feedback. She said it looked messy to have logic in both places, create pool and pool.ts file.
const Spinner = styled(IconSpinner)` | ||
animation: ${rotate} 600ms linear infinite; | ||
` | ||
// const Spinner = styled(IconSpinner)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can just be removed if no longer needed
@@ -18,6 +18,7 @@ export type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & { | |||
errorMessage?: string | |||
small?: boolean | |||
hideBorder?: boolean | |||
activePlaceholder?: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does activePlaceholder
mean? If it's not required to select an option, shouldn't there just be a None
option?
ee0c6d8
to
60e8383
Compare
* Add pool structure UI changes * Small UI fix * Avoid deletion on entries if less than one * Add logic to single / multi sign * Fix linter errors
* Fix ts error and change logic for onboarding values * Add create pool existing functionality * Cleanup types * cleanup * Add deposit banner * Fix linter errors * Add metadata values * Cleanup types * Add onboarding functionality and UI fixes * Add proxies functionality * Fix ts errors * Add create pool dialog * Add dialogs * Add review feedback * wip * Add waiting before redirecting to avoid error * Remove default empty pool fee
* Bug fixes and add proposal link * Fix ratings creating empty value
Co-authored-by: Sophia <[email protected]>
Co-authored-by: Sophia <[email protected]>
Co-authored-by: Sophia <[email protected]>
APY should be based on junior token
Co-authored-by: Onno Visser <[email protected]>
Co-authored-by: Onno Visser <[email protected]>
Co-authored-by: Onno Visser <[email protected]>
e9fba46
to
12542b9
Compare
Create pool redesign
https://www.figma.com/design/ng7qdNcSCXSDA6ZUdWIs6u/Pool-Overview%2F-Pool-Detail?node-id=4137-4180&node-type=section&m=dev
#2529
Approvals