Commit acd84d8c authored by Eriksson Monteiro's avatar Eriksson Monteiro

add tangled video. improve millix wallet ui. enable auto recover millix node process

parent 1d7ba2f0
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -363,6 +363,16 @@ a {
color: #d5d5d5;
}
.btn-disabled:hover, .btn-disabled:focus, .btn-disabled:active {
background-color: transparent;
border-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
outline: none;
outline-offset: 0;
cursor: default;
}
/**
dark mode
*/
......@@ -558,3 +568,39 @@ input:focus {
position: relative;
max-width: 965px;
}
@-webkit-keyframes rotating /* Safari and Chrome */ {
from {
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes rotating {
from {
-ms-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-ms-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.rotating {
-webkit-animation: rotating 2s linear infinite;
-moz-animation: rotating 2s linear infinite;
-ms-animation: rotating 2s linear infinite;
-o-animation: rotating 2s linear infinite;
animation: rotating 2s linear infinite;
}
\ No newline at end of file
......@@ -22,7 +22,7 @@
<span class="left-bar"></span>
<span class="right-bar"></span>
</a>
<div class="col-9 m-0 w182 mt-1 pl-6 h-50 hidden" id="wallet_unlock" >
<div class="col-9 m-0 w182 mt-1 pl-6 h-50 hidden" id="wallet_unlock">
<div class="row btn btn-default btn-unlock">
<div class="col-1 m-0 mr-0 w21 left">
<a><i style="line-height: 31px;">
......@@ -52,6 +52,33 @@
</div>
</div>
</div>
<div class="col-9 m-0 w182 mt-1 pl-6 h-50" id="wallet_restart">
<div class="row btn btn-default btn-unlock">
<div class="col-1 m-0 mr-0 w21 left" id="btn-restart-icon">
<a class="hidden" id="btn-restart-icon-power"><i style="line-height: 31px;">
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="power-off"
class="svg-inline--fa fa-power-off fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512" style="width: 1.1em;">
<path fill="currentColor"
d="M400 54.1c63 45 104 118.6 104 201.9 0 136.8-110.8 247.7-247.5 248C120 504.3 8.2 393 8 256.4 7.9 173.1 48.9 99.3 111.8 54.2c11.7-8.3 28-4.8 35 7.7L162.6 90c5.9 10.5 3.1 23.8-6.6 31-41.5 30.8-68 79.6-68 134.9-.1 92.3 74.5 168.1 168 168.1 91.6 0 168.6-74.2 168-169.1-.3-51.8-24.7-101.8-68.1-134-9.7-7.2-12.4-20.5-6.5-30.9l15.8-28.1c7-12.4 23.2-16.1 34.8-7.8zM296 264V24c0-13.3-10.7-24-24-24h-32c-13.3 0-24 10.7-24 24v240c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24z">
</path>
</svg>
</i></a>
<a class="hidden" id="btn-restart-icon-spinner">
<i>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="width: 1.1em;" class="rotating">
<defs><style>.fa-secondary{opacity:.4}</style></defs>
<path d="M478.71 364.58zm-22 6.11l-27.83-15.9a15.92 15.92 0 0 1-6.94-19.2A184 184 0 1 1 256 72c5.89 0 11.71.29 17.46.83-.74-.07-1.48-.15-2.23-.21-8.49-.69-15.23-7.31-15.23-15.83v-32a16 16 0 0 1 15.34-16C266.24 8.46 261.18 8 256 8 119 8 8 119 8 256s111 248 248 248c98 0 182.42-56.95 222.71-139.42-4.13 7.86-14.23 10.55-22 6.11z" class="fa-secondary"/>
<path d="M271.23 72.62c-8.49-.69-15.23-7.31-15.23-15.83V24.73c0-9.11 7.67-16.78 16.77-16.17C401.92 17.18 504 124.67 504 256a246 246 0 0 1-25 108.24c-4 8.17-14.37 11-22.26 6.45l-27.84-15.9c-7.41-4.23-9.83-13.35-6.2-21.07A182.53 182.53 0 0 0 440 256c0-96.49-74.27-175.63-168.77-183.38z" class="fa-primary"/>
</svg>
</i>
</a>
</div>
<div class="col-9 w90 m-0 btn-unlock-text" id="btn-restart-label">
restart node
</div>
</div>
</div>
<div class="col-9 m-0 w182 mt-2 mt-0 h-37 pt-7 btn btn-default hidden" id="wallet">
<div class="row">
<div class="col-1 m-0 ml-15 w16 left">
......
......@@ -11,6 +11,7 @@ cr.define('millix_bar', function () {
let millixAPIFrame;
let lastKnownTransaction = undefined;
let reloadTimeout = undefined;
let walletLocked = true;
let unlockFromBar = false;
const audioDeposit = new Audio('/deposit.mp3');
......@@ -44,6 +45,10 @@ cr.define('millix_bar', function () {
millixAPIFrame.contentWindow.postMessage({
type: 'get_session'
}, 'chrome-untrusted://millix-ws/');
millixAPIFrame.contentWindow.postMessage({
type: 'api_check'
}, 'chrome-untrusted://millix-ws/');
}
function showMillixWallet() {
......@@ -60,6 +65,7 @@ cr.define('millix_bar', function () {
}
$('#wallet_unlock').addClass('hidden');
$('#wallet_restart').addClass('hidden');
$('#wallet').removeClass('hidden');
$('#btn_expand').removeClass('hidden');
......@@ -83,6 +89,7 @@ cr.define('millix_bar', function () {
console.log("[deactivateWallet]");
$('#wallet').addClass('hidden');
$('#btn_expand').addClass('hidden');
$('#wallet_restart').addClass('hidden');
$('#wallet_unlock').removeClass('hidden');
expandView(false);
......@@ -91,6 +98,47 @@ cr.define('millix_bar', function () {
}, 'chrome-untrusted://millix-ws/');
}
function doNodeRestart() {
clearTimeout(reloadTimeout);
$('#btn-restart-label').text('restarting');
$('#btn-restart-icon').removeClass('hidden');
$('#btn-restart-icon-power').addClass('hidden');
$('#btn-restart-icon-spinner').removeClass('hidden');
$('#wallet_restart > .btn').addClass('btn-disabled');
chrome.send('restartMillixNode');
}
function restartWallet() {
refreshMillixWallet();
updateNodeStat(null);
walletLocked = true;
console.log("[restartWallet]");
$('#wallet').addClass('hidden');
$('#btn_expand').addClass('hidden');
$('#wallet_unlock').addClass('hidden');
let counter = 10;
const updateRestartTimeout = () => {
$('#btn-restart-label').text(`restart node (${counter}s)`);
counter--;
if (counter == 0) {
doNodeRestart();
} else {
reloadTimeout = setTimeout(() => {
updateRestartTimeout();
}, 1000);
}
}
updateRestartTimeout();
$('#btn-restart-icon').removeClass('hidden');
$('#btn-restart-icon-power').removeClass('hidden');
$('#btn-restart-icon-spinner').addClass('hidden');
$('#wallet_restart > .btn').removeClass('btn-disabled');
$('#wallet_restart').removeClass('hidden');
expandView(false);
}
function updateNodeStat(nodeStat) {
if (walletLocked && nodeStat) {
return;
......@@ -144,6 +192,9 @@ cr.define('millix_bar', function () {
$('#wallet_log').click(() => showMillixWallet());
$('#wallet_backlog').click(() => showMillixWallet());
$('#wallet_transaction').click(() => chrome.send('showMillixWallet', ['history']));
$('#wallet_restart').click(() => {
doNodeRestart();
});
cr.addWebUIListener("onThemeChanged", refreshThemeStyles.bind(this));
}
......@@ -206,6 +257,7 @@ cr.define('millix_bar', function () {
initialize,
connectToWallet,
deactivateWallet,
restartWallet,
activateWallet,
onMillixBarMessage,
updateNodeStat,
......@@ -237,6 +289,12 @@ window.addEventListener('message', ({ data }) => {
case 'node_stat':
millix_bar.updateNodeStat(data.data);
break;
case 'node_error':
millix_bar.restartWallet();
break;
case 'node_restarted':
millix_bar.deactivateWallet();
break;
case 'initialize':
chrome.send('initialize', []);
break;
......
class _API {
static HOST = 'https://localhost:5500/api';
static HOST = 'https://localhost:5500';
static NODE_API = `${_API.HOST}/api`;
constructor() {
this.nodeID = undefined;
this.nodeSignature = undefined;
this.apiHealthCheckFail = 0;
}
setNodeID(nodeID) {
......@@ -18,7 +20,29 @@ class _API {
if (!this.nodeID || !this.nodeSignature) {
throw Error('api is not ready');
}
return `${_API.HOST}/${this.nodeID}/${this.nodeSignature}`;
return `${_API.NODE_API}/${this.nodeID}/${this.nodeSignature}`;
}
apiHealthCheck() {
try {
return fetch(`${_API.HOST}`)
.then(response => {
if (this.apiHealthCheckFail >= 3) {
window.parent.postMessage({ type: 'node_restarted' }, 'tangled://millix-bar');
}
this.apiHealthCheckFail = 0;
return response.json();
}).catch(e => {
this.apiHealthCheckFail++;
if (this.apiHealthCheckFail === 3) {
window.parent.postMessage({ type: 'node_error' }, 'tangled://millix-bar');
}
throw e;
});
}
catch (e) {
return Promise.reject(e);
}
}
getLastTransaction(addressKeyIdentifier) {
......@@ -164,6 +188,14 @@ function readStat() {
.catch(() => readStatHandlerID = setTimeout(() => readStat(), 1000));
}
let apiCheckHandlerID = null;
function apiCheck() {
apiCheckHandlerID = true;
API.apiHealthCheck()
.then(() => apiCheckHandlerID = setTimeout(() => apiCheck(), 1000))
.catch(() => apiCheckHandlerID = setTimeout(() => apiCheck(), 1000));
}
window.addEventListener('message', ({ data }) => {
console.log("[millix_ws]", data);
switch (data.type) {
......@@ -206,5 +238,10 @@ window.addEventListener('message', ({ data }) => {
readStatHandlerID = null;
}
break;
case 'api_check':
if (!apiCheckHandlerID) {
apiCheck();
}
break;
}
});
......@@ -337,6 +337,7 @@ generate_grd("build_grd") {
input_files = [
"new_tab_page.html",
"shared_vars.css",
"fontawesome.css",
"one_google_bar_api.js",
"untrusted/background_image.html",
"untrusted/background_image.js",
......@@ -348,6 +349,7 @@ generate_grd("build_grd") {
grdp_files = [
"$target_gen_dir/icons/resources.grdp",
"$target_gen_dir/webfonts/resources.grdp",
"$target_gen_dir/new_tab_page_mojo_resources.grdp",
"$target_gen_dir/promo_browser_command_mojo_resources.grdp",
"$target_gen_dir/realbox/realbox_mojo_resources.grdp",
......@@ -363,6 +365,7 @@ generate_grd("build_grd") {
":build_promo_browser_command_mojo_grdp",
":build_task_module_mojo_grdp",
"icons:build_grdp",
"webfonts:build_grdp",
"realbox:build_realbox_mojo_grdp",
"realbox:build_search_mojo_grdp",
]
......
......@@ -632,9 +632,7 @@ class AppElement extends PolymerElement {
* @private
*/
computeDoodleAllowed_() {
return loadTimeData.getBoolean('themeModeDoodlesEnabled') ||
!this.showBackgroundImage_ && this.theme_ && this.theme_.isDefault &&
!this.theme_.isDark;
return false;
}
/**
......
This diff is collapsed.
......@@ -32,6 +32,7 @@ generate_grd("build_grdp") {
"upload.svg",
"background.jpg",
"millix.svg",
"tangled_browser.mp4"
]
input_files_base_dir = rebase_path(".", "//")
resource_path_prefix = "icons"
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Pro 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><defs><style>.fa-secondary{opacity:.4}</style></defs><path d="M144 31H48A48 48 0 0 0 0 79v352a48 48 0 0 0 48 48h96a48 48 0 0 0 48-48V79a48 48 0 0 0-48-48zm-16 368a16 16 0 0 1-16 16H80a16 16 0 0 1-16-16V111a16 16 0 0 1 16-16h32a16 16 0 0 1 16 16zM400 31h-96a48 48 0 0 0-48 48v352a48 48 0 0 0 48 48h96a48 48 0 0 0 48-48V79a48 48 0 0 0-48-48zm-16 368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V111a16 16 0 0 1 16-16h32a16 16 0 0 1 16 16z" class="fa-secondary"/><path d="M112 95H80a16 16 0 0 0-16 16v288a16 16 0 0 0 16 16h32a16 16 0 0 0 16-16V111a16 16 0 0 0-16-16zm256 0h-32a16 16 0 0 0-16 16v288a16 16 0 0 0 16 16h32a16 16 0 0 0 16-16V111a16 16 0 0 0-16-16z" class="fa-primary"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Pro 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><defs><style>.fa-secondary{opacity:.4}</style></defs><path d="M424.41 214.66L72.41 6.55C43.81-10.34 0 6.05 0 47.87V464c0 37.5 40.69 60.09 72.41 41.3l352-208c31.4-18.54 31.5-64.14 0-82.64zM321.89 283.5L112.28 407.35C91 420 64 404.58 64 379.8V132c0-24.78 27-40.16 48.28-27.54l209.61 123.95a32 32 0 0 1 0 55.09z" class="fa-secondary"/><path d="M112.28 104.48l209.61 123.93a32 32 0 0 1 0 55.09L112.28 407.35C91 420 64 404.58 64 379.8V132c0-24.76 27-40.14 48.28-27.52z" class="fa-primary"/></svg>
\ No newline at end of file
......@@ -38,7 +38,7 @@ class LogoElement extends PolymerElement {
doodleAllowed: {
reflectToAttribute: true,
type: Boolean,
value: true,
value: false,
},
/**
......@@ -464,6 +464,33 @@ class LogoElement extends PolymerElement {
'--width': this.width_,
});
}
/** @private */
onPlayClick_(){
const playControl = $$(this, '#video_control');
const video = $$(this, '#video');
const logo = $$(this, '#logo');
if(playControl.classList.contains('fa-play-circle')) {
playControl.classList.remove('fa-play-circle');
playControl.classList.add('fa-pause-circle');
logo.classList.remove('fade-in');
logo.classList.add('fade-out');
video.classList.remove('fade-out');
video.classList.add('fade-in');
} else {
playControl.classList.remove('fa-pause-circle');
playControl.classList.add('fa-play-circle');
logo.classList.remove('fade-out');
logo.classList.add('fade-in');
video.classList.remove('fade-in');
video.classList.add('fade-out');
}
}
}
customElements.define(LogoElement.is, LogoElement);
......@@ -18,5 +18,6 @@
<script type="module" src="new_tab_page.js"></script>
<link rel="stylesheet" href="tangled://resources/css/text_defaults_md.css">
<link rel="stylesheet" href="shared_vars.css">
<link rel="stylesheet" href="fontawesome.css">
</body>
</html>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment