Compare commits

..
7 changed files with 57 additions and 99 deletions
@@ -310,25 +310,16 @@ export const CurrentVolume = ({
const t = useT();
const nextTier = tiers[tierIndex + 1];
const requiredForNextTier = nextTier
? new BigNumber(nextTier.minimumRunningNotionalTakerVolume).minus(
windowLengthVolume
)
: new BigNumber(0);
const currentVolume = new BigNumber(windowLengthVolume);
? Number(nextTier.minimumRunningNotionalTakerVolume) - windowLengthVolume
: 0;
return (
<div className="flex flex-col gap-3 pt-4">
<CardStat
value={
currentVolume.isZero()
? `<${formatNumberRounded(requiredForNextTier)}`
: formatNumberRounded(currentVolume)
}
text={t('pastEpochs', 'Past {{count}} epochs', {
count: windowLength,
})}
value={formatNumberRounded(new BigNumber(windowLengthVolume))}
text={t('pastEpochs', 'Past {{count}} epochs', { count: windowLength })}
/>
{requiredForNextTier.isGreaterThan(0) && (
{requiredForNextTier > 0 && (
<CardStat
value={formatNumber(requiredForNextTier)}
text={t('Required for next tier')}
@@ -19,27 +19,16 @@ export const LayoutCell = ({
}: LayoutCellProps) => {
const t = useT();
const classes = [
'lg:text-right flex lg:block justify-stretch gap-2',
'lg:text-right flex justify-between lg:block',
'my-2 lg:my-0',
];
return (
<div className={classnames(classes)}>
{label && (
<>
<span className="lg:hidden text-xs text-vega-clight-200 dark:text-vega-cdark-200 whitespace-nowrap">
{label}
</span>
<span
/* separator */
aria-hidden
className="border-b border-dashed border-b-vega-clight-400 dark:border-b-vega-cdark-400 w-full h-[9px]"
></span>
</>
)}
{label && <span className="lg:hidden">{label}</span>}
<span
data-testid={dataTestId}
className={classnames('font-mono text-xs lg:text-sm', {
className={classnames('font-mono', {
'text-danger': !isLoading && hasError,
'text-muted': isLoading,
})}
@@ -89,30 +89,30 @@ export const NodeSwitcher = ({ closeDialog }: { closeDialog: () => void }) => {
<span className="text-right">{t('Block')}</span>
<span className="text-right">{t('Subscription')}</span>
</LayoutRow>
</div>
<div>
{nodes.map((node, index) => {
return (
<LayoutRow key={node} dataTestId="node-row">
<ApolloWrapper url={node}>
<RowData
id={index.toString()}
url={node}
highestBlock={highestBlock}
onBlockHeight={handleHighestBlock}
/>
</ApolloWrapper>
</LayoutRow>
);
})}
<CustomRowWrapper
inputText={customUrlText}
setInputText={setCustomUrlText}
nodes={nodes}
highestBlock={highestBlock}
onBlockHeight={handleHighestBlock}
nodeRadio={nodeRadio}
/>
<div>
{nodes.map((node, index) => {
return (
<LayoutRow key={node} dataTestId="node-row">
<ApolloWrapper url={node}>
<RowData
id={index.toString()}
url={node}
highestBlock={highestBlock}
onBlockHeight={handleHighestBlock}
/>
</ApolloWrapper>
</LayoutRow>
);
})}
<CustomRowWrapper
inputText={customUrlText}
setInputText={setCustomUrlText}
nodes={nodes}
highestBlock={highestBlock}
onBlockHeight={handleHighestBlock}
nodeRadio={nodeRadio}
/>
</div>
</div>
</TradingRadioGroup>
<div className="mt-4">
@@ -119,8 +119,6 @@ describe('getLiquidityProvision', () => {
createdAt: '2022-12-16T09:28:29.071781Z',
id: 'dde288688af2aeb5feb349dd72d3679a7a9be34c7375f6a4a48ef2f6140e7e59',
fee: '0.001',
partyId:
'dde288688af2aeb5feb349dd72d3679a7a9be34c7375f6a4a48ef2f6140e7e59',
party: {
__typename: 'Party',
accountsConnection: {
@@ -159,14 +159,7 @@ export const getLiquidityProvision = (
const liquidityProvider = liquidityProviders.find(
(f) => liquidityProvision.party.id === f.partyId
);
if (!liquidityProvider) {
return {
...liquidityProvision,
partyId: liquidityProvision.party.id,
};
}
if (!liquidityProvider) return liquidityProvision;
const accounts = compact(
liquidityProvision.party.accountsConnection?.edges
).map((e) => e.node);
@@ -37,6 +37,8 @@ export function Dialog({
'w-full h-full'
);
const wrapperClasses = classNames(
// Positions the modal in the center of screen
'z-20 relative rounded top-[10vh]',
// Dimensions
'max-w-[90vw] p-4 md:p-8',
// Need to apply background and text colors again as content is rendered in a portal
@@ -70,34 +72,27 @@ export function Dialog({
onInteractOutside={onInteractOutside}
data-testid={dataTestId}
>
<div
className={classNames(
// Positions the modal in the center of screen
'z-20 relative rounded top-[5vw] pb-[5vw] lg:top-[10vh] lg:pb-[10vh]'
<div className={wrapperClasses}>
{onChange && (
<DialogPrimitives.Close
className="absolute p-2 top-0 right-0 md:top-2 md:right-2"
data-testid="dialog-close"
>
<VegaIcon name={VegaIconNames.CROSS} size={24} />
</DialogPrimitives.Close>
)}
>
<div className={wrapperClasses}>
{onChange && (
<DialogPrimitives.Close
className="absolute p-2 top-0 right-0 md:top-2 md:right-2"
data-testid="dialog-close"
>
<VegaIcon name={VegaIconNames.CROSS} size={24} />
</DialogPrimitives.Close>
)}
<div className="flex gap-4 max-w-full">
{icon && <div className="fill-current">{icon}</div>}
<div data-testid="dialog-content" className="flex-1 max-w-full">
{title && (
<h1
className="text-xl uppercase mb-4 pr-2"
data-testid="dialog-title"
>
{title}
</h1>
)}
<div>{children}</div>
</div>
<div className="flex gap-4 max-w-full">
{icon && <div className="fill-current">{icon}</div>}
<div data-testid="dialog-content" className="flex-1 max-w-full">
{title && (
<h1
className="text-xl uppercase mb-4 pr-2"
data-testid="dialog-title"
>
{title}
</h1>
)}
<div>{children}</div>
</div>
</div>
</div>
@@ -57,20 +57,12 @@ interface RadioProps {
value: string;
label: string;
disabled?: boolean;
className?: string;
}
export const TradingRadio = ({
id,
value,
label,
disabled,
className,
}: RadioProps) => {
export const TradingRadio = ({ id, value, label, disabled }: RadioProps) => {
const wrapperClasses = classNames(
'flex items-center gap-1.5 text-xs',
labelClasses,
className
labelClasses
);
const itemClasses = classNames(
'flex justify-center items-center',