chore(trading): layout adjustments to accomodate default 13 inch screens (#4798)

This commit is contained in:
Matthew Russell 2023-09-15 05:24:47 -07:00 committed by GitHub
parent 3de5b07495
commit 78afecc2e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 41 deletions

View File

@ -73,7 +73,7 @@ const MainGrid = memo(
</ResizableGridPanel> </ResizableGridPanel>
<ResizableGridPanel <ResizableGridPanel
minSize={200} minSize={200}
preferredSize={sizesMiddle[1] || 300} preferredSize={sizesMiddle[1] || 275}
> >
<TradeGridChild> <TradeGridChild>
<Tabs storageKey="console-trade-grid-main-right"> <Tabs storageKey="console-trade-grid-main-right">
@ -181,7 +181,7 @@ const TradeGridChild = ({ children }: TradeGridChildProps) => {
{({ width, height }) => ( {({ width, height }) => (
<div <div
style={{ width, height }} style={{ width, height }}
className="border border-default rounded-sm" className="border rounded-sm border-default"
> >
{children} {children}
</div> </div>

View File

@ -13,7 +13,8 @@ export const LayoutWithSidebar = () => {
'h-full relative z-0 grid', 'h-full relative z-0 grid',
'grid-rows-[min-content_1fr_40px]', 'grid-rows-[min-content_1fr_40px]',
'lg:grid-rows-[min-content_1fr]', 'lg:grid-rows-[min-content_1fr]',
'lg:grid-cols-[1fr_350px_40px]' 'lg:grid-cols-[1fr_280px_40px]',
'xxxl:grid-cols-[1fr_320px_40px]'
); );
return ( return (

View File

@ -83,8 +83,7 @@ html [data-theme='light'] {
--pennant-color-volume-sell: theme(colors.market.red.DEFAULT); --pennant-color-volume-sell: theme(colors.market.red.DEFAULT);
/* reduce space between candles */ /* reduce space between candles */
--pennant-candlestick-inner-padding: 0.175; --pennant-candlestick-inner-padding: 0.25;
--pennant-candlestick-stroke-width: 0.5;
} }
html [data-theme='light'] { html [data-theme='light'] {
@ -162,11 +161,22 @@ html [data-theme='dark'] {
@apply font-normal font-alpha; @apply font-normal font-alpha;
} }
/* Light variables */ .ag-theme-balham,
.ag-theme-balham { .ag-theme-balham-dark {
--ag-grid-size: 2px; /* Used for compactness */ --ag-grid-size: 2px; /* Used for compactness */
--ag-row-height: 36px; --ag-row-height: 36px;
--ag-header-height: 28px;
}
@media (min-width: theme(screens.xxl)) {
.ag-theme-balham,
.ag-theme-balham-dark {
--ag-header-height: 36px; --ag-header-height: 36px;
}
}
/* Light variables */
.ag-theme-balham {
--ag-background-color: theme(colors.white); --ag-background-color: theme(colors.white);
--ag-border-color: theme(colors.vega.clight.600); --ag-border-color: theme(colors.vega.clight.600);
--ag-header-background-color: theme(colors.vega.clight.700); --ag-header-background-color: theme(colors.vega.clight.700);
@ -179,9 +189,6 @@ html [data-theme='dark'] {
/* Dark variables */ /* Dark variables */
.ag-theme-balham-dark { .ag-theme-balham-dark {
--ag-grid-size: 2px; /* Used for compactness */
--ag-row-height: 36px;
--ag-header-height: 36px;
--ag-background-color: theme(colors.vega.cdark.900); --ag-background-color: theme(colors.vega.cdark.900);
--ag-border-color: theme(colors.vega.cdark.600); --ag-border-color: theme(colors.vega.cdark.600);
--ag-header-background-color: theme(colors.vega.cdark.700); --ag-header-background-color: theme(colors.vega.cdark.700);
@ -191,6 +198,7 @@ html [data-theme='dark'] {
--ag-row-hover-color: theme(colors.vega.cdark.800); --ag-row-hover-color: theme(colors.vega.cdark.800);
--ag-modal-overlay-background-color: rgb(9 11 16 / 50%); --ag-modal-overlay-background-color: rgb(9 11 16 / 50%);
} }
.ag-theme-balham-dark .ag-row.no-hover, .ag-theme-balham-dark .ag-row.no-hover,
.ag-theme-balham-dark .ag-row.no-hover:hover, .ag-theme-balham-dark .ag-row.no-hover:hover,
.ag-theme-balham .ag-row.no-hover, .ag-theme-balham .ag-row.no-hover,

View File

@ -8,13 +8,16 @@ import AutoSizer from 'react-virtualized-auto-sizer';
import { useVegaWallet } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet';
import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; import { useThemeSwitcher } from '@vegaprotocol/react-helpers';
import { t } from '@vegaprotocol/i18n'; import { t } from '@vegaprotocol/i18n';
import { useCandlesChartSettings } from './use-candles-chart-settings'; import {
STUDY_SIZE,
useCandlesChartSettings,
} from './use-candles-chart-settings';
export type CandlesChartContainerProps = { export type CandlesChartContainerProps = {
marketId: string; marketId: string;
}; };
const CANDLES_TO_WIDTH_FACTOR = 0.15; const CANDLES_TO_WIDTH_FACTOR = 0.2;
export const CandlesChartContainer = ({ export const CandlesChartContainer = ({
marketId, marketId,
@ -49,7 +52,9 @@ export const CandlesChartContainer = ({
return ( return (
<AutoSizer> <AutoSizer>
{({ width, height }) => ( {({ width, height }) => {
const candlesCount = Math.floor(width * CANDLES_TO_WIDTH_FACTOR);
return (
<div style={{ width, height }}> <div style={{ width, height }}>
<CandlestickChart <CandlestickChart
dataSource={dataSource} dataSource={dataSource}
@ -60,10 +65,8 @@ export const CandlesChartContainer = ({
notEnoughDataText: ( notEnoughDataText: (
<span className="text-xs text-center">{t('No data')}</span> <span className="text-xs text-center">{t('No data')}</span>
), ),
initialNumCandlesToDisplay: Math.floor( initialNumCandlesToDisplay: candlesCount,
width * CANDLES_TO_WIDTH_FACTOR studySize: STUDY_SIZE,
),
studySize: 150, // default size
studySizes, studySizes,
}} }}
interval={interval} interval={interval}
@ -75,7 +78,8 @@ export const CandlesChartContainer = ({
onPaneChanged={handlePaneChange} onPaneChanged={handlePaneChange}
/> />
</div> </div>
)} );
}}
</AutoSizer> </AutoSizer>
); );
}; };

View File

@ -15,7 +15,7 @@ interface StoredSettings {
studySizes: StudySizes; studySizes: StudySizes;
} }
export const STUDY_SIZE = 100; export const STUDY_SIZE = 90;
const STUDY_ORDER: Study[] = [ const STUDY_ORDER: Study[] = [
Study.FORCE_INDEX, Study.FORCE_INDEX,
Study.RELATIVE_STRENGTH_INDEX, Study.RELATIVE_STRENGTH_INDEX,