diff --git a/src/components/CollapsibleTabs.tsx b/src/components/CollapsibleTabs.tsx index a1d7bfa..991f0ac 100644 --- a/src/components/CollapsibleTabs.tsx +++ b/src/components/CollapsibleTabs.tsx @@ -31,10 +31,12 @@ type ElementProps = { }; type StyleProps = { - fullWidthTabs?: boolean; className?: string; + fullWidthTabs?: boolean; }; +export type CollapsibleTabsProps = ElementProps & StyleProps; + export const CollapsibleTabs = ({ defaultValue, items, @@ -43,8 +45,9 @@ export const CollapsibleTabs = ({ onOpenChange, fullWidthTabs, + className, -}: ElementProps & StyleProps) => { +}: CollapsibleTabsProps) => { const [value, setValue] = useState(defaultValue); const currentItem = items.find((item) => item.value === value); @@ -86,8 +89,8 @@ export const CollapsibleTabs = ({ - {items.map(({ value, content }) => ( - + {items.map(({ asChild, value, content }) => ( + {content} ))} @@ -219,7 +222,6 @@ Styled.Header = styled.header` Styled.CollapsibleContent = styled(CollapsibleContent)` ${layoutMixins.stack} - ${layoutMixins.perspectiveArea} box-shadow: none; `; diff --git a/src/components/Input.tsx b/src/components/Input.tsx index a1bcc88..e8d3d75 100644 --- a/src/components/Input.tsx +++ b/src/components/Input.tsx @@ -198,7 +198,6 @@ Styled.InputContainer = styled.div` border-radius: inherit; input { - user-select: all; flex: 1; width: 100%; } diff --git a/src/components/Tabs.tsx b/src/components/Tabs.tsx index bb6360e..9012991 100644 --- a/src/components/Tabs.tsx +++ b/src/components/Tabs.tsx @@ -21,6 +21,7 @@ export type TabItem = { content?: React.ReactNode; subitems?: TabItem[]; customTrigger?: ReactNode; + asChild?: boolean; }; type ElementProps = { @@ -41,6 +42,8 @@ type StyleProps = { className?: string; }; +export type TabsProps = ElementProps & StyleProps; + export const Tabs = ({ defaultValue, value, @@ -107,9 +110,10 @@ export const Tabs = ({ sharedContent ) : ( - {items.map(({ value, content, forceMount }) => ( + {items.map(({ asChild, value, content, forceMount }) => ( ` Styled.Stack = styled.div` ${layoutMixins.stack} - ${layoutMixins.perspectiveArea} box-shadow: none; `; diff --git a/src/pages/trade/HorizontalPanel.tsx b/src/pages/trade/HorizontalPanel.tsx index b072adc..c1c2e41 100644 --- a/src/pages/trade/HorizontalPanel.tsx +++ b/src/pages/trade/HorizontalPanel.tsx @@ -1,8 +1,7 @@ -import { useState } from 'react'; +import { useMemo, useState } from 'react'; import { shallowEqual, useSelector } from 'react-redux'; import styled, { type AnyStyledComponent } from 'styled-components'; -import { AbacusOrderStatus } from '@/constants/abacus'; import { STRING_KEYS } from '@/constants/localization'; import { useBreakpoints, useStringGetter } from '@/hooks'; @@ -28,7 +27,6 @@ import { getCurrentMarketTradeInfoNumbers, getHasUnseenFillUpdates, getHasUnseenOrderUpdates, - getLatestOrderStatus, getTradeInfoNumbers, } from '@/state/accountSelectors'; @@ -82,125 +80,142 @@ export const HorizontalPanel = ({ isOpen = true, setIsOpen }: ElementProps) => { showCurrentMarket ? numOpenOrders : numTotalOpenOrders ); - const tabItems = [ - { - value: InfoSection.Position, - label: stringGetter({ - key: showCurrentMarket ? STRING_KEYS.POSITION : STRING_KEYS.POSITIONS, - }), + const tabItems = useMemo( + () => [ + { + asChild: true, + value: InfoSection.Position, + label: stringGetter({ + key: showCurrentMarket ? STRING_KEYS.POSITION : STRING_KEYS.POSITIONS, + }), - tag: showCurrentMarket ? null : shortenNumberForDisplay(numTotalPositions), + tag: showCurrentMarket ? null : shortenNumberForDisplay(numTotalPositions), - content: showCurrentMarket ? ( - - ) : ( - setView(PanelView.CurrentMarket)} - /> - ), - }, - { - value: InfoSection.Orders, - label: stringGetter({ key: STRING_KEYS.ORDERS }), + content: showCurrentMarket ? ( + + ) : ( + setView(PanelView.CurrentMarket)} + /> + ), + }, + { + asChild: true, + value: InfoSection.Orders, + label: stringGetter({ key: STRING_KEYS.ORDERS }), - slotRight: isWaitingForOrderToIndex ? ( - - ) : ( - ordersTagNumber && ( - - {ordersTagNumber} + slotRight: isWaitingForOrderToIndex ? ( + + ) : ( + ordersTagNumber && ( + + {ordersTagNumber} + + ) + ), + + content: ( + + ), + }, + { + asChild: true, + value: InfoSection.Fills, + label: stringGetter({ key: STRING_KEYS.FILLS }), + + slotRight: fillsTagNumber && ( + + {fillsTagNumber} - ) - ), + ), - content: ( - - ), - }, - { - value: InfoSection.Fills, - label: stringGetter({ key: STRING_KEYS.FILLS }), + content: ( + + ), + }, + // TODO - TRCL-1693 - re-enable when funding payments are supported + // { + // value: InfoSection.Payments, + // label: stringGetter({ key: STRING_KEYS.PAYMENTS }), - slotRight: fillsTagNumber && ( - - {fillsTagNumber} - - ), - - content: ( - - ), - }, - // TODO - TRCL-1693 - re-enable when funding payments are supported - // { - // value: InfoSection.Payments, - // label: stringGetter({ key: STRING_KEYS.PAYMENTS }), - - // tag: shortenNumberForDisplay( - // showCurrentMarket ? numFundingPayments : numTotalFundingPayments - // ), - // content: ( - // - // ), - // }, - ]; + // tag: shortenNumberForDisplay( + // showCurrentMarket ? numFundingPayments : numTotalFundingPayments + // ), + // content: ( + // + // ), + // }, + ], + [ + stringGetter, + currentMarketId, + showCurrentMarket, + isTablet, + isWaitingForOrderToIndex, + isAccountViewOnly, + ordersTagNumber, + fillsTagNumber, + hasUnseenFillUpdates, + hasUnseenOrderUpdates, + ] + ); return isTablet ? ( diff --git a/src/styles/layoutMixins.ts b/src/styles/layoutMixins.ts index f33ef85..fdc2be4 100644 --- a/src/styles/layoutMixins.ts +++ b/src/styles/layoutMixins.ts @@ -877,11 +877,6 @@ export const layoutMixins: Record< } `, - perspectiveArea: css` - perspective: 100rem; - transform-style: preserve-3d; - `, - absolute: css` position: absolute; top: 0; diff --git a/src/views/AccountInfo.tsx b/src/views/AccountInfo.tsx index 504956f..e9ee324 100644 --- a/src/views/AccountInfo.tsx +++ b/src/views/AccountInfo.tsx @@ -63,7 +63,6 @@ Styled.AccountInfoSectionContainer = styled.div<{ showAccountInfo?: boolean }>` ${layoutMixins.column} height: var(--account-info-section-height); min-height: var(--account-info-section-height); - overflow-x: clip; ${({ showAccountInfo }) => !showAccountInfo && diff --git a/src/views/AccountInfo/AccountInfoConnectedState.tsx b/src/views/AccountInfo/AccountInfoConnectedState.tsx index e9e5e85..1627c7f 100644 --- a/src/views/AccountInfo/AccountInfoConnectedState.tsx +++ b/src/views/AccountInfo/AccountInfoConnectedState.tsx @@ -203,7 +203,6 @@ const Styled: Record = {}; Styled.Stack = styled.div` ${layoutMixins.stack} - ${layoutMixins.perspectiveArea} `; Styled.CornerButton = styled(Button)` @@ -293,7 +292,14 @@ Styled.TransferButtons = styled.div` Styled.ConnectedAccountInfoContainer = styled.div<{ $showHeader?: boolean }>` ${layoutMixins.column} - ${layoutMixins.withOuterAndInnerBorders} + + @media ${breakpoints.notTablet} { + ${layoutMixins.withOuterAndInnerBorders} + } + + @media ${breakpoints.tablet} { + ${layoutMixins.withInnerBorder} + } ${({ $showHeader }) => $showHeader && diff --git a/src/views/MarketDetails.tsx b/src/views/MarketDetails.tsx index d1b0a18..3b18cbf 100644 --- a/src/views/MarketDetails.tsx +++ b/src/views/MarketDetails.tsx @@ -213,13 +213,8 @@ Styled.MarketDetails = styled.div` `; Styled.Header = styled.header` - /* max-width: fit-content; */ - ${layoutMixins.column} gap: 1.25rem; - - position: sticky; - bottom: 3rem; `; Styled.WrapRow = styled.div` diff --git a/src/views/PositionInfo.tsx b/src/views/PositionInfo.tsx index dca2d48..ac79452 100644 --- a/src/views/PositionInfo.tsx +++ b/src/views/PositionInfo.tsx @@ -453,13 +453,6 @@ Styled.Actions = styled.footer` > :last-child { flex: 2; } - - position: sticky; - bottom: clamp(0.5rem, 7.5%, 2rem); - - @media ${breakpoints.tablet} { - bottom: 0; - } `; Styled.Output = styled(Output)<{ sign: NumberSign; smallText?: boolean; margin?: string }>` @@ -514,6 +507,7 @@ Styled.PositionInfo = styled.div` Styled.DetachedSection = styled(DetachedSection)` padding: 0 1.5rem; + position: relative; `; Styled.DetachedScrollableSection = styled(DetachedScrollableSection)` diff --git a/src/views/charts/TvChart.tsx b/src/views/charts/TvChart.tsx index a5813cc..f3586ff 100644 --- a/src/views/charts/TvChart.tsx +++ b/src/views/charts/TvChart.tsx @@ -82,7 +82,6 @@ const Styled: Record = {}; Styled.PriceChart = styled.div<{ isChartReady?: boolean }>` ${layoutMixins.stack} - ${layoutMixins.perspectiveArea} height: 100%; diff --git a/src/views/tables/OrdersTable.tsx b/src/views/tables/OrdersTable.tsx index 0d22cb9..9629969 100644 --- a/src/views/tables/OrdersTable.tsx +++ b/src/views/tables/OrdersTable.tsx @@ -230,14 +230,7 @@ const getOrdersTableColumnDef = ({ label: `${stringGetter({ key: STRING_KEYS.STATUS })} / ${stringGetter({ key: STRING_KEYS.FILL, })}`, - renderCell: ({ - asset, - createdAtMilliseconds, - size, - status, - totalFilled, - resources, - }) => { + renderCell: ({ asset, createdAtMilliseconds, size, status, totalFilled, resources }) => { const { statusIconColor, statusStringKey } = getStatusIconInfo({ status, totalFilled, @@ -345,9 +338,7 @@ export const OrdersTable = ({ if (hasUnseenOrderUpdates) dispatch(viewedOrders()); }, [hasUnseenOrderUpdates]); - const symbol = currentMarket - ? allAssets[allPerpetualMarkets[currentMarket]?.assetId]?.symbol - : null; + const symbol = currentMarket ? allAssets[allPerpetualMarkets[currentMarket]?.assetId]?.id : null; const ordersData = orders.map((order: SubaccountOrder) => getHydratedTradingData({