Skip to content

Commit e703af0

Browse files
refactor: remove rFormType from lend app
1 parent a45e4e0 commit e703af0

File tree

18 files changed

+90
-114
lines changed

18 files changed

+90
-114
lines changed

apps/main/src/lend/components/AlertNoLoanFound.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const AlertNoLoanFound = ({ alertType, owmId }: { alertType?: AlertType; owmId:
2525
size="large"
2626
onClick={() => {
2727
setStateByKeyMarkets('marketDetailsView', 'market')
28-
push(getLoanCreatePathname(params, owmId, 'create'))
28+
push(getLoanCreatePathname(params, owmId))
2929
}}
3030
>
3131
Create loan

apps/main/src/lend/components/PageLoanCreate/LoanCreateTabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ export const LendCreateTabsOldMenu = [
6262
export const LoanCreateTabs = (pageProps: CreateLoanProps) => {
6363
const menu = useCreateLoanMuiForm() ? LendCreateTabsNewMenu : LendCreateTabsOldMenu
6464
const shouldWrap = menu === LendCreateTabsOldMenu
65-
return <FormTabs params={pageProps} menu={menu} shouldWrap={shouldWrap} defaultTab={pageProps.rFormType} />
65+
return <FormTabs params={pageProps} menu={menu} shouldWrap={shouldWrap} />
6666
}

apps/main/src/lend/components/PageLoanCreate/LoanFormCreate/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ const LoanCreate = ({
412412
size="large"
413413
onClick={() => {
414414
setStateByKeyMarkets('marketDetailsView', 'user')
415-
push(getLoanManagePathname(params, rOwmId, 'loan'))
415+
push(getLoanManagePathname(params, rOwmId))
416416
}}
417417
>
418418
Manage loan
@@ -431,7 +431,7 @@ const LoanCreate = ({
431431
)}
432432
{steps && <Stepper steps={steps} />}
433433
{formStatus.isComplete && market && (
434-
<LinkButton variant="filled" size="large" href={getLoanManagePathname(params, market.id, 'loan')}>
434+
<LinkButton variant="filled" size="large" href={getLoanManagePathname(params, market.id)}>
435435
Manage loan
436436
</LinkButton>
437437
)}

apps/main/src/lend/components/PageLoanCreate/Page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const { Spacing } = SizesAndSpaces
3535

3636
const Page = () => {
3737
const params = useParams<MarketUrlParams>()
38-
const { rMarket, rChainId, rFormType } = parseMarketParams(params)
38+
const { rMarket, rChainId } = parseMarketParams(params)
3939

4040
const { data: market, isSuccess } = useOneWayMarket(rChainId, rMarket)
4141
const { llamaApi: api = null, connectState } = useConnection()
@@ -88,7 +88,6 @@ const Page = () => {
8888
params,
8989
rChainId,
9090
rOwmId,
91-
rFormType,
9291
api,
9392
market,
9493
titleMapper,
@@ -97,7 +96,7 @@ const Page = () => {
9796
}
9897
const positionDetailsHrefs = {
9998
borrow: '',
100-
supply: getVaultPathname(params, rOwmId, 'deposit'),
99+
supply: getVaultPathname(params, rOwmId),
101100
}
102101

103102
return isSuccess && !market ? (

apps/main/src/lend/components/PageLoanManage/ManageLoanTabs.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ export const ManageLoanTabs = ({
9191
isInSoftLiquidation,
9292
...pageProps
9393
}: ManageLoanProps & { isInSoftLiquidation: boolean | undefined }) => {
94-
const { rFormType } = pageProps
9594
const shouldUseSoftLiquidation = useManageSoftLiquidation() && isInSoftLiquidation
9695
const shouldUseManageLoanMuiForm = useManageLoanMuiForm()
9796
const menu = shouldUseSoftLiquidation
@@ -100,5 +99,5 @@ export const ManageLoanTabs = ({
10099
? LendManageNewMenu
101100
: LendManageLegacyMenu
102101
const shouldWrap = menu === LendManageLegacyMenu
103-
return <FormTabs params={pageProps} menu={menu} shouldWrap={shouldWrap} defaultTab={rFormType} />
102+
return <FormTabs params={pageProps} menu={menu} shouldWrap={shouldWrap} />
104103
}

apps/main/src/lend/components/PageLoanManage/Page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const { Spacing } = SizesAndSpaces
3838

3939
const Page = () => {
4040
const params = useParams<MarketUrlParams>()
41-
const { rMarket, rChainId, rFormType } = parseMarketParams(params)
41+
const { rMarket, rChainId } = parseMarketParams(params)
4242
const { llamaApi: api = null, connectState } = useConnection()
4343
const titleMapper = useTitleMapper()
4444
const { data: market, isSuccess } = useOneWayMarket(rChainId, rMarket)
@@ -119,7 +119,6 @@ const Page = () => {
119119
params,
120120
rChainId,
121121
rOwmId,
122-
rFormType,
123122
isLoaded,
124123
api,
125124
market,
@@ -129,7 +128,7 @@ const Page = () => {
129128

130129
const positionDetailsHrefs = {
131130
borrow: '',
132-
supply: getVaultPathname(params, rOwmId, 'deposit'),
131+
supply: getVaultPathname(params, rOwmId),
133132
}
134133

135134
return isSuccess && !market ? (

apps/main/src/lend/components/PageVault/Page.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const { Spacing } = SizesAndSpaces
3636

3737
const Page = () => {
3838
const params = useParams<MarketUrlParams>()
39-
const { rMarket, rChainId, rFormType } = parseMarketParams(params)
39+
const { rMarket, rChainId } = parseMarketParams(params)
4040
const { connect, provider } = useWallet()
4141
const { llamaApi: api = null, connectState } = useConnection()
4242
const titleMapper = useTitleMapper()
@@ -99,7 +99,6 @@ const Page = () => {
9999
params,
100100
rChainId,
101101
rOwmId,
102-
rFormType,
103102
isLoaded,
104103
api,
105104
market,
@@ -108,10 +107,7 @@ const Page = () => {
108107
}
109108

110109
const borrowPathnameFn = loanExists ? getLoanManagePathname : getLoanCreatePathname
111-
const positionDetailsHrefs = {
112-
borrow: borrowPathnameFn(params, rOwmId, ''),
113-
supply: '',
114-
}
110+
const positionDetailsHrefs = { borrow: borrowPathnameFn(params, rOwmId), supply: '' }
115111
const hasSupplyPosition = (supplyPositionDetails.shares.value ?? 0) > 0
116112

117113
return isSuccess && !market ? (

apps/main/src/lend/components/PageVault/VaultClaim/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { notify } from '@ui-kit/features/connect-wallet'
2121
import { t } from '@ui-kit/lib/i18n'
2222

2323
const VaultClaim = ({ isLoaded, api, market, userActiveKey }: PageContentProps) => {
24+
const rFormType = 'claim'
2425
const isSubscribed = useRef(false)
2526

2627
const formStatus = useStore((state) => state.vaultClaim.formStatus)

apps/main/src/lend/components/PageVault/VaultDepositMint/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import { LargeTokenInput } from '@ui-kit/shared/ui/LargeTokenInput'
2929
import { TokenLabel } from '@ui-kit/shared/ui/TokenLabel'
3030
import { decimal, type Decimal } from '@ui-kit/utils'
3131

32-
const VaultDepositMint = ({ rChainId, rOwmId, rFormType, isLoaded, api, market, userActiveKey }: PageContentProps) => {
32+
const VaultDepositMint = ({ rChainId, rOwmId, isLoaded, api, market, userActiveKey }: PageContentProps) => {
33+
const rFormType = 'deposit'
3334
const isSubscribed = useRef(false)
3435
const marketAlert = useMarketAlert(rChainId, rOwmId)
3536

@@ -176,7 +177,7 @@ const VaultDepositMint = ({ rChainId, rOwmId, rFormType, isLoaded, api, market,
176177

177178
// steps
178179
useEffect(() => {
179-
if (isLoaded && api && market && rFormType) {
180+
if (isLoaded && api && market) {
180181
const updatedSteps = getSteps(activeKey, rFormType, api, market, formStatus, formValues, steps)
181182
setSteps(updatedSteps)
182183
}

apps/main/src/lend/components/PageVault/VaultStake/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import { t } from '@ui-kit/lib/i18n'
2424
import { LargeTokenInput } from '@ui-kit/shared/ui/LargeTokenInput'
2525
import { decimal, type Decimal } from '@ui-kit/utils'
2626

27-
const VaultStake = ({ rChainId, rOwmId, rFormType, isLoaded, api, market, userActiveKey }: PageContentProps) => {
27+
const VaultStake = ({ rChainId, rOwmId, isLoaded, api, market, userActiveKey }: PageContentProps) => {
28+
const rFormType = 'stake'
2829
const isSubscribed = useRef(false)
2930

3031
const activeKey = useStore((state) => state.vaultStake.activeKey)

0 commit comments

Comments
 (0)