fix(trading): set dark theme and trading view as default
This commit is contained in:
+7
-2
@@ -22,7 +22,12 @@ NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
|
||||
NX_SUCCESSOR_MARKETS=true
|
||||
NX_STOP_ORDERS=true
|
||||
NX_ICEBERG_ORDERS=true
|
||||
# NX_PRODUCT_PERPETUALS
|
||||
NX_METAMASK_SNAPS=true
|
||||
NX_REFERRALS=true
|
||||
NX_TEAM_COMPETITION=true
|
||||
# NX_DISABLE_CLOSE_POSITION=false
|
||||
|
||||
NX_TENDERMINT_URL=https://be.vega.community
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.vega.community/websocket
|
||||
|
||||
NX_CHARTING_LIBRARY_PATH=https://assets.vega.community/trading-view-bundle/v0.0.1/
|
||||
NX_CHARTING_LIBRARY_HASH=PDjWaqPFndDp+LCvqbKvntWriaqNzNpZ5i9R/BULzCg=
|
||||
|
||||
@@ -30,7 +30,7 @@ const STUDY_ORDER: Study[] = [
|
||||
];
|
||||
|
||||
export const DEFAULT_CHART_SETTINGS = {
|
||||
chartlib: 'pennant' as const,
|
||||
chartlib: 'tradingview' as const,
|
||||
interval: Interval.INTERVAL_I15M,
|
||||
type: ChartType.CANDLE,
|
||||
overlays: [Overlay.MOVING_AVERAGE],
|
||||
|
||||
@@ -42,12 +42,7 @@ const getCurrentTheme = () => {
|
||||
return storedTheme;
|
||||
}
|
||||
|
||||
const theme =
|
||||
isBrowser &&
|
||||
typeof window.matchMedia === 'function' && // jest test environment matchMedia is undefined
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
? Themes.DARK
|
||||
: Themes.LIGHT;
|
||||
const theme = Themes.DARK;
|
||||
|
||||
setThemeClassName(theme);
|
||||
return theme;
|
||||
|
||||
@@ -100,12 +100,12 @@ export const TradingView = ({
|
||||
},
|
||||
|
||||
// No theme in deps to avoid full chart reload when the theme changes
|
||||
// Instead the theme is changed programmitcally in a separate useEffect
|
||||
// Instead the theme is changed programmatically in a separate useEffect
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[datafeed, marketId, language, libraryPath, isMobile]
|
||||
);
|
||||
|
||||
// Update the trading view theme every time the app theme updates, doen separately
|
||||
// Update the trading view theme every time the app theme updates, done separately
|
||||
// to avoid full chart reload
|
||||
useEffect(() => {
|
||||
if (!widgetRef.current || !widgetRef.current._ready) return;
|
||||
|
||||
Reference in New Issue
Block a user