Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supply vaults #833

Merged
merged 36 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d111e8b
isolate pools table
vidvidvid Dec 6, 2024
e5567ae
add supply vault to pool toggle
vidvidvid Dec 6, 2024
2d59e5e
mock supply vault table
vidvidvid Dec 6, 2024
7b45241
setup supply vault dialog
vidvidvid Dec 6, 2024
e028283
use Amount
vidvidvid Dec 9, 2024
c7c5ca9
cleanup manage dialog tabs
vidvidvid Dec 9, 2024
d74765f
add max
vidvidvid Dec 9, 2024
4a49a00
add tabs
vidvidvid Dec 9, 2024
882a856
improve steps component
vidvidvid Dec 9, 2024
9bc5559
Merge branch 'development' into feat/supply-vaults
vidvidvid Dec 18, 2024
eb94c48
fix build
vidvidvid Dec 18, 2024
800fd98
search supply vaults
vidvidvid Dec 18, 2024
220483a
fix data
vidvidvid Dec 18, 2024
be2eabb
split morpho dialog
vidvidvid Dec 18, 2024
77ae42d
add slider to max amount
vidvidvid Dec 18, 2024
d2c5641
cleanup prop passing
vidvidvid Dec 19, 2024
eee1ab8
unify token balance component
vidvidvid Dec 19, 2024
d9ae3f8
adjust supply vault hook
vidvidvid Dec 19, 2024
4a13f5f
adjust withdraw vault hook
vidvidvid Dec 19, 2024
aa5d671
Merge branch 'development' into feat/supply-vaults
vidvidvid Dec 19, 2024
36b678a
fix hydration error
vidvidvid Dec 19, 2024
c579d4b
trim trailing zeros in token balance
vidvidvid Dec 19, 2024
3102001
remove zustand
vidvidvid Dec 20, 2024
00557ab
set up supply vaults data fetching
vidvidvid Dec 20, 2024
99a790e
improve supply vaults data fetching (fallbacks, usd values)
vidvidvid Dec 20, 2024
ca42bcb
Merge branch 'development' into feat/supply-vaults
vidvidvid Dec 20, 2024
b317ecd
wip useAssetPrices
vidvidvid Dec 20, 2024
1eeffa1
Merge branch 'development' into feat/supply-vaults
vidvidvid Dec 23, 2024
f923299
update design of apr cells
vidvidvid Dec 23, 2024
4a5096f
clean console logs
vidvidvid Dec 23, 2024
42b47d9
hide vaults
vidvidvid Dec 23, 2024
cc97ec9
fix border and bg of rewards hover card
vidvidvid Dec 23, 2024
33fd82d
align font
vidvidvid Dec 23, 2024
8040974
build fix
vidvidvid Dec 23, 2024
5b73545
native yield asset logo, op rewards white text
vidvidvid Dec 23, 2024
4c042ed
add stone turtle icons
vidvidvid Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
import { cn } from '@ui/lib/utils';
import type { MarketData } from '@ui/types/TokensDataMap';

import ResultHandler from '../../ResultHandler';
import ResultHandler from './ResultHandler';
import AmountInput from './AmountInput';

interface IAmount {
amount?: string;
Expand All @@ -27,62 +28,6 @@ interface IAmount {
handleUtilization?: (val: number) => void;
}

const AmountInput = ({
mainText,
handleInput,
readonly,
amount,
max,
isLoading
}: {
mainText?: string;
handleInput: (val?: string) => void;
readonly?: boolean;
amount?: string;
max?: string;
isLoading?: boolean;
}) => {
const isDisabled = readonly || max === '0' || isLoading;

const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
if (value === '') {
handleInput(undefined);
return;
}

const numValue = parseFloat(value);
const maxValue = parseFloat(max || '0');

if (numValue > maxValue) {
handleInput(max);
return;
}

handleInput(value);
};

return (
<div className="w-32">
<div className="text-xs text-white/50 mb-1">{mainText}</div>
<input
className={cn(
'w-full bg-transparent text-md border border-white/10 rounded px-2 py-1 focus:outline-none focus:border-white/20',
isDisabled && 'opacity-50 cursor-not-allowed'
)}
onChange={handleChange}
placeholder="0,00"
readOnly={isDisabled}
disabled={isDisabled}
type="number"
value={amount}
min="0"
max={max}
/>
</div>
);
};

const AssetSelector = ({
symbol,
availableAssets,
Expand Down Expand Up @@ -231,7 +176,7 @@ const Amount = ({
<div className="flex md:hidden flex-col w-full gap-4">
<div className="flex justify-between items-end w-full">
<AmountInput
mainText={mainText}
headerText={mainText}
handleInput={handleInput}
readonly={readonly}
amount={amount}
Expand All @@ -258,7 +203,7 @@ const Amount = ({
{/* Desktop Layout */}
<div className="hidden md:flex items-center gap-8">
<AmountInput
mainText={mainText}
headerText={mainText}
handleInput={handleInput}
readonly={readonly}
amount={amount}
Expand Down
61 changes: 61 additions & 0 deletions packages/ui/app/_components/AmountInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { cn } from '@ui/lib/utils';

const AmountInput = ({
headerText,
handleInput,
readonly,
amount,
max,
isLoading
}: {
headerText?: string;
handleInput?: (val?: string) => void;
readonly?: boolean;
amount?: string;
max?: string;
isLoading?: boolean;
}) => {
const isDisabled = readonly || max === '0' || isLoading || !handleInput;

function handleChange(e: React.ChangeEvent<HTMLInputElement>) {
if (!handleInput) return;

const value = e.target.value;
if (value === '') {
handleInput(undefined);
return;
}

const numValue = parseFloat(value);
const maxValue = max ? parseFloat(max) : 0;

if (numValue > maxValue) {
handleInput(max);
return;
}

handleInput(value);
}

return (
<div className="w-32">
<div className="text-xs text-white/50 mb-1">{headerText}</div>
<input
className={cn(
'w-full bg-transparent text-md border border-white/10 rounded px-2 py-1 focus:outline-none focus:border-white/20',
isDisabled && 'opacity-50 cursor-not-allowed'
)}
onChange={handleChange}
placeholder="0.0"
readOnly={isDisabled}
disabled={isDisabled}
type="number"
value={amount}
min="0"
max={max}
/>
</div>
);
};

export default AmountInput;
5 changes: 5 additions & 0 deletions packages/ui/app/_components/CommonTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export const sortingFunctions = {

type SortingType = keyof typeof sortingFunctions;

export interface MarketCellProps {
row: Row<any>;
getValue: () => any;
}

export type EnhancedColumnDef<T> = Omit<
ColumnDef<T, unknown>,
'header' | 'sortingFn'
Expand Down
Loading
Loading