+ <>
@@ -135,11 +146,13 @@ class Main extends PureComponent {
path={PATHS.MENU_LEDGERS}
component={Ledgers}
/>
-
+ {!isTurkishSite && (
+
+ )}
-
-
-
-
-
+ {!isTurkishSite && (
+ [
+ ,
+ ,
+ ,
+ ,
+ ,
+ ]
+ )}
-
+ {!isTurkishSite && (
+
+ )}
-
+ {!isTurkishSite && (
+
+ )}
-
+ >
) : ''
}
}
-Main.propTypes = propTypes
-Main.defaultProps = defaultProps
-
export default Main
diff --git a/src/components/Main/Main.props.js b/src/components/Main/Main.props.js
deleted file mode 100644
index 1f04da574..000000000
--- a/src/components/Main/Main.props.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import PropTypes from 'prop-types'
-
-export const propTypes = {
- authIsShown: PropTypes.bool.isRequired,
- authStatus: PropTypes.bool.isRequired,
- errorDialogDisabled: PropTypes.bool.isRequired,
-}
-
-export const defaultProps = {
- authIsShown: false,
-}
diff --git a/src/components/Main/index.js b/src/components/Main/index.js
index 062a1615e..eb3b39f1c 100644
--- a/src/components/Main/index.js
+++ b/src/components/Main/index.js
@@ -1,3 +1 @@
-import Main from './Main.container'
-
-export default Main
+export { default } from './Main.container'
diff --git a/src/state/base/actions.js b/src/state/base/actions.js
index 2f2b786d2..f9bfc1896 100644
--- a/src/state/base/actions.js
+++ b/src/state/base/actions.js
@@ -73,9 +73,17 @@ export function toggleTableScroll() {
}
}
+export function setSrc(src) {
+ return {
+ type: types.SET_SRC,
+ payload: src,
+ }
+}
+
export default {
setDateFormat,
setLang,
+ setSrc,
setTheme,
setTimezone,
showMilliseconds,
diff --git a/src/state/base/constants.js b/src/state/base/constants.js
index ff03e3ed3..650ff542d 100644
--- a/src/state/base/constants.js
+++ b/src/state/base/constants.js
@@ -9,10 +9,13 @@ export default {
'YY-MM-DD',
'YYYY-MM-DD',
],
+ DEFAULT_SRC: 'bfx',
+ TR_SRC: 'bfx-tr',
DEFAULT_TIMEZONE: 'Etc/UTC',
SET_SYNC_STATE: 'BITFINEX/SYNC/SET_STATE',
SET_DATE_FORMAT: 'BITFINEX/DATEFORMAT/SET',
SET_LANG: 'BITFINEX/LANG/SET',
+ SET_SRC: 'BITFINEX/SRC/SET',
SET_THEME: 'BITFINEX/THEME/SET',
SET_TIMEZONE: 'BITFINEX/TIMEZONE/SET',
UPDATE_THEME: 'BITFINEX/THEME/UPDATE',
diff --git a/src/state/base/reducer.js b/src/state/base/reducer.js
index 52b88f706..c240c3c79 100644
--- a/src/state/base/reducer.js
+++ b/src/state/base/reducer.js
@@ -8,6 +8,7 @@ const initialState = {
theme: types.DEFAULT_THEME,
timezone: types.DEFAULT_TIMEZONE,
milliseconds: false,
+ src: types.DEFAULT_SRC,
tableScroll: getDefaultTableScrollSetting(),
}
@@ -34,6 +35,11 @@ export function baseReducer(state = initialState, action) {
...state,
dateFormat: payload,
}
+ case types.SET_SRC:
+ return {
+ ...state,
+ src: payload,
+ }
case types.SHOW_MILLISECONDS:
return {
...state,
diff --git a/src/state/base/selectors.js b/src/state/base/selectors.js
index a1214dcdf..c83356572 100644
--- a/src/state/base/selectors.js
+++ b/src/state/base/selectors.js
@@ -1,4 +1,5 @@
import memoizeOne from 'memoize-one'
+import _isEqual from 'lodash/isEqual'
import { formatTime, timeOffset } from 'state/utils'
@@ -12,6 +13,8 @@ export const getTimezone = state => getBase(state).timezone
export const getDateFormat = state => getBase(state).dateFormat || types.DATE_FORMATS[0]
export const getShowMilliseconds = state => getBase(state).milliseconds || false
export const getTableScroll = state => getBase(state).tableScroll || false
+export const getSrc = state => getBase(state)?.src ?? types.DEFAULT_SRC
+export const getIsTurkishSite = state => _isEqual(getSrc(state), types.TR_SRC)
export const getTimeOffset = state => timeOffset(getTimezone(state))
@@ -43,8 +46,10 @@ export default {
getBase,
getDateFormat,
getFullTime,
+ getIsTurkishSite,
getLocale,
getShowMilliseconds,
+ getSrc,
getTheme,
getTimeOffset,
getTimezone,
diff --git a/src/state/ui/saga.js b/src/state/ui/saga.js
index faf58d1bd..e2097bd60 100644
--- a/src/state/ui/saga.js
+++ b/src/state/ui/saga.js
@@ -3,20 +3,23 @@ import {
} from 'redux-saga/effects'
import { REHYDRATE } from 'redux-persist'
-import { setTimezone, setTheme, setLang } from 'state/base/actions'
-import { checkAuth, updateAuth } from 'state/auth/actions'
-import { setTimeRange } from 'state/timeRange/actions'
-import { getParsedUrlParams, isValidTimezone, removeUrlParams } from 'state/utils'
-import { getNewTheme, getThemeClass, verifyTheme } from 'utils/themes'
import config from 'config'
-import timeRangeTypes from 'state/timeRange/constants'
-import { getTheme } from 'state/base/selectors'
import { LANGUAGES } from 'locales/i18n'
+import {
+ setTimezone, setTheme, setLang, setSrc,
+} from 'state/base/actions'
+import { getTheme } from 'state/base/selectors'
+import { setTimeRange } from 'state/timeRange/actions'
+import timeRangeTypes from 'state/timeRange/constants'
import handleElectronLoad from 'utils/handleElectronLoad'
+import { checkAuth, updateAuth } from 'state/auth/actions'
+import { getNewTheme, getThemeClass, verifyTheme } from 'utils/themes'
+import { getParsedUrlParams, isValidTimezone, removeUrlParams } from 'state/utils'
import types from './constants'
-import { togglePaginationDialog } from './actions'
import selectors from './selectors'
+import { togglePaginationDialog } from './actions'
+
function* uiLoaded() {
if (config.isElectronApp) {
@@ -25,9 +28,13 @@ function* uiLoaded() {
const parsed = getParsedUrlParams(window.location.search)
const {
- authToken, apiKey, apiSecret, timezone, theme, locale, range,
+ authToken, apiKey, apiSecret, timezone, theme, locale, range, src,
} = parsed
+ if (src) {
+ yield put(setSrc(src))
+ }
+
removeUrlParams(['timezone', 'theme', 'locale', 'authToken', 'apiKey', 'apiSecret'])
// handle custom timezone
diff --git a/src/ui/NavMenu/NavMenu.container.js b/src/ui/NavMenu/NavMenu.container.js
index 201c6e715..1b267e8d9 100644
--- a/src/ui/NavMenu/NavMenu.container.js
+++ b/src/ui/NavMenu/NavMenu.container.js
@@ -1,15 +1,20 @@
+import { compose } from 'redux'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
+import { withTranslation } from 'react-i18next'
import { getWindowWidth } from 'state/ui/selectors'
+import { getIsTurkishSite } from 'state/base/selectors'
import NavMenu from './NavMenu'
const mapStateToProps = state => ({
windowWidth: getWindowWidth(state),
+ isTurkishSite: getIsTurkishSite(state),
})
-
-const NavMenuContainer = connect(mapStateToProps)(withRouter(NavMenu))
-
-export default NavMenuContainer
+export default compose(
+ withTranslation('translations'),
+ connect(mapStateToProps),
+ withRouter,
+)(NavMenu)
diff --git a/src/ui/NavMenu/NavMenu.js b/src/ui/NavMenu/NavMenu.js
index f20839d08..7edb8a029 100644
--- a/src/ui/NavMenu/NavMenu.js
+++ b/src/ui/NavMenu/NavMenu.js
@@ -1,5 +1,5 @@
import React, { PureComponent } from 'react'
-import { withTranslation } from 'react-i18next'
+import PropTypes from 'prop-types'
import classNames from 'classnames'
import {
Classes,
@@ -7,15 +7,15 @@ import {
MenuDivider,
MenuItem,
} from '@blueprintjs/core'
-import _castArray from 'lodash/castArray'
+import _map from 'lodash/map'
import _includes from 'lodash/includes'
+import _castArray from 'lodash/castArray'
+import config from 'config'
import queryType from 'state/query/constants'
import { getIcon, getPath, getTarget } from 'state/query/utils'
-import config from 'config'
import NavMenuPopover from './NavMenuPopover'
-import { propTypes, defaultProps } from './NavMenu.props'
const { showFrameworkMode } = config
@@ -56,30 +56,47 @@ const {
} = queryType
class NavMenu extends PureComponent {
- static propTypes = propTypes
+ static propTypes = {
+ target: PropTypes.string,
+ className: PropTypes.string,
+ history: PropTypes.shape({
+ location: PropTypes.shape({
+ pathname: PropTypes.string.isRequired,
+ search: PropTypes.string.isRequired,
+ }).isRequired,
+ push: PropTypes.func.isRequired,
+ }).isRequired,
+ showMenuPopover: PropTypes.bool,
+ t: PropTypes.func.isRequired,
+ isTurkishSite: PropTypes.bool.isRequired,
+ }
- static defaultProps = defaultProps
+ static defaultProps = {
+ className: '',
+ target: undefined,
+ showMenuPopover: true,
+ }
- sections = [
+ getSections = (isTurkishSite) => [
[MENU_LEDGERS, 'ledgers.title'],
- [MENU_INVOICES, 'invoices.title'],
+ [MENU_INVOICES, 'invoices.title', isTurkishSite],
[[MENU_TRADES, MENU_CANDLES], 'trades.title'],
[[MENU_ORDERS, MENU_ORDER_TRADES], 'orders.title'],
[MENU_MOVEMENTS, 'movements.title'],
[[MENU_POSITIONS, MENU_POSITIONS_ACTIVE, MENU_POSITIONS_AUDIT], 'positions.title'],
[MENU_WALLETS, 'wallets.title'],
['divider'],
- [MENU_FOFFER, 'foffer.title'],
- [MENU_FLOAN, 'floan.title'],
- [MENU_FCREDIT, 'fcredit.title'],
- [MENU_FPAYMENT, 'fpayment.title'],
- [MENU_SPAYMENTS, 'spayments.title'],
+ [MENU_FOFFER, 'foffer.title', isTurkishSite],
+ [MENU_FLOAN, 'floan.title', isTurkishSite],
+ [MENU_FCREDIT, 'fcredit.title', isTurkishSite],
+ [MENU_FPAYMENT, 'fpayment.title', isTurkishSite],
+ [MENU_SPAYMENTS, 'spayments.title', isTurkishSite],
[MENU_AFFILIATES_EARNINGS, 'affiliatesearnings.title'],
- ['divider'],
+ ['divider', '', isTurkishSite],
[MENU_PUBLIC_TRADES, 'publictrades.title'],
- [MENU_PUBLIC_FUNDING, 'publicfunding.title'],
+ [MENU_PUBLIC_FUNDING, 'publicfunding.title', isTurkishSite],
[MENU_TICKERS, 'tickers.title'],
- [MENU_DERIVATIVES, 'derivatives.title'],
+ [MENU_DERIVATIVES, 'derivatives.title', isTurkishSite],
['divider', '', !showFrameworkMode],
[MENU_ACCOUNT_BALANCE, 'accountbalance.title', !showFrameworkMode],
[MENU_LOAN_REPORT, 'loanreport.title', !showFrameworkMode],
@@ -122,10 +139,11 @@ class NavMenu extends PureComponent {
render() {
const {
- className,
+ t,
history,
+ className,
+ isTurkishSite,
showMenuPopover,
- t,
} = this.props
const target = getTarget(history.location.pathname, false)
@@ -134,7 +152,7 @@ class NavMenu extends PureComponent {
return (