Skip to content

Commit

Permalink
chore: added price tags for barriers in contract details (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
maryia-deriv committed Oct 12, 2022
1 parent 93890a8 commit 608e7de
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
9 changes: 8 additions & 1 deletion packages/core/src/Stores/chart-barrier-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ export class ChartBarrierStore {

onChartBarrierChange;

constructor(high_barrier, low_barrier, onChartBarrierChange = null, { color, line_style, not_draggable } = {}) {
constructor(
high_barrier,
low_barrier,
onChartBarrierChange = null,
{ color, hideBarrierLine, line_style, not_draggable, shade } = {}
) {
this.color = color;
this.hideBarrierLine = hideBarrierLine;
this.shade = shade;
this.lineStyle = line_style || BARRIER_LINE_STYLES.SOLID;
this.onChange = this.onBarrierChange;

Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/Stores/contract-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
getContractValidationRules,
BARRIER_COLORS,
BARRIER_LINE_STYLES,
DEFAULT_SHADES,
isBarrierSupported,
getEndTime,
} from '@deriv/shared';
Expand Down Expand Up @@ -167,8 +168,10 @@ export default class ContractStore extends BaseStore {
// create barrier only when it's available in response
const main_barrier = new ChartBarrierStore(barrier || high_barrier || entry_spot, low_barrier, null, {
color: is_dark_mode ? BARRIER_COLORS.DARK_GRAY : BARRIER_COLORS.GRAY,
line_style: BARRIER_LINE_STYLES.SOLID,
line_style: !isAccumulatorContract(contract_type) && BARRIER_LINE_STYLES.SOLID,
not_draggable: true,
hideBarrierLine: isAccumulatorContract(contract_type),
shade: isAccumulatorContract(contract_type) && DEFAULT_SHADES['2'],
});

main_barrier.updateBarrierShade(true, contract_type);
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/utils/constants/barriers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export const CONTRACT_SHADES = {
ASIAND: 'BELOW',
MULTUP: 'ABOVE',
MULTDOWN: 'BELOW',
ACCU: 'BETWEEN',
DECCU: 'OUTSIDE',
ACCU: 'NONE_DOUBLE',
DECCU: 'NONE_DOUBLE',
};

// Default non-shade according to number of barriers
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/src/utils/helpers/dummy_accumulators_data.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable no-unused-vars */
/* eslint-disable prefer-const */
const dummy_current_time = 1665570506; // should be an epoch of some real tick!
const dummy_current_time = 1665585812; // should be an epoch of some real tick!
const dummy_start_time = dummy_current_time - 7;
const dummy_end_time = dummy_current_time + 6;

const high_barrier = 6534;
const low_barrier = 6532;
const high_barrier = 6528;
const low_barrier = 6527;
const tick_1_price = low_barrier + 0.1;
const tick_2_price = low_barrier + 0.15;
const tick_3_price = low_barrier + 0.5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export const CONTRACT_SHADES = {
ASIAND: 'BELOW',
MULTUP: 'ABOVE',
MULTDOWN: 'BELOW',
ACCU: 'BETWEEN',
DECCU: 'OUTSIDE',
ACCU: 'NONE_DOUBLE',
DECCU: 'NONE_DOUBLE',
};

// Default non-shade according to number of barriers
Expand Down

0 comments on commit 608e7de

Please sign in to comment.