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

fix: isolated leverage, bump abacus, reposition the account info #1269

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@cosmjs/stargate": "^0.32.1",
"@cosmjs/tendermint-rpc": "^0.32.1",
"@datadog/browser-logs": "^5.23.3",
"@dydxprotocol/v4-abacus": "1.13.18",
"@dydxprotocol/v4-abacus": "1.13.21",
"@dydxprotocol/v4-client-js": "1.12.2",
"@dydxprotocol/v4-localization": "^1.1.240",
"@dydxprotocol/v4-proto": "^7.0.0-dev.0",
Expand Down
22 changes: 11 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions src/pages/trade/LaunchableMarket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { useAppSelector } from '@/state/appTypes';
import { getSelectedTradeLayout } from '@/state/layoutSelectors';

import { track } from '@/lib/analytics/analytics';
import { testFlags } from '@/lib/testFlags';

import { HorizontalPanel } from './HorizontalPanel';
import { InnerPanel } from './InnerPanel';
Expand All @@ -35,7 +34,6 @@ const LaunchableMarket = () => {
const tradeLayout = useAppSelector(getSelectedTradeLayout);
const match = useMatch(`/${AppRoute.Trade}/:marketId`);
const { marketId } = match?.params ?? {};
const { uiRefresh } = testFlags;

const [isHorizontalPanelOpen, setIsHorizontalPanelOpen] = useState(true);

Expand Down Expand Up @@ -78,9 +76,8 @@ const LaunchableMarket = () => {
</header>

<$GridSection gridArea="Side" tw="flex flex-col">
{!uiRefresh && <AccountInfo />}
<AccountInfo />
<$LaunchMarketSidePanel launchableMarketId={marketId} />
{uiRefresh && <AccountInfo />}
</$GridSection>

<$GridSection gridArea="Inner">
Expand Down
5 changes: 2 additions & 3 deletions src/pages/trade/Trade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { VerticalPanel } from './VerticalPanel';
const TradePage = () => {
const tradePageRef = useRef<HTMLDivElement>(null);

const { uiRefresh, pml } = testFlags;
const { pml } = testFlags;

const { isViewingUnlaunchedMarket } = useCurrentMarketId();
const { isTablet } = useBreakpoints();
Expand Down Expand Up @@ -82,9 +82,8 @@ const TradePage = () => {
</header>

<$GridSection gridArea="Side" tw="grid-rows-[auto_minmax(0,1fr)]">
{!uiRefresh && <AccountInfo />}
<AccountInfo />
<TradeBox />
{uiRefresh && <AccountInfo />}
</$GridSection>

<$GridSection gridArea="Vertical">
Expand Down
9 changes: 5 additions & 4 deletions src/views/forms/TradeForm/TargetLeverageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const TargetLeverageInput = () => {
const debouncedSetAbacusLeverage = useMemo(
() =>
debounce(
(newLeverage: number) =>
(newLeverage: number | string) =>
abacusStateManager.setTradeValue({
value: newLeverage,
field: TradeInputField.targetLeverage,
Expand Down Expand Up @@ -106,9 +106,10 @@ export const TargetLeverageInput = () => {
type={InputType.Leverage}
value={leverage}
max={maxLeverage}
onChange={({ floatValue }: NumberFormatValues) =>
setLeverage(floatValue?.toString() ?? '')
}
onChange={({ floatValue }: NumberFormatValues) => {
setLeverage(floatValue?.toString() ?? '');
debouncedSetAbacusLeverage(floatValue ?? '');
Copy link
Contributor

Choose a reason for hiding this comment

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

The useState is purely for rendering purposes?

Copy link
Contributor

Choose a reason for hiding this comment

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

wondering if there is a way to leverage the useDebounce hook for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah in retrospect we should just refactor this because it's a bit of a mess, but let's merge for now .

}}
/>
</$InnerInputContainer>
</$InputContainer>
Expand Down
Loading