Skip to content

Commit

Permalink
Add onboarding functionality and UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Nov 28, 2024
1 parent 86cf627 commit 4c08770
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 37 deletions.
4 changes: 2 additions & 2 deletions centrifuge-app/src/components/Menu/IssuerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,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" />
) : (
<IconChevronRight size={['iconMedium', 'iconMedium', 'iconSmall']} />
<IconChevronRight size={['iconMedium', 'iconMedium', 'iconSmall']} color="white" />
))}
</Toggle>

Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/Menu/Toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Toggle = styled(Text)<{ isActive?: boolean; stacked?: boolean }>`
width: 100%;
grid-template-columns: ${({ stacked, theme }) =>
stacked ? '1fr' : `${theme.sizes.iconSmall}px 1fr ${theme.sizes.iconSmall}px`};
color: ${({ isActive, theme }) => (isActive ? theme.colors.textGold : theme.colors.textInverted)};
color: ${({ theme }) => theme.colors.textInverted};
border-radius: 4px;
background-color: ${({ isActive }) => (isActive ? LIGHT_BACKGROUND : 'transparent')};
Expand Down
4 changes: 4 additions & 0 deletions centrifuge-app/src/components/Menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const StyledRouterLinkButton = styled(RouterLinkButton)`
background-color: ${COLOR};
color: white;
}
&:active {
border-color: transparent;
}
}
`

Expand Down
100 changes: 68 additions & 32 deletions centrifuge-app/src/pages/IssuerCreatePool/PoolSetupSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ const FEE_TYPES = [

const FEE_POSISTIONS = [{ label: 'Top of waterfall', value: 'Top of waterfall' }]

const TaxDocument = () => {
const form = useFormikContext<PoolMetadataInput>()

return (
<Box mt={2}>
<Text variant="heading4">Tax document requirement</Text>

<Field name="onboarding">
{({ field }: FieldProps) => (
<Checkbox
{...field}
label="Require investors to upload tax documents before signing the subscription agreement."
variant="square"
onChange={(val) => form.setFieldValue('onboarding.taxInfoRequired', val.target.checked ? true : false)}
/>
)}
</Field>
</Box>
)
}

export const PoolSetupSection = () => {
const theme = useTheme()
const form = useFormikContext<PoolMetadataInput>()
Expand Down Expand Up @@ -327,39 +348,54 @@ export const PoolSetupSection = () => {
</Box>
{values.onboardingExperience === 'centrifuge' && (
<Box>
<FieldArray name="tranches">
{({ form }) => (
<Box>
{values.tranches.map((tranche, index) => (
<Field key={index} name={`subscriptionDocuments[${index}]`}>
{({ field, meta }: FieldProps) => (
<Box mb={4}>
<FileUpload
name={`subscriptionDocuments[${index}]`}
file={field.value}
onFileChange={async (file) => {
form.setFieldTouched(`subscriptionDocuments[${index}]`, true, false)
form.setFieldValue(`subscriptionDocuments[${index}]`, file)
}}
label={`Subscription document for ${tranche.tokenName}`}
errorMessage={meta.touched && meta.error ? meta.error : undefined}
accept="application/pdf"
small
/>
</Box>
)}
</Field>
))}
</Box>
)}
</FieldArray>
<Box mt={8}>
<Text variant="heading4">Tax document requirement</Text>
<Checkbox
label="Require investors to upload tax documents before signing the subscription agreement."
variant="square"
/>
<Box>
{values.tranches.map((tranche, index) => (
<Field key={index} name={`onboarding.tranches.${tranche.tokenName}`}>
{({ field, meta }: FieldProps) => (
<Box mb={4}>
<FileUpload
name={`onboarding.${tranche.tokenName}`}
file={field.value}
onFileChange={async (file) => {
form.setFieldTouched(`onboarding.tranches.${tranche.tokenName}`, true, false)
form.setFieldValue(`onboarding.tranches.${tranche.tokenName}`, file)
}}
label={`Subscription document for ${tranche.tokenName}`}
errorMessage={meta.touched && meta.error ? meta.error : undefined}
accept="application/pdf"
small
/>
</Box>
)}
</Field>
))}
</Box>
<TaxDocument />
</Box>
)}
{values.onboardingExperience === 'external' && (
<Box>
{values.tranches.map((tranche, index) => (
<Field key={index} name={`onboarding.tranches.${tranche.tokenName}`}>
{({ field, meta }: FieldProps) => (
<Box mb={4}>
<FieldWithErrorMessage
{...field}
as={TextInput}
name={`onboarding.tranches.${tranche.tokenName}`}
value={field.value}
label={<Text variant="heading4">Onboarding URL {tranche.tokenName}</Text>}
isUrl
placeholder="www.example.com"
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
form.setFieldValue(`onboarding.tranches.${tranche.tokenName}`, e.target.value)
}
/>
</Box>
)}
</Field>
))}
<TaxDocument />
</Box>
)}
</StyledGrid>
Expand Down
13 changes: 12 additions & 1 deletion centrifuge-app/src/pages/IssuerCreatePool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ const IssuerCreatePoolPage = () => {
return {
trancheType,
metadata: {
tokenName: tranche.tokenName,
tokenName:
metadataValues.tranches.length > 1 ? `${metadataValues.poolName} ${tranche.tokenName}` : 'Junior',
tokenSymbol: tranche.symbolName,
},
}
Expand Down Expand Up @@ -313,6 +314,16 @@ const IssuerCreatePoolPage = () => {
addMultisig(metadataValues.adminMultisig)
}

// Onboarding
if (metadataValues.onboardingExperience === 'none') {
metadataValues.onboarding = {
taxInfoRequired: metadataValues.onboarding?.taxInfoRequired,
tranches: {},
}
}

console.log(metadataValues)

// createProxies([
// (aoProxy, adminProxy) => {
// createPoolTx(
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/icon-svg/icon-chevron-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4c08770

Please sign in to comment.