Skip to content

Commit

Permalink
Merge pull request #1163 from interlay/tom/release/interlay/2.30.2
Browse files Browse the repository at this point in the history
[release] Interlay 2.30.2
  • Loading branch information
tomjeatt authored Apr 27, 2023
2 parents 77b821c + 8957b39 commit e247793
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "interbtc-ui",
"version": "2.30.1",
"version": "2.30.2",
"private": true,
"dependencies": {
"@craco/craco": "^6.1.1",
Expand Down
16 changes: 9 additions & 7 deletions src/component-library/TokenInput/TokenInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const TokenInput = forwardRef<HTMLInputElement, TokenInputProps>(
balanceLabel,
isDisabled,
label,
ticker,
ticker: tickerProp,
style,
hidden,
className,
Expand All @@ -53,7 +53,9 @@ const TokenInput = forwardRef<HTMLInputElement, TokenInputProps>(
): JSX.Element => {
const inputRef = useDOMRef(ref);

const [selectValue, setSelectValue] = useState((selectProps?.defaultValue as string) || '');
const [ticker, setTicker] = useState<string>(
(selectProps?.defaultValue as string) || (typeof tickerProp === 'string' ? tickerProp : tickerProp?.text) || ''
);

const { labelProps, fieldProps } = useLabel({ label, ...props });

Expand All @@ -62,7 +64,7 @@ const TokenInput = forwardRef<HTMLInputElement, TokenInputProps>(
useEffect(() => {
if (selectProps?.value === undefined) return;

setSelectValue(selectProps.value as string);
setTicker(selectProps.value as string);
}, [selectProps?.value]);

const handleClickBalance = () => {
Expand All @@ -74,7 +76,7 @@ const TokenInput = forwardRef<HTMLInputElement, TokenInputProps>(

const handleTokenChange = (ticker: Key) => {
onChangeTicker?.(ticker as string);
setSelectValue(ticker as string);
setTicker(ticker as string);
};

// Prioritise Number Input description and error message
Expand All @@ -85,7 +87,7 @@ const TokenInput = forwardRef<HTMLInputElement, TokenInputProps>(
const endAdornment = selectProps ? (
<TokenSelect
{...restSelectProps}
value={selectValue}
value={ticker}
onSelectionChange={chain(onSelectionChange, handleTokenChange)}
label={label}
aria-label={fieldProps['aria-label']}
Expand All @@ -103,10 +105,10 @@ const TokenInput = forwardRef<HTMLInputElement, TokenInputProps>(
<Flex direction='column' gap='spacing0' className={className} style={style} hidden={hidden}>
{hasLabel && (
<TokenInputLabel
ticker={selectValue}
ticker={ticker}
balance={humanBalance || balance}
balanceLabel={balanceLabel}
isDisabled={isDisabled || !selectValue}
isDisabled={isDisabled || !ticker}
onClickBalance={handleClickBalance}
{...labelProps}
>
Expand Down
7 changes: 4 additions & 3 deletions src/components/PoolsTable/PoolsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ const PoolsTable = ({ variant, pools, onRowAction, title }: PoolsTableProps): JS
const commonColumns = [
{ name: t('amm.pools.pool_name'), uid: PoolsTableColumns.POOL_NAME },
{ name: t('apr'), uid: PoolsTableColumns.APR },
{ name: t('total_liquidity'), uid: PoolsTableColumns.TOTAL_LIQUIDITY }
{ name: t('total_liquidity'), uid: PoolsTableColumns.TOTAL_LIQUIDITY },
{ name: t('7_day_volume'), uid: PoolsTableColumns.SEVEN_DAY_VOLUME }
];

const borrowAssetsColumns = isAccountPools
? [...commonColumns, { name: t('my_liquidity'), uid: PoolsTableColumns.ACCOUNT_LIQUIDITY }]
: [...commonColumns, { name: t('7_day_volume'), uid: PoolsTableColumns.SEVEN_DAY_VOLUME }];
: commonColumns;

const rows: PoolsTableRow[] = useMemo(
() =>
Expand All @@ -73,7 +74,7 @@ const PoolsTable = ({ variant, pools, onRowAction, title }: PoolsTableProps): JS

const total7DayVolumeUSD = getDexTotalVolumeUSD(pooledCurrencies.map((pooled) => pooled.currency.ticker));
const total7DayVolumeLabel = formatUSD(total7DayVolumeUSD, { compact: true });
const sevenDayVolume = isAccountPools ? null : (
const sevenDayVolume = (
<Cell label={total7DayVolumeLabel} alignItems={isAccountPools ? 'flex-start' : 'flex-end'} />
);

Expand Down
4 changes: 2 additions & 2 deletions src/pages/Staking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ const Staking = (): JSX.Element => {
React.useEffect(() => {
if (!lockTime) return;
if (!currentBlockNumber) return;
if (!stakedAmountAndEndBlock) return;

const lockTimeValue = Number(lockTime);
const extensionTime = stakedAmountAndEndBlock.endBlock + convertWeeksToBlockNumbers(lockTimeValue);
const extensionTime =
(stakedAmountAndEndBlock?.endBlock || currentBlockNumber) + convertWeeksToBlockNumbers(lockTimeValue);

setBlockLockTimeExtension(extensionTime);
}, [currentBlockNumber, lockTime, stakedAmountAndEndBlock]);
Expand Down

1 comment on commit e247793

@vercel
Copy link

@vercel vercel bot commented on e247793 Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.