Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Nov 27, 2024
1 parent 0fc1b20 commit bc166db
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
18 changes: 10 additions & 8 deletions centrifuge-app/src/pages/IssuerCreatePool/PoolSetupSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const PoolSetupSection = () => {
const form = useFormikContext<PoolMetadataInput>()
const { values } = form

console.log(values)

return (
<Box>
<Text variant="heading2" fontWeight={700}>
Expand Down Expand Up @@ -88,7 +90,7 @@ export const PoolSetupSection = () => {
<Box display="flex" justifyContent="flex-end" mt={2}>
<AddButton
onClick={() => {
if (form.values.adminMultisig && form.values.adminMultisig.signers?.length <= 10) {
if (values.adminMultisig && values.adminMultisig.signers?.length <= 10) {
push('')
}
}}
Expand All @@ -115,7 +117,7 @@ export const PoolSetupSection = () => {
onBlur={field.onBlur}
errorMessage={meta.touched && meta.error ? meta.error : undefined}
value={field.value}
options={form.values.adminMultisig.signers.map((_: string, i: number) => ({
options={values.adminMultisig.signers.map((_: string, i: number) => ({
label: i + 1,
value: i + 1,
}))}
Expand All @@ -142,7 +144,7 @@ export const PoolSetupSection = () => {
Add or remove addresses that can:
</Text>
<Text variant="heading2">Originate assets and invest in the pool*</Text>
{form.values.assetOriginators?.map((_: string, index: number) => (
{values.assetOriginators?.map((_: string, index: number) => (
<Box key={index} mt={2}>
<Field name={`assetOriginators.${index}`}>
{({ field }: FieldProps) => <TextInput placeholder="Type address..." {...field} />}
Expand All @@ -154,7 +156,7 @@ export const PoolSetupSection = () => {
<Box gridColumn="2 / span 1" alignSelf="end">
<AddButton
onClick={() => {
if (form.values.adminMultisig && form.values.adminMultisig.signers?.length <= 10) {
if (values.adminMultisig && values.adminMultisig.signers?.length <= 10) {
push('')
}
}}
Expand Down Expand Up @@ -207,12 +209,12 @@ export const PoolSetupSection = () => {
<FieldArray name="poolFees">
{({ push, remove }) => (
<>
{form.values.poolFees.map((_, index) => (
{values.poolFees.map((_, index) => (
<Box mt={4} mb={3} key={index}>
<StyledGrid mt={3} gap={1}>
<Box display="flex" justifyContent="space-between" alignItems="center">
<Text variant="heading3">Pool fees {index + 1}</Text>
{form.values.poolFees.length > 1 && (
{values.poolFees.length > 1 && (
<IconButton onClick={() => remove(index)}>
<IconTrash color="textSecondary" />
</IconButton>
Expand Down Expand Up @@ -330,7 +332,7 @@ export const PoolSetupSection = () => {
<FieldArray name="tranches">
{({ form }) => (
<Box>
{form.values.tranches.map((tranche, index) => (
{values.tranches.map((tranche, index) => (
<Field key={index} name={`subscriptionDocuments[${index}]`}>
{({ field, meta }: FieldProps) => (
<Box mb={4}>
Expand All @@ -341,7 +343,7 @@ export const PoolSetupSection = () => {
form.setFieldTouched(`subscriptionDocuments[${index}]`, true, false)
form.setFieldValue(`subscriptionDocuments[${index}]`, file)
}}
label={`Subscription document for ${tranche.trancheName}`}
label={`Subscription document for ${tranche.tokenName}`}
errorMessage={meta.touched && meta.error ? meta.error : undefined}
accept="application/pdf"
small
Expand Down
33 changes: 31 additions & 2 deletions centrifuge-app/src/pages/IssuerCreatePool/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PoolMetadataInput } from '@centrifuge/centrifuge-js'
import { FeeTypes, PoolMetadataInput } from '@centrifuge/centrifuge-js'
import { isTestEnv } from '../../config'

export interface Tranche {
Expand Down Expand Up @@ -33,11 +33,40 @@ export const createPoolFee = () => ({
walletAddress: '',
})

export type CreatePoolValues = Omit<PoolMetadataInput, 'adminMultisig'> & {
export type CreatePoolValues = Omit<
PoolMetadataInput,
'poolIcon' | 'issuerLogo' | 'executiveSummary' | 'adminMultisig' | 'poolFees' | 'poolReport' | 'poolRatings'
> & {
// pool structure
assetDenomination: string

// pool details
issuerCategories: { type: string; value: string }[]
poolIcon: File
issuerLogo: File
executiveSummary: File

reportAuthorName: string
reportAuthorTitle: string
reportAuthorAvatar: File | null
reportUrl: string
adminMultisigEnabled: boolean
adminMultisig: Exclude<PoolMetadataInput['adminMultisig'], undefined>
poolFees: {
id?: number
name: string
feeType: FeeTypes
percentOfNav: number | ''
walletAddress: string
feePosition: 'Top of waterfall'
category: string
}[]
poolRatings: {
agency?: string
value?: string
reportUrl?: string
reportFile?: File | null
}[]
}

export const initialValues: CreatePoolValues = {
Expand Down

0 comments on commit bc166db

Please sign in to comment.