-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
borrow loan token
- add static UI (#1293)
* feat: add search input component * refactor: onpress props for loancards * wip: add choose loan token screen * feat: add confirm screen static UI Add navigation to borrow loan token screen * wip: placeholder screen for borrow loan token * wip: add loan token input UI * config: add color for vault status tag * feat: refactor VaultStatusTag and update to new UI * wip: placeholder for BottomSheetVaultList * config: add tailwind color * feat: add bottom sheet vault list that retrieves only non liquidated vault * feat: add borrow loan token screen Add loan token input Add vault input Add transaction details section Add continue button validation logic Add loan amount input * feat: remove vault status temporarily * feat: add hook to get col ratio text color * test: update vault status used in loan card test * feat(ui): optimize loan input for long number * feat: replace with loan tokens from api * revert: darkblue color from tailwind It will be added from PR #1274 * feat: update threshold value for collateralization ratio * fix: lint error * feat: add placeholder to loan amount input * feat: show clear input button only on non-empty string * fix: list in bottom nav screen not scrollable By replacing with BottomSheetFlatList * revert: blue tailwind color Will be added in PR #1274 * revert: style.json from tailwind-rn * test: update snapshot * added blue color * added blue color Co-authored-by: thedoublejay <[email protected]>
- Loading branch information
1 parent
0f9fbe1
commit f7fdf85
Showing
25 changed files
with
2,693 additions
and
1,247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { ThemedIcon, ThemedTextInput, ThemedView } from '@components/themed' | ||
import { ClearButton } from '@components/WalletTextInput' | ||
import { tailwind } from '@tailwind' | ||
import React from 'react' | ||
import { TextInputProps } from 'react-native' | ||
|
||
type SearchInputProps = React.PropsWithChildren<TextInputProps> & ISearchInputProps | ||
|
||
interface ISearchInputProps { | ||
showClearButton: boolean | ||
onClearInput: () => void | ||
} | ||
|
||
export function SearchInput (props: SearchInputProps): JSX.Element { | ||
const { | ||
onClearInput, | ||
...otherProps | ||
} = props | ||
return ( | ||
<ThemedView | ||
light={tailwind('bg-gray-100')} | ||
dark={tailwind('bg-gray-900')} | ||
style={tailwind('rounded-lg flex flex-row items-center py-1 pl-2 flex-1')} | ||
> | ||
<ThemedIcon | ||
iconType='MaterialIcons' | ||
name='search' | ||
size={16} | ||
light={tailwind('text-gray-600')} | ||
dark={tailwind('text-gray-300')} | ||
style={tailwind('mr-2')} | ||
/> | ||
<ThemedTextInput | ||
{...otherProps} | ||
style={tailwind('flex-grow w-8/12 h-8')} | ||
/> | ||
{props.showClearButton && | ||
( | ||
<ClearButton | ||
onPress={onClearInput} | ||
iconThemedProps={{ | ||
light: tailwind('text-gray-300'), | ||
dark: tailwind('text-gray-600') | ||
}} | ||
/> | ||
)} | ||
</ThemedView> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
mobile-app/app/hooks/wallet/CollateralizationRatioColor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ThemedProps } from '@components/themed' | ||
import BigNumber from 'bignumber.js' | ||
import { tailwind } from '@tailwind' | ||
|
||
interface UseCollateralizationRatioColorProps { | ||
value: string | ||
minColRatio: string | ||
} | ||
|
||
export function UseCollateralizationRatioColor (props: UseCollateralizationRatioColorProps): ThemedProps { | ||
const collateralizationRatio = new BigNumber(props.value) | ||
const style: ThemedProps = {} | ||
const atRiskThreshold = new BigNumber(props.minColRatio).multipliedBy(1.5) | ||
const liquidatedThreshold = new BigNumber(props.minColRatio).multipliedBy(1.25) | ||
|
||
if (collateralizationRatio.isLessThan(liquidatedThreshold)) { | ||
style.light = tailwind('text-error-500') | ||
style.dark = tailwind('text-darkerror-500') | ||
} else if (collateralizationRatio.isLessThan(atRiskThreshold)) { | ||
style.light = tailwind('text-warning-500') | ||
style.dark = tailwind('text-darkwarning-500') | ||
} else { | ||
style.light = tailwind('text-success-500') | ||
style.dark = tailwind('text-darksuccess-500') | ||
} | ||
return style | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.