Skip to content

Commit

Permalink
Pool structure - create pool (#2543)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
kattylucy authored Nov 27, 2024
1 parent 2839263 commit 439ae65
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 170 deletions.
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/PoolCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export function PoolCard({
}
})
.reverse()
}, [isTinlakePool, metaData?.tranches, tinlakeKey, tranches])
}, [isTinlakePool, metaData?.tranches, tinlakeKey, tranches, createdAt, poolId])

return (
<RouterTextLink to={`${poolId}`} style={{ textDecoration: 'none' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ export const TrancheTokenCards = ({
return 'mezzanine'
}

const getTarget = (tranche: Token) =>
(isTinlakePool && tranche.seniority === 0) || poolId === DYF_POOL_ID || poolId === NS3_POOL_ID

const columns = useMemo(() => {
return [
{
Expand Down Expand Up @@ -121,6 +118,8 @@ export const TrancheTokenCards = ({
}, [pool.tranches, metadata, poolId, pool?.currency.symbol])

const dataTable = useMemo(() => {
const getTarget = (tranche: Token) =>
(isTinlakePool && tranche.seniority === 0) || poolId === DYF_POOL_ID || poolId === NS3_POOL_ID
return trancheTokens.map((tranche) => {
const calculateApy = (trancheToken: Token) => {
if (isTinlakePool && getTrancheText(trancheToken) === 'senior') return formatPercentage(trancheToken.apy)
Expand All @@ -145,7 +144,7 @@ export const TrancheTokenCards = ({
isTarget: getTarget(tranche),
}
})
}, [trancheTokens, getTarget])
}, [trancheTokens, daysSinceCreation, isTinlakePool, poolId])

return (
<Shelf gap={3}>
Expand Down
20 changes: 20 additions & 0 deletions centrifuge-app/src/components/Tooltips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,26 @@ export const tooltipText = {
label: '',
body: 'This pool will have three classes. Senior tranche is the safest tranche with priority in repayment. Mezzanine tranche has intermediate risk and receives payment after Senior tranche obligations are met. Junior tranche which only receives returns after both Senior and Mezzanine tranches are paid.',
},
singleMultisign: {
label: '',
body: 'Setup a wallet where only one private key is required to authorise changes to the pool configuration.',
},
multiMultisign: {
label: '',
body: 'Setup a wallet that requires multiple private keys to authorise changes to the pool configuration.',
},
centrifugeOnboarding: {
label: '',
body: 'Investors will go through the Centrifuge onboarding provider, Shuftipro, before they can invest in your pool.',
},
externalOnboarding: {
label: '',
body: 'You can select the provider you want to KYC/onboard your investors.',
},
noneOnboarding: {
label: '',
body: 'You can directly whitelist the addresses that can invest in the pool.',
},
}

export type TooltipsProps = {
Expand Down
17 changes: 12 additions & 5 deletions centrifuge-app/src/pages/IssuerCreatePool/IssuerCategories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ const PROVIDERS = [
{ label: 'Other', value: 'other' },
]

const LabelWithDeleteButton = ({ onDelete }: { onDelete: () => void }) => {
const LabelWithDeleteButton = ({ onDelete, hideButton }: { onDelete: () => void; hideButton: boolean }) => {
return (
<Box display="flex" justifyContent="space-between" alignItems="center">
<Text variant="heading4">Name of provider</Text>
<IconButton onClick={onDelete}>
<IconTrash color="textSecondary" />
</IconButton>
{!hideButton && (
<IconButton onClick={onDelete}>
<IconTrash color="textSecondary" />
</IconButton>
)}
</Box>
)
}
Expand Down Expand Up @@ -56,7 +58,12 @@ export const IssuerCategoriesSection = () => {
{({ field, meta }: FieldProps) => (
<TextInput
{...field}
label={<LabelWithDeleteButton onDelete={() => remove(index)} />}
label={
<LabelWithDeleteButton
onDelete={() => remove(index)}
hideButton={form.values.issuerCategories.length === 1}
/>
}
placeholder="Type here..."
maxLength={100}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
TextInput,
} from '@centrifuge/fabric'
import { Field, FieldProps, useFormikContext } from 'formik'
import { useTheme } from 'styled-components'
import { FieldWithErrorMessage } from '../../../src/components/FieldWithErrorMessage'
import { Tooltips } from '../../../src/components/Tooltips'
import { isTestEnv } from '../../../src/config'
Expand All @@ -27,7 +26,6 @@ export const AddButton = ({ onClick }: { onClick: () => void }) => (
)

export const PoolDetailsSection = () => {
const theme = useTheme()
const form = useFormikContext<PoolMetadataInput>()
const createLabel = (label: string) => `${label}${isTestEnv ? '' : '*'}`

Expand Down
Loading

0 comments on commit 439ae65

Please sign in to comment.