Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 71b2f64

Browse files
committed
DP2P import POC
1 parent c07e097 commit 71b2f64

File tree

8 files changed

+143
-2
lines changed

8 files changed

+143
-2
lines changed

build/config/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const release_config = {
3939

4040
const node_modules_paths = {
4141
binary_style: 'node_modules/@binary-com/binary-style',
42+
deriv_p2p : 'node_modules/@deriv/p2p',
4243
};
4344

4445
const config = {

build/cssmin.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ module.exports = {
1212
],
1313
dest: `${global.dist}/css/common.min.css`,
1414
},
15-
{ src: `${global.dist}/css/app.css`, dest: `${global.dist}/css/app.min.css` },
16-
{ src: `${global.dist}/css/static.css`, dest: `${global.dist}/css/static.min.css` },
15+
{ src: `${global.dist}/css/app.css`, dest: `${global.dist}/css/app.min.css` },
16+
{ src: `${global.node_modules_paths.deriv_p2p}/lib/main.css`, dest: `${global.dist}/css/p2p.min.css` },
17+
{ src: `${global.dist}/css/static.css`, dest: `${global.dist}/css/static.min.css` },
1718
],
1819
}
1920
};

scripts/config/pages.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ module.exports = [
6565
// ==================== Section: "static" ====================
6666
['404', 'static/404', 'full_width', '404'],
6767
['home', 'static/home', 'full_width', 'Online Trading platform for binary options on Forex, Indices, Commodities and Smart Indices'],
68+
['dp2p', 'static/dp2p', 'full_width', 'Deriv P2P'],
6869
['keep-safe', 'static/keep_safe', 'full_width', 'Keep Safe'],
6970
['tour', 'static/tour', 'full_width', 'Tour'],
7071
['why-us', 'static/why_us', 'full_width', 'Why Us'],

scripts/config/sitemap_urls.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = {
33
// path (without .html), changefreq, priority, exclude languages
44
// ==================== Section: "static" ====================
55
['home', 'monthly', 1.00],
6+
['dp2p', 'monthly', 1.00],
67
['tour', 'monthly', 0.80],
78
['why-us', 'monthly', 0.80],
89
['platforms', 'monthly', 0.80],

src/javascript/app/base/binary_pages.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const Contact = require('../../static/pages/contact');
5353
const Contact2 = require('../../static/pages/contact_2');
5454
const GetStarted = require('../../static/pages/get_started');
5555
const Home = require('../../static/pages/home');
56+
const DP2P = require('../../static/pages/dp2p');
5657
const JobDetails = require('../../static/pages/job_details');
5758
const Platforms = require('../../static/pages/platforms');
5859
const Regulation = require('../../static/pages/regulation');
@@ -89,6 +90,7 @@ const pages_config = {
8990
forex : { module: GetStarted.Forex },
9091
forwardws : { module: DepositWithdraw, is_authenticated: true, only_real: true },
9192
home : { module: Home, not_authenticated: true },
93+
dp2p : { module: DP2P, not_authenticated: true },
9294
iphistoryws : { module: IPHistory, is_authenticated: true },
9395
labuan : { module: StaticPages.Locations },
9496
landing_page : { module: StaticPages.LandingPage, is_authenticated: true, only_virtual: true },
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
const ReactDOM = require('react-dom');
2+
const React = require('react');
3+
const urlForStatic = require('../../_common/url').urlForStatic;
4+
5+
const DP2P = (() => {
6+
7+
const onLoad = () => {
8+
import('@deriv/p2p').then((module) => {
9+
const el_dp2p_container = document.getElementById('binary-dp2p');
10+
const shadowed_el_dp2p = el_dp2p_container.attachShadow({ mode: 'closed' });
11+
12+
// const el_head = document.querySelector('head');
13+
// const el_main_css = document.createElement('link');
14+
// el_main_css.href = urlForStatic('css/p2p.min.css');
15+
// el_main_css.rel = 'stylesheet';
16+
// el_main_css.type = 'text/css';
17+
// el_dp2p_container.innerHTML = module.default;
18+
19+
const el_main_css = document.createElement('style');
20+
el_main_css.innerHTML = `
21+
@import url(${urlForStatic('css/p2p.min.css')});
22+
:host {
23+
--hem:10px;
24+
}
25+
.dc-input__field {
26+
box-sizing:border-box;
27+
}
28+
.link {
29+
color: var(--brand-red-coral);
30+
font-weight: bold;
31+
text-decoration: none;
32+
}
33+
.link:hover {
34+
text-decoration: underline;
35+
cursor: pointer;
36+
}
37+
`;
38+
el_main_css.rel = 'stylesheet';
39+
40+
ReactDOM.render(
41+
// eslint-disable-next-line no-console
42+
React.createElement(module.default, { className: 'theme--light', websocket_api: { send(params) { console.log(params); return Promise.resolve(params); } }, lang: 'EN' }),
43+
shadowed_el_dp2p
44+
);
45+
46+
shadowed_el_dp2p.prepend(el_main_css);
47+
});
48+
};
49+
50+
const onUnload = () => {
51+
// TODO: Look into clearance
52+
};
53+
54+
return {
55+
onLoad,
56+
onUnload,
57+
};
58+
})();
59+
60+
module.exports = DP2P;

src/sass/static/pages.scss

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,3 +1609,65 @@ body #not_authenticated_financial ul.checked > li {
16091609
height: 4em;
16101610
width: 206px;
16111611
}
1612+
1613+
#binary-dp2p {
1614+
margin: 0 auto;
1615+
width: 1008px;
1616+
font-size: 10px;
1617+
//font-family: $FONT_STACK;
1618+
//text-rendering: optimizeLegibility;
1619+
//-webkit-font-smoothing: antialiased;
1620+
//-moz-osx-font-smoothing: grayscale;
1621+
//-webkit-text-size-adjust: 100%;
1622+
//-ms-text-size-adjust: 100%;
1623+
//box-sizing: border-box;
1624+
position: relative;
1625+
//
1626+
//h1, h2, h3, h4, h5, h6, p {
1627+
// margin: 0;
1628+
// padding: 0;
1629+
// border: 0;
1630+
// vertical-align: baseline;
1631+
//}
1632+
//input {
1633+
// &:hover, &:focus {
1634+
// border: none;
1635+
// }
1636+
//}
1637+
//.btn { // rebuild 14
1638+
// &--primary {
1639+
// &:active, &:focus {
1640+
// background: var(--button-primary-hover);
1641+
// }
1642+
// }
1643+
// &--secondary {
1644+
// &:active, &:focus {
1645+
// background: var(--button-secondary-hover);
1646+
// }
1647+
// }
1648+
// &--tertiary {
1649+
// &:active, &:focus {
1650+
// background: var(--button-tertiary-hover);
1651+
// }
1652+
// }
1653+
//}
1654+
//.dc-tabs {
1655+
// &__list {
1656+
// height: 41px;
1657+
// }
1658+
//}
1659+
//.dc-toggle-switch {
1660+
// &__label {
1661+
// &:before {
1662+
// display: none;
1663+
// }
1664+
// }
1665+
//}
1666+
//.buy-sell {
1667+
// &__header {
1668+
// &__filters {
1669+
// width: 120px;
1670+
// }
1671+
// }
1672+
//}
1673+
}

src/templates/static/dp2p.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
3+
// eslint-disable-next-line arrow-body-style
4+
const DP2P = () => {
5+
6+
return (
7+
<React.Fragment>
8+
<div id='binary-dp2p' />
9+
</React.Fragment>
10+
);
11+
};
12+
13+
export default DP2P;

0 commit comments

Comments
 (0)