Skip to content
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

V20190516_0 #63

Merged
merged 29 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6b63a20
Added legacy support for `localhost` and `binary.sx` envs in `urlFor()`
msamprz May 15, 2019
cec9e22
Fix ongoing contract switching
easteregg May 15, 2019
91ad03d
fixes for smartcharts epoch and added static chart prop for smartcharts
zaki-hanafiah May 15, 2019
bd5215c
added comment for is_from_positions flag in contract-store
zaki-hanafiah May 15, 2019
299520e
fixed start_epoch not sent for ended contracts, changed is_ongoing_co…
zaki-hanafiah May 15, 2019
9de1dfe
refactoring is_ongoing
zaki-hanafiah May 15, 2019
79096e4
removed flag for checking static contract
zaki-hanafiah May 15, 2019
7be29dc
set is_static only for contracts from positions
zaki-hanafiah May 15, 2019
36506db
update smartcharts
zaki-hanafiah May 15, 2019
e7a5a44
Merge branch 'dev' of github.com:binary-com/deriv-app into epoch_and_…
zaki-hanafiah May 16, 2019
1e24d19
add new initial loading
cakasuma May 16, 2019
e653b98
only initial loading occur
cakasuma May 16, 2019
07795c6
remove webkit
cakasuma May 16, 2019
fc33eb5
Merge branch 'dev' into fix-ongoing-contracts
easteregg May 16, 2019
c2262a8
create barspinner mixin calculation
cakasuma May 16, 2019
2669016
add mixin for createBarspinner animation
cakasuma May 16, 2019
020e8f4
update comment mixin
cakasuma May 16, 2019
76fe326
fix footer header issue
cakasuma May 16, 2019
4882456
add comment
cakasuma May 16, 2019
459a268
Merge pull request #52 from msamprz/urlFor-fix
ashkanx May 16, 2019
d25936a
Merge pull request #58 from cakasuma/amam/loading_deriv
ashkanx May 16, 2019
d793252
Revert "amam/initial_loading_deriv"
ashkanx May 16, 2019
8bebda2
Merge pull request #60 from binary-com/revert-58-amam/loading_deriv
ashkanx May 16, 2019
2a41ff6
remove date_start for now until issue with ongoing contracts is resolved
zaki-hanafiah May 16, 2019
ac11f10
corrected commented code
zaki-hanafiah May 16, 2019
426377d
Merge branch 'dev' of github.com:binary-com/deriv-app into epoch_and_…
zaki-hanafiah May 16, 2019
3f8a4ff
Merge pull request #56 from zakibinary/epoch_and_static_updates
ashkanx May 16, 2019
e45f58c
Merge branch 'dev' into fix-ongoing-contracts
ashkanx May 16, 2019
a4c262c
Merge pull request #54 from easteregg/fix-ongoing-contracts
ashkanx May 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"react-router-dom": "5.0.0",
"react-transition-group": "2.4.0",
"sinon": "7.2.2",
"smartcharts-beta": "0.4.25",
"smartcharts-beta": "0.4.26",
"tt-react-custom-scrollbars": "4.2.1-tt2",
"url-polyfill": "1.0.9",
"web-push-notifications": "3.2.15"
Expand Down
6 changes: 5 additions & 1 deletion src/javascript/_common/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ const Url = (() => {
const url = window.location.href;
let domain = url.substring(0, url.indexOf(`/${url_lang}/`) + url_lang.length + 2);
if (should_change_to_legacy) {
domain = domain.replace(/deriv\.app/, 'binary\.com');
if (/localhost|binary\.sx/.test(domain)) {
domain = `https://binary.com/${url_lang}/`;
} else {
domain = domain.replace(/deriv\.app/, 'binary\.com');
}
}
const new_url = `${domain}${(normalizePath(path) || 'home')}.html${(pars ? `?${pars}` : '')}`;
// replace old lang with new lang
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ResultOverlay = ({
'result__caption--lost': (result === 'lost'),
}
)}
onClick={() => onClick(contract_id)}
onClick={() => onClick(contract_id, true)}
>
{
(result === 'won') ?
Expand Down
5 changes: 4 additions & 1 deletion src/javascript/app/App/Containers/Layout/footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const Footer = ({
is_positions_drawer_on,
is_settings_dialog_on,
showFullBlur,
show_positions_toggle,
togglePositionsDrawer,
toggleSettingsDialog,
}) => (
Expand All @@ -32,7 +33,7 @@ const Footer = ({
>
<div className='footer__links footer__links--left'>
{
is_logged_in &&
(is_logged_in && show_positions_toggle) &&
<TogglePositions
is_positions_drawer_on={is_positions_drawer_on}
togglePositionsDrawer={togglePositionsDrawer}
Expand Down Expand Up @@ -64,6 +65,7 @@ Footer.propTypes = {
is_logged_in : PropTypes.bool,
is_positions_drawer_on : PropTypes.bool,
is_settings_dialog_on : PropTypes.bool,
show_positions_toggle : PropTypes.bool,
togglePositionsDrawer : PropTypes.func,
toggleSettingsDialog : PropTypes.func,
};
Expand All @@ -80,6 +82,7 @@ export default connect(
is_positions_drawer_on : ui.is_positions_drawer_on,
is_settings_dialog_on : ui.is_settings_dialog_on,
showFullBlur : ui.showFullBlur,
show_positions_toggle : ui.show_positions_toggle,
togglePositionsDrawer : ui.togglePositionsDrawer,
toggleSettingsDialog : ui.toggleSettingsDialog,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@ const ProgressSliderStream = ({

ProgressSliderStream.propTypes = {
getPositionById: PropTypes.func,
id : PropTypes.oneOfType(
PropTypes.number,
PropTypes.string
),
is_loading : PropTypes.bool,
server_time: PropTypes.object,
id : PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
is_loading : PropTypes.bool,
server_time : PropTypes.object,
};

export default connect(({ modules, common }) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ContractLink = ({
<a
className={className}
href='javascript:;'
onClick={() => openContract(contract_id)}
onClick={() => openContract(contract_id, true)}
>
{children}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Chart extends React.Component {
clearChart={this.props.should_clear_chart}
importedLayout={this.props.should_import_layout ? this.props.trade_chart_layout : null}
onExportLayout={this.props.should_export_layout ? this.props.exportLayout : null}
isStaticChart={this.props.is_static_chart}
>
{ this.props.markers_array.map((marker, idx) => (
<ChartMarker
Expand All @@ -88,6 +89,7 @@ Chart.propTypes = {
is_contract_mode : PropTypes.bool,
is_mobile : PropTypes.bool,
is_socket_opened : PropTypes.bool,
is_static_chart : PropTypes.bool,
is_title_enabled : PropTypes.bool,
markers_array : PropTypes.array,
onMount : PropTypes.func,
Expand Down Expand Up @@ -120,6 +122,7 @@ export default connect(
granularity : modules.smart_chart.granularity,
is_contract_mode : modules.smart_chart.is_contract_mode,
is_title_enabled : modules.smart_chart.is_title_enabled,
is_static_chart : modules.smart_chart.is_static_chart,
markers_array : modules.smart_chart.markers_array,
onMount : modules.smart_chart.onMount,
onUnmount : modules.smart_chart.onUnmount,
Expand Down
6 changes: 6 additions & 0 deletions src/javascript/app/Modules/Trading/Containers/trade.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const SmartChart = React.lazy(() => import(/* webpackChunkName: "smart_chart" */

class Trade extends React.Component {
componentDidMount() {
this.props.showPositions();
this.props.onMount();
}

componentWillUnmount() {
this.props.hidePositions();
if (this.props.is_contract_mode) {
this.props.onCloseContract();
}
Expand Down Expand Up @@ -74,6 +76,7 @@ Trade.propTypes = {
chart_id : PropTypes.string,
chart_zoom : PropTypes.number,
contract_type : PropTypes.string,
hidePositions : PropTypes.func,
is_contract_mode : PropTypes.bool,
is_digit_contract: PropTypes.bool,
is_mobile : PropTypes.bool,
Expand All @@ -86,6 +89,7 @@ Trade.propTypes = {
purchase_info : PropTypes.object,
scroll_to_epoch : PropTypes.number,
scroll_to_offset : PropTypes.number,
showPositions : PropTypes.func,
symbol : PropTypes.string,
};

Expand All @@ -105,6 +109,8 @@ export default connect(
onUnmount : modules.trade.onUnmount,
purchase_info : modules.trade.purchase_info,
symbol : modules.trade.symbol,
hidePositions : ui.hidePositionsFooterToggle,
showPositions : ui.showPositionsFooterToggle,
has_only_forward_starting_contracts: ui.has_only_forward_starting_contracts,
is_mobile : ui.is_mobile,
setHasOnlyForwardingContracts : ui.setHasOnlyForwardingContracts,
Expand Down
59 changes: 40 additions & 19 deletions src/javascript/app/Stores/Modules/Contract/contract-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ export default class ContractStore extends BaseStore {

// ---- Normal properties ---
forget_id;
chart_type = 'mountain';
is_granularity_set = false;
is_left_epoch_set = false;
chart_type = 'mountain';
is_granularity_set = false;
is_left_epoch_set = false;
is_from_positions = false;
is_ongoing_contract = false;

// -------------------
// ----- Actions -----
Expand All @@ -56,8 +58,16 @@ export default class ContractStore extends BaseStore {
const end_time = getEndTime(contract_info);
const should_update_chart_type = (!contract_info.tick_count && !this.is_granularity_set);

SmartChartStore.setContractStart(date_start);
if (!end_time) this.is_ongoing_contract = true;

// finish contracts if end_time exists
if (end_time) {
if (!this.is_ongoing_contract) {
SmartChartStore.setStaticChart(true);
} else {
SmartChartStore.setStaticChart(false);
}
SmartChartStore.setContractStart(date_start);
SmartChartStore.setContractEnd(end_time);

if (should_update_chart_type) {
Expand All @@ -66,17 +76,25 @@ export default class ContractStore extends BaseStore {
SmartChartStore.updateGranularity(0);
SmartChartStore.updateChartType('mountain');
}
// setters for ongoing contracts, will only init once onMount after left_epoch is set
} else if (!this.is_left_epoch_set) {
// For tick contracts, it is necessary to set the chartType and granularity after saving and clearing trade layout
// TODO: Fix issue with setting start_epoch and loading ongoing contract from positions
// if (this.is_from_positions) {
// SmartChartStore.setContractStart(date_start);
// }

if (contract_info.tick_count) {
SmartChartStore.updateGranularity(0);
SmartChartStore.updateChartType('mountain');
}
this.is_left_epoch_set = true;
SmartChartStore.setChartView(contract_info.purchase_time);
} else if (should_update_chart_type) {
}
if (should_update_chart_type && !contract_info.tick_count) {
this.handleChartType(SmartChartStore, date_start, null);
} else if (this.is_granularity_set) {
}
if (this.is_granularity_set) {
if (getChartType(date_start, null) !== this.chart_type) {
this.is_granularity_set = false;
}
Expand All @@ -87,19 +105,20 @@ export default class ContractStore extends BaseStore {
}

@action.bound
onMount(contract_id) {
onMount(contract_id, is_from_positions) {
if (contract_id === +this.contract_id) return;
if (this.root_store.modules.smart_chart.is_contract_mode) this.onCloseContract();
this.onSwitchAccount(this.accountSwitcherListener.bind(null));
this.has_error = false;
this.error_message = '';
this.contract_id = contract_id;
this.smart_chart = this.root_store.modules.smart_chart;
this.is_from_positions = is_from_positions;

if (contract_id) {
this.smart_chart.saveAndClearTradeChartLayout();
this.smart_chart.setContractMode(true);
WS.subscribeProposalOpenContract(this.contract_id, this.updateProposal, false);
WS.subscribeProposalOpenContract(this.contract_id.toString(), this.updateProposal, false);
}
}

Expand All @@ -112,17 +131,19 @@ export default class ContractStore extends BaseStore {
@action.bound
onCloseContract() {
this.forgetProposalOpenContract();
this.chart_type = 'mountain';
this.contract_id = null;
this.contract_info = {};
this.digits_info = {};
this.error_message = '';
this.forget_id = null;
this.has_error = false;
this.is_granularity_set = false;
this.is_sell_requested = false;
this.is_left_epoch_set = false;
this.sell_info = {};
this.chart_type = 'mountain';
this.contract_id = null;
this.contract_info = {};
this.digits_info = {};
this.error_message = '';
this.forget_id = null;
this.has_error = false;
this.is_granularity_set = false;
this.is_sell_requested = false;
this.is_left_epoch_set = false;
this.is_from_positions = false;
this.is_ongoing_contract = false;
this.sell_info = {};

this.smart_chart.cleanupContractChartView();
this.smart_chart.applySavedTradeChartLayout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ export default class PortfolioStore extends BaseStore {
this.pushNewPosition(new_pos);
});
// subscribe to new contract:
WS.subscribeProposalOpenContract(contract_id, this.proposalOpenContractHandler, false);
WS.subscribeProposalOpenContract(contract_id.toString(), this.proposalOpenContractHandler, false);
} else if (act === 'sell') {
const i = this.getPositionIndexById(contract_id);
this.positions[i].is_loading = true;
WS.subscribeProposalOpenContract(contract_id, this.populateResultDetails, false);
WS.subscribeProposalOpenContract(contract_id.toString(), this.populateResultDetails, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default class SmartChartStore extends BaseStore {
@observable markers = observable.object({});

@observable is_contract_mode = false;
@observable is_static_chart = false;
@observable is_title_enabled = true;

@observable start_epoch;
Expand Down Expand Up @@ -63,6 +64,7 @@ export default class SmartChartStore extends BaseStore {
this.setContractMode(false);
this.setContractStart(null);
this.setContractEnd(null);
this.setStaticChart(false);
}

@action.bound
Expand Down Expand Up @@ -180,6 +182,11 @@ export default class SmartChartStore extends BaseStore {
this.should_clear_chart = true;
}

@action.bound
setStaticChart(bool) {
this.is_static_chart = bool;
}

@computed
get barriers_array() {
return barriersObjectToArray(this.barriers);
Expand Down
15 changes: 13 additions & 2 deletions src/javascript/app/Stores/ui-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ export default class UIStore extends BaseStore {
@observable duration_h = 1;
@observable duration_d = 1;

@observable is_fully_blurred = false;
@observable is_app_blurred = false;
@observable is_fully_blurred = false;
@observable is_app_blurred = false;
@observable show_positions_toggle = true;

getDurationFromUnit = (unit) => this[`duration_${unit}`];

Expand Down Expand Up @@ -177,6 +178,16 @@ export default class UIStore extends BaseStore {
return this.is_dark_mode_on;
}

@action.bound
showPositionsFooterToggle() {
this.show_positions_toggle = true;
}

@action.bound
hidePositionsFooterToggle() {
this.show_positions_toggle = false;
}

@action.bound
toggleSettingsDialog() {
this.is_settings_dialog_on = !this.is_settings_dialog_on;
Expand Down
11 changes: 5 additions & 6 deletions src/sass/app/_common/form/input-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,29 @@
vertical-align: middle;
width: 16px;
height: 16px;
border-radius: 1px;
border-width: 0.5px;
border-radius: 0;
padding: 0;
@include themify($themes) {
background-color: themed('background_container_color');
border-color: themed('text_secondary_color');
border: 1px solid themed('text_secondary_color');
}

&:active {
@include themify($themes) {
border-color: $COLOR_ORANGE;
border-radius: 1px;
border-radius: 0;
box-shadow: none;
}
}
&:hover {
@include themify($themes) {
border-color: themed('text_color');
border-radius: 1px;
border-radius: 0;
box-shadow: none;
}
}
&:focus {
border-radius: 1px;
border-radius: 0;
box-shadow: none;
}
&:checked {
Expand Down