Skip to content

Commit ce94dfa

Browse files
Dashboard QA Part 2 (#2671)
* Reset selected pools for each page mount * Re-order radio buttons in onboarding settings * Rename multi-sig button label * Fix endless loading on assets page * Add padding to test finance form * Switch out other for external in onboarding experience --------- Co-authored-by: Katty Barroso <51223655+kattylucy@users.noreply.github.com>
1 parent 99d1ac5 commit ce94dfa

10 files changed

Lines changed: 66 additions & 53 deletions

File tree

centrifuge-app/src/components/Dashboard/Investors/OnboardingSettingsDrawer.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function OnboardingSettingsAccordion({
8585
}
8686

8787
type OnboardingFormValues = {
88-
onboardingExperience: 'centrifuge' | 'other' | 'none'
88+
onboardingExperience: 'centrifuge' | 'external' | 'none'
8989
tranches: { [trancheId: string]: { agreement: undefined | File; openForOnboarding: boolean } }
9090
kybRestrictedCountries: { label: string; value: string }[]
9191
kycRestrictedCountries: { label: string; value: string }[]
@@ -115,10 +115,10 @@ function OnboardingSettings({ poolId, onClose }: { poolId: string; onClose: () =
115115
const baseInitialValues = useMemo(
116116
() => ({
117117
onboardingExperience: poolMetadata?.onboarding?.externalOnboardingUrl
118-
? 'other'
118+
? 'external'
119119
: isOpenForOnboarding
120120
? 'centrifuge'
121-
: ('none' as 'centrifuge' | 'other' | 'none'),
121+
: ('none' as 'centrifuge' | 'external' | 'none'),
122122
tranches: (pool.tranches as Token[]).reduce((prevT, currT) => {
123123
const agreementUrl = poolMetadata?.onboarding?.tranches?.[currT.id]?.agreement?.uri
124124
? centrifuge.metadata.parseMetadataUrl(poolMetadata.onboarding.tranches[currT.id].agreement!.uri)
@@ -284,7 +284,7 @@ function OnboardingSettings({ poolId, onClose }: { poolId: string; onClose: () =
284284
tranches: onboardingTranches,
285285
kycRestrictedCountries,
286286
kybRestrictedCountries,
287-
externalOnboardingUrl: values.onboardingExperience === 'other' ? values.externalOnboardingUrl : undefined,
287+
externalOnboardingUrl: values.onboardingExperience === 'external' ? values.externalOnboardingUrl : undefined,
288288
taxInfoRequired: values.taxInfoRequired,
289289
},
290290
}
@@ -367,35 +367,35 @@ function OnboardingSettings({ poolId, onClose }: { poolId: string; onClose: () =
367367
<RadioButton
368368
name="onboardingExperience"
369369
id="onboardingExperience"
370-
border
371370
height={44}
372-
checked={formik.values.onboardingExperience === 'none'}
373-
label="None"
371+
border
372+
checked={formik.values.onboardingExperience === 'external'}
373+
label="External"
374374
onChange={() => {
375-
formik.setFieldValue('onboardingExperience', 'none')
375+
formik.setFieldValue('onboardingExperience', 'external')
376376
}}
377377
/>
378378
<RadioButton
379379
name="onboardingExperience"
380380
id="onboardingExperience"
381-
height={44}
382381
border
383-
checked={formik.values.onboardingExperience === 'other'}
384-
label="Other"
382+
height={44}
383+
checked={formik.values.onboardingExperience === 'none'}
384+
label="None"
385385
onChange={() => {
386-
formik.setFieldValue('onboardingExperience', 'other')
386+
formik.setFieldValue('onboardingExperience', 'none')
387387
}}
388388
/>
389389
</Stack>
390-
{formik.values.onboardingExperience === 'other' && (
390+
{formik.values.onboardingExperience === 'external' && (
391391
<TextInput
392392
value={formik.values.externalOnboardingUrl}
393393
onChange={(e) => formik.setFieldValue('externalOnboardingUrl', e.target.value)}
394394
placeholder="https://"
395395
label="External onboarding url"
396396
onBlur={formik.handleBlur}
397397
errorMessage={
398-
formik.errors.externalOnboardingUrl && formik.values.onboardingExperience === 'other'
398+
formik.errors.externalOnboardingUrl && formik.values.onboardingExperience === 'external'
399399
? formik.errors.externalOnboardingUrl
400400
: undefined
401401
}

centrifuge-app/src/components/Dashboard/LandingPage/DashboardTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function DashboardTable() {
113113
<Grid display="flex" justifyContent="flex-end" gap={2} mb={2}>
114114
{pendingMultisigs && pendingMultisigs.length > 0 && (
115115
<Button variant="primary" small icon={IconWallet} onClick={() => setPendingMultisigsDrawerOpen(true)}>
116-
Pending multisigs`
116+
Pending multi-sig
117117
</Button>
118118
)}
119119
<Button variant="inverted" small icon={IconUsers} onClick={() => setAccessDrawerOpen(true)}>

centrifuge-app/src/components/Dashboard/PoolSelector.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Pool } from '@centrifuge/centrifuge-js'
22
import { useCentrifuge } from '@centrifuge/centrifuge-react'
33
import { Box, Checkbox, Shelf, Text, Thumbnail } from '@centrifuge/fabric'
4+
import { useEffect } from 'react'
45
import { useTheme } from 'styled-components'
56
import { useSelectedPools } from '../../utils/contexts/SelectedPoolsContext'
67
import { usePoolMetadata } from '../../utils/usePools'
@@ -22,6 +23,11 @@ const PoolSelect = ({ pool, active, multiple }: { pool: Pool; active: boolean; m
2223
const { togglePoolIdSelection, selectedPoolIds, clearSelectedPoolsIds } = useSelectedPools(multiple)
2324
const { data: poolMetadata } = usePoolMetadata(pool)
2425
const theme = useTheme()
26+
27+
useEffect(() => {
28+
clearSelectedPoolsIds()
29+
}, [])
30+
2531
const poolUri = poolMetadata?.pool?.icon?.uri
2632
? cent.metadata.parseMetadataUrl(poolMetadata?.pool?.icon?.uri)
2733
: undefined

centrifuge-app/src/pages/Dashboard/Dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const aumOptions = [
1919

2020
export default function Dashboard() {
2121
const theme = useTheme()
22-
const { selectedPoolsWithMetadata, selectedPoolIds } = useSelectedPools()
22+
const { selectedPoolsWithMetadata, selectedPoolIds } = useSelectedPools(true)
2323

2424
const totalNAV = useTotalNAV(selectedPoolsWithMetadata)
2525
const { liquidityData, isLoading } = useLiquidityMulti(selectedPoolIds)

centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,22 @@ export function ExternalFinanceForm({
273273
</Stack>
274274

275275
{source === 'reserve' ? (
276-
<InlineFeedback status="default">
277-
<Text variant="body2" color="statusDefault">
278-
Stablecoins will be transferred to the designated withdrawal addresses on the specified networks.
279-
A delay may occur before the transfer is completed.
280-
</Text>
281-
</InlineFeedback>
276+
<Stack mt={3}>
277+
<InlineFeedback status="default">
278+
<Text variant="body2" color="statusDefault">
279+
Stablecoins will be transferred to the designated withdrawal addresses on the specified
280+
networks. A delay may occur before the transfer is completed.
281+
</Text>
282+
</InlineFeedback>
283+
</Stack>
282284
) : (
283-
<InlineFeedback status="default">
284-
<Text variant="body2" color="statusDefault">
285-
Virtual accounting process. No onchain stablecoin transfers are expected.
286-
</Text>
287-
</InlineFeedback>
285+
<Stack mt={3}>
286+
<InlineFeedback status="default">
287+
<Text variant="body2" color="statusDefault">
288+
Virtual accounting process. No onchain stablecoin transfers are expected.
289+
</Text>
290+
</InlineFeedback>
291+
</Stack>
288292
)}
289293
</Box>
290294
</Stack>

centrifuge-app/src/pages/Loan/ExternalRepayForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ export function ExternalRepayForm({
330330
</Box>
331331
</Stack>
332332

333-
<Box>
333+
<Stack mt={3}>
334334
{destination === 'reserve' ? (
335335
<InlineFeedback status="default">
336336
<Text variant="body2" color="statusDefault">
@@ -344,7 +344,7 @@ export function ExternalRepayForm({
344344
</Text>
345345
</InlineFeedback>
346346
)}
347-
</Box>
347+
</Stack>
348348
</Stack>
349349

350350
<Stack gap={1}>

centrifuge-app/src/pages/Loan/FinanceForm.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -325,27 +325,29 @@ function InternalFinanceForm({
325325
{poolFees.renderSummary()}
326326
</Stack>
327327

328-
{source === 'reserve' ? (
329-
<InlineFeedback status="default">
330-
<Text variant="body2" color="statusDefault">
331-
Stablecoins will be transferred to the designated withdrawal addresses on the specified networks.
332-
A delay may occur before the transfer is completed.
333-
</Text>
334-
</InlineFeedback>
335-
) : source === 'other' ? (
336-
<InlineFeedback status="default">
337-
<Text variant="body2" color="statusDefault">
338-
Virtual accounting process. No onchain stablecoin transfers are expected. This action will lead to
339-
an increase in the NAV of the pool.
340-
</Text>
341-
</InlineFeedback>
342-
) : (
343-
<InlineFeedback status="default">
344-
<Text variant="body2" color="statusDefault">
345-
Virtual accounting process. No onchain stablecoin transfers are expected.
346-
</Text>
347-
</InlineFeedback>
348-
)}
328+
<Stack mt={3}>
329+
{source === 'reserve' ? (
330+
<InlineFeedback status="default">
331+
<Text variant="body2" color="statusDefault">
332+
Stablecoins will be transferred to the designated withdrawal addresses on the specified
333+
networks. A delay may occur before the transfer is completed.
334+
</Text>
335+
</InlineFeedback>
336+
) : source === 'other' ? (
337+
<InlineFeedback status="default">
338+
<Text variant="body2" color="statusDefault">
339+
Virtual accounting process. No onchain stablecoin transfers are expected. This action will lead
340+
to an increase in the NAV of the pool.
341+
</Text>
342+
</InlineFeedback>
343+
) : (
344+
<InlineFeedback status="default">
345+
<Text variant="body2" color="statusDefault">
346+
Virtual accounting process. No onchain stablecoin transfers are expected.
347+
</Text>
348+
</InlineFeedback>
349+
)}
350+
</Stack>
349351
</Box>
350352
</Stack>
351353

centrifuge-app/src/utils/tinlake/useTinlakePools.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,14 @@ export function useTinlakePools(suspense = false) {
149149
}
150150
)
151151
}
152-
export function useTinlakeLoans(poolId: string) {
152+
export function useTinlakeLoans(poolId?: string) {
153153
const tinlakePools = useTinlakePools(poolId?.startsWith('0x'))
154154
const pool = tinlakePools?.data?.pools?.find((p) => p?.id?.toLowerCase() === poolId?.toLowerCase())
155155

156156
return useQuery(
157157
['tinlakePoolLoans', poolId?.toLowerCase()],
158158
async () => {
159+
if (!poolId) return []
159160
const loans = await getTinlakeLoans(poolId)
160161
const writeOffPercentages = await getWriteOffPercentages(pool!, loans)
161162

centrifuge-app/src/utils/useLoans.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useTinlakeLoans } from './tinlake/useTinlakePools'
55
export function useLoans(poolIds: string[]) {
66
const isTinlakePool = poolIds.length === 1 && poolIds[0]?.startsWith('0x')
77

8-
const { data: tinlakeLoans, isLoading: isLoadingTinlake } = useTinlakeLoans(poolIds[0])
8+
const { data: tinlakeLoans, isLoading: isLoadingTinlake } = useTinlakeLoans(poolIds?.[0])
99

1010
const [centLoans, isLoading] = useCentrifugeQuery(['loans', poolIds], (cent) => cent.pools.getLoans({ poolIds }), {
1111
suspense: true,

centrifuge-js/src/modules/pools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4123,9 +4123,9 @@ export function getPoolsModule(inst: Centrifuge) {
41234123
return poolIdSet.has(sanitizedEventPoolId)
41244124
})
41254125
)
4126-
41274126
return $api.pipe(
41284127
switchMap((api) => {
4128+
if (poolIds.length === 0) return of([])
41294129
// For each poolId, create an observable to fetch its loans
41304130
const poolObservables = poolIds.map((poolId) => {
41314131
return api.query.poolSystem.pool(poolId).pipe(

0 commit comments

Comments
 (0)