-
Notifications
You must be signed in to change notification settings - Fork 298
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
Mahdiyeh/ Refactor: Reports monorepo package #5620
Merged
carolsachdeva
merged 85 commits into
binary-com:master
from
mahdiyeh-deriv:reports_monorepo_package2
Jul 7, 2022
Merged
Changes from 79 commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
9536d73
add initial config of reports monorepo
mahdiyeh-deriv f38e031
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv 3fc26e0
add config to core
mahdiyeh-deriv 8ba0a55
fix event-source-polyfil version
mahdiyeh-deriv ff5ffd8
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv da8c6c9
resolve build errors
mahdiyeh-deriv 181850d
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv a25be27
move validator to utils
mahdiyeh-deriv 06895de
fix trader files
mahdiyeh-deriv e828029
delete reports, change imports
mahdiyeh-deriv f1d4db7
fix root_store error
mahdiyeh-deriv af9c182
fix chunkName
mahdiyeh-deriv fa29824
fix direcory path
mahdiyeh-deriv 2dede3b
fix jest errors
mahdiyeh-deriv efde5cc
fix directory
mahdiyeh-deriv e88e988
fix conflicts of master
mahdiyeh-deriv ca90fbc
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv 40fc00b
make separate emptyPrtfolioMessage in trader
mahdiyeh-deriv 83cf144
fix aliases
mahdiyeh-deriv 58528e8
add translation
mahdiyeh-deriv d77b06d
fix code smell
mahdiyeh-deriv ccde612
reload tests
mahdiyeh-deriv e5aa68f
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv 9050256
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv d08b84d
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv abc153d
fix empty-portfolio-message conflicts
mahdiyeh-deriv 938fe61
Merge branch 'master' into reports_monorepo_package
mahdiyeh-deriv dc80617
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv 02d50ed
remove unnecessary css files and functions
mahdiyeh-deriv 2ab5b59
remove deriv-charts package and unnecessary related files
mahdiyeh-deriv d2817b5
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv 526baf1
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv d24e1f8
fix import from trader in reports
mahdiyeh-deriv d65b3fc
remove duplicated files
mahdiyeh-deriv cbd8cc5
change BinaryLink to NavLink
mahdiyeh-deriv c9d1b8b
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv 43ad0c2
rerun tests
mahdiyeh-deriv bb145cc
fix circular dependency
mahdiyeh-deriv 9fe3248
fix EHOIST_PKG_VERSION error
mahdiyeh-deriv c0f1726
fix test
mahdiyeh-deriv 9b23ed6
remove position-drawer-card from trader
mahdiyeh-deriv 711b64b
remove duplicated scss
mahdiyeh-deriv 178c564
remove bottom-widget
mahdiyeh-deriv 8b567a1
fix reports loader
mahdiyeh-deriv 0ef43ae
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv 66c8432
add contract, portfolio and chartbarrier stores to the core
mahdiyeh-deriv f4d8274
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv c62bfb4
use core portfolio and contract store in trader and reports
mahdiyeh-deriv 73ff78d
move markers component, helpers and constants to the core
mahdiyeh-deriv 52dfcea
remove all duplicated files from trader and reports
mahdiyeh-deriv b0141bc
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv 916f741
remove contract store from core exports
mahdiyeh-deriv 07f48a5
update reports packages version
mahdiyeh-deriv 54a2d40
remove commented imports
mahdiyeh-deriv 945c82f
add getContactValidationRules to contact core
mahdiyeh-deriv d4e8c45
move duration test to shared
mahdiyeh-deriv bc24334
fix active_symbols store
mahdiyeh-deriv 3c589bf
fix moduleLoader in routes.config error
mahdiyeh-deriv 6e9556c
fix stores constructor
mahdiyeh-deriv 6d5cf28
move contract-type file to trader
mahdiyeh-deriv 103549d
move validation-rules to trading
mahdiyeh-deriv 53e0f51
remove serverTime from shared
mahdiyeh-deriv ddfbeaf
remove .js from imports
mahdiyeh-deriv 4ae49ea
remove all commented lines
mahdiyeh-deriv 8ee17e8
fix error when the trade_store in localStorage in not existd yet
mahdiyeh-deriv 8baec77
clean the code
mahdiyeh-deriv 2e8e335
fix is_multiplier error issue using it from portfolio store
mahdiyeh-deriv 310f3fb
add props type to open-positions and position-drawer
mahdiyeh-deriv bdb15dc
change portfolio file name
mahdiyeh-deriv 1cce528
add action for updating contract_type observable in portfolio store
mahdiyeh-deriv b015a93
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv c18ef5d
update with latest master
mahdiyeh-deriv c10232f
remove comments
mahdiyeh-deriv 2ca9a5c
add shared to translation scripts/add deriv/reports to the build
mahdiyeh-deriv dee7c92
remove redundant comment in contract-replay.jsx
mahdiyeh-deriv 1c91585
remove connectionWithContractUpdate from reports
mahdiyeh-deriv 69dc5de
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv 3fcd64d
fix openPositions default tab issue
mahdiyeh-deriv c9a2c1d
fix to not remove closed contracts when navigating from reporst to tr…
mahdiyeh-deriv bdc145e
prevent unmounting the portfolio component when redirecting to report…
mahdiyeh-deriv 6b9c63d
Merge branch 'master' of github.com:binary-com/deriv-app into reports…
mahdiyeh-deriv cac8faf
fix performance issue on profit_loss input
mahdiyeh-deriv 5fc26f2
fix circular dependancy
mahdiyeh-deriv 8826d95
Merge branch 'master' into reports_monorepo_package2
mahdiyeh-deriv b0c00dd
Merge branch 'master' into reports_monorepo_package2
carolsachdeva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/core/src/Components/markers/__tests__/marker-spot-label.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { configure, shallow, mount } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import MarkerSpotLabel from '../marker-spot-label.jsx'; | ||
|
||
configure({ adapter: new Adapter() }); | ||
|
||
describe('MarkerSpotLabel', () => { | ||
it('should render one <MarkerSpotLabel /> component', () => { | ||
const wrapper = shallow(<MarkerSpotLabel />); | ||
expect(wrapper).to.have.length(1); | ||
}); | ||
it('should have class .chart-spot-label__time-value-container--top if align_label top is passed in props', () => { | ||
const wrapper = shallow(<MarkerSpotLabel align_label={'top'} />); | ||
expect(wrapper.find('.chart-spot-label__time-value-container--top').exists()).to.be.true; | ||
}); | ||
it('should have class .chart-spot-label__time-value-container--bottom if align_label bottom is passed in props', () => { | ||
const wrapper = shallow(<MarkerSpotLabel align_label={'bottom'} />); | ||
expect(wrapper.find('.chart-spot-label__time-value-container--bottom').exists()).to.be.true; | ||
}); | ||
it('should have class .chart-spot-label__time-value-container--top if no align_label is passed in props', () => { | ||
const wrapper = shallow(<MarkerSpotLabel />); | ||
expect(wrapper.find('.chart-spot-label__time-value-container--top').exists()).to.be.true; | ||
expect(wrapper.find('.chart-spot-label__time-value-container--bottom').exists()).to.be.false; | ||
}); | ||
it('should toggle label on hover if has_hover_toggle is passed in props', async () => { | ||
const wrapper = mount(<MarkerSpotLabel has_hover_toggle={true} />); | ||
expect(wrapper.find('.chart-spot-label__info-container').exists()).to.be.false; | ||
|
||
wrapper.find('.marker-hover-container').simulate('mouseenter'); | ||
wrapper.update(); | ||
expect(wrapper.find('.chart-spot-label__info-container').exists()).to.be.true; | ||
|
||
wrapper.find('.marker-hover-container').simulate('mouseleave'); | ||
wrapper.update(); | ||
expect(wrapper.find('.chart-spot-label__info-container').exists()).to.be.false; | ||
}); | ||
it('should not toggle label on hover if has_label_toggle is not passed in props', () => { | ||
const wrapper = shallow(<MarkerSpotLabel />); | ||
expect(wrapper.find('.chart-spot-label__info-container').exists()).to.be.true; | ||
expect(wrapper.find('.marker-hover-container').exists()).to.equal(false); | ||
}); | ||
it('should have class .chart-spot-label__value-container--won if status won is passed in props', () => { | ||
const wrapper = shallow(<MarkerSpotLabel status={'won'} />); | ||
expect(wrapper.find('.chart-spot-label__value-container--won').exists()).to.be.true; | ||
}); | ||
it('should have class .chart-spot-label__value-container--lost if status lost is passed in props', () => { | ||
const wrapper = shallow(<MarkerSpotLabel status={'lost'} />); | ||
expect(wrapper.find('.chart-spot-label__value-container--lost').exists()).to.be.true; | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
packages/core/src/Components/markers/__tests__/marker-spot.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { configure, shallow } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import MarkerSpot from '../marker-spot.jsx'; | ||
|
||
configure({ adapter: new Adapter() }); | ||
|
||
describe('MarkerSpot', () => { | ||
it('should render one <MarkerSpot /> component', () => { | ||
const wrapper = shallow(<MarkerSpot />); | ||
expect(wrapper).to.have.length(1); | ||
}); | ||
it('should not have class .chart-spot__spot--lost or .chart-spot__spot--won if no status is passed in props', () => { | ||
const wrapper = shallow(<MarkerSpot />); | ||
expect(wrapper.find('.chart-spot__spot--lost').exists()).to.be.false; | ||
expect(wrapper.find('.chart-spot__spot--lost').exists()).to.be.false; | ||
expect(wrapper.find('.chart-spot').exists()).to.be.true; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import classNames from 'classnames'; | ||
import { observer } from 'mobx-react'; | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import { Icon } from '@deriv/components'; | ||
|
||
const MarkerLine = ({ label, line_style, marker_config, status }) => { | ||
// TODO: Find a more elegant solution | ||
if (!marker_config) return <div />; | ||
return ( | ||
<div className={classNames('chart-marker-line__wrapper', `chart-marker-line--${line_style}`)}> | ||
{label === marker_config.LINE_END.content_config.label && ( | ||
<Icon | ||
icon='IcContractExitTimeCircle' | ||
className='chart-marker-line__icon' | ||
color={status === 'lost' ? 'red' : 'green'} | ||
size={24} | ||
/> | ||
)} | ||
{label === marker_config.LINE_START.content_config.label && ( | ||
<Icon | ||
icon='IcContractStartTimeCircle' | ||
className='chart-marker-line__icon chart-marker-line__icon--time' | ||
color='secondary' | ||
size={24} | ||
/> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
MarkerLine.propTypes = { | ||
label: PropTypes.string, | ||
line_style: PropTypes.string, | ||
marker_config: PropTypes.object, | ||
status: PropTypes.oneOf(['won', 'lost']), | ||
}; | ||
export default observer(MarkerLine); |
82 changes: 82 additions & 0 deletions
82
packages/core/src/Components/markers/marker-spot-label.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import classNames from 'classnames'; | ||
import { observer } from 'mobx-react'; | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import { Icon, Text } from '@deriv/components'; | ||
import { addComma, toMoment } from '@deriv/shared'; | ||
|
||
import MarkerSpot from './marker-spot.jsx'; | ||
|
||
const MarkerSpotLabel = ({ | ||
align_label, | ||
has_hover_toggle, | ||
spot_className, | ||
spot_count, | ||
spot_epoch, | ||
spot_value, | ||
status, | ||
}) => { | ||
const [show_label, setShowLabel] = React.useState(!has_hover_toggle); | ||
|
||
const handleHoverToggle = () => { | ||
setShowLabel(!show_label); | ||
}; | ||
|
||
let marker_spot = <MarkerSpot className={spot_className} spot_count={spot_count} />; | ||
|
||
if (has_hover_toggle) { | ||
marker_spot = ( | ||
<div className='marker-hover-container' onMouseEnter={handleHoverToggle} onMouseLeave={handleHoverToggle}> | ||
{marker_spot} | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className={'chart-spot-label'}> | ||
{show_label && ( | ||
<div className='chart-spot-label__info-container'> | ||
<div | ||
className={`chart-spot-label__time-value-container chart-spot-label__time-value-container--${align_label}`} | ||
> | ||
<div className='chart-spot-label__time-container'> | ||
<Icon | ||
icon='IcClockOutline' | ||
height={10} | ||
width={10} | ||
className='chart-spot-label__time-icon' | ||
/> | ||
<Text as='p' color='prominent' size='xxxs'> | ||
{toMoment(+spot_epoch).format('HH:mm:ss')} | ||
</Text> | ||
</div> | ||
<div | ||
className={classNames('chart-spot-label__value-container', { | ||
'chart-spot-label__value-container--won': status === 'won', | ||
'chart-spot-label__value-container--lost': status === 'lost', | ||
})} | ||
> | ||
<p>{addComma(spot_value)}</p> | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
{marker_spot} | ||
</div> | ||
); | ||
}; | ||
|
||
MarkerSpotLabel.defaultProps = { | ||
align_label: 'top', | ||
}; | ||
|
||
MarkerSpotLabel.propTypes = { | ||
align_label: PropTypes.oneOf(['top', 'bottom']), | ||
has_hover_toggle: PropTypes.bool, | ||
spot_className: PropTypes.string, | ||
spot_count: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
spot_epoch: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
spot_value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
status: PropTypes.oneOf(['won', 'lost']), | ||
}; | ||
export default observer(MarkerSpotLabel); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import classNames from 'classnames'; | ||
import { observer } from 'mobx-react'; | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
|
||
const MarkerSpot = ({ className, spot_count }) => ( | ||
<div className={classNames('chart-spot', className)}>{spot_count}</div> | ||
); | ||
|
||
MarkerSpot.propTypes = { | ||
className: PropTypes.string, | ||
spot_count: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
}; | ||
|
||
export default observer(MarkerSpot); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need this for portfolio-store.js