Delay block tx request, make leftover txes gray and fade out, remove unneeded assets and one paint blob

This commit is contained in:
Joshua Seigler 2019-04-09 17:30:18 -04:00
parent 4036462321
commit faaaf51a5b
12 changed files with 30 additions and 33 deletions

View file

@ -8,7 +8,6 @@ import { PSDENOMINATIONS, COLORS, PAINT } from './constants';
export default class App { export default class App {
constructor() { constructor() {
this.blockRefs = [];
this.blockList = document.getElementById('blockList'); this.blockList = document.getElementById('blockList');
this.connectionStatus = document.getElementById('connectionStatus'); this.connectionStatus = document.getElementById('connectionStatus');
this.hero = document.getElementById('hero'); this.hero = document.getElementById('hero');
@ -105,38 +104,34 @@ export default class App {
blockLink.setAttribute('rel', 'noopener'); blockLink.setAttribute('rel', 'noopener');
blockLink.appendChild(document.createTextNode('🗗')); blockLink.appendChild(document.createTextNode('🗗'));
fetch('https://insight.dash.org/insight-api/block/' + data) setTimeout(() => { // to prevent 404 when WS is ahead of regular API
.then(resp => resp.json()) fetch('https://insight.dash.org/insight-api/block/' + data)
.then(data => { .then(resp => resp.json())
let leftovers = []; .then(data => {
for (var i in data.tx) { let leftovers = [];
const txid = data.tx[i]; for (var i in data.tx) {
let paint = document.getElementById(txid); const txid = data.tx[i];
if (paint) { let paint = document.getElementById(txid);
completedBlock.insertBefore(paint, completedBlock.firstChild); if (paint) {
} completedBlock.insertBefore(paint, completedBlock.firstChild);
}
Array.from(this.hero.children).forEach(item => {
if (item.data_ignored > 3) {
item.remove();
} else {
if (item.data_ignored) {
item.data_ignored++;
} else {
item.classList.add('stale');
item.data_ignored = 1;
} }
} }
}); Array.from(this.hero.children).forEach(item => {
completedBlock.appendChild(blockLink); const age = 1 * item.style.getPropertyValue('--age'); // 1 * null = 0
if (this.blockRefs.unshift(this.completedBlock) > 8) { if (age > 10) {
var toDelete = this.blockRefs.pop(); item.remove();
if (toDelete) { } else {
toDelete.remove(); item.classList.add('stale');
item.style.setProperty('--age',age + 1);
}
});
completedBlock.appendChild(blockLink);
this.blockList.insertBefore(completedBlock, this.blockList.firstChild);
if (this.blockList.children.length > 8) {
this.blockList.lastChild.remove();
} }
} });
this.blockList.insertBefore(completedBlock, this.blockList.firstChild); }, 200);
});
} }
static isPrivateSend(components) { static isPrivateSend(components) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -24,7 +24,7 @@ export const PAINT = {
'paint-big09.svg', 'paint-big09.svg',
'paint-big10.svg', 'paint-big10.svg',
'paint-big11.svg', 'paint-big11.svg',
'paint-big12.svg' 'paint-big12.svg',
], ],
small: [ small: [
'paint01.svg', 'paint01.svg',
@ -37,6 +37,5 @@ export const PAINT = {
'paint08.svg', 'paint08.svg',
'paint09.svg', 'paint09.svg',
'paint10.svg', 'paint10.svg',
'paint11.svg',
] ]
}; };

View file

@ -99,6 +99,10 @@ a {
-webkit-mask-position: center; -webkit-mask-position: center;
mask-position: center; mask-position: center;
} }
#hero .paint.stale {
background-color: gray;
opacity: calc(1.1 - var(--age) / 10);
}
#muteToggle, #connectionStatus { #muteToggle, #connectionStatus {
position: fixed; position: fixed;