🐛 fix colors

This commit is contained in:
Joshua Seigler 2019-07-25 14:58:25 -04:00
parent faaaf51a5b
commit 1f09e5d682

View file

@ -106,9 +106,15 @@ export default class App {
setTimeout(() => { // to prevent 404 when WS is ahead of regular API setTimeout(() => { // to prevent 404 when WS is ahead of regular API
fetch('https://insight.dash.org/insight-api/block/' + data) fetch('https://insight.dash.org/insight-api/block/' + data)
.then(resp => resp.json()) .then(resp => {
if (resp.ok) {
return resp.json();
} else {
return null;
}
})
.then(data => { .then(data => {
let leftovers = []; if (data) {
for (var i in data.tx) { for (var i in data.tx) {
const txid = data.tx[i]; const txid = data.tx[i];
let paint = document.getElementById(txid); let paint = document.getElementById(txid);
@ -125,6 +131,9 @@ export default class App {
item.style.setProperty('--age',age + 1); item.style.setProperty('--age',age + 1);
} }
}); });
} else {
Array.from(this.hero.children).forEach(item => completedBlock.appendChild(item));
}
completedBlock.appendChild(blockLink); completedBlock.appendChild(blockLink);
this.blockList.insertBefore(completedBlock, this.blockList.firstChild); this.blockList.insertBefore(completedBlock, this.blockList.firstChild);
if (this.blockList.children.length > 8) { if (this.blockList.children.length > 8) {
@ -147,19 +156,17 @@ export default class App {
onTransactionBuilder(target, addToMempool = false) { onTransactionBuilder(target, addToMempool = false) {
return (data) => { return (data) => {
const isMixing = App.isPrivateSend(data.vout); const isMixing = App.isPrivateSend(data.vout);
const isInstant = data.txlock || (data.vin && data.vin.length <= 4); const isComplex = data.vin && data.vin.length > 1;
const isSimple = data.txlock || (data.vin && data.vin.length <= 1);
const tx = { const tx = {
id: data.txid, id: data.txid,
mixing: isMixing, mixing: isMixing,
instant: isInstant, complex: isComplex,
simple: isSimple,
value: data.valueOut, value: data.valueOut,
x: parseInt(data.txid.slice(0, 4), 16) / 65536, x: parseInt(data.txid.slice(0, 4), 16) / 65536,
y: parseInt(data.txid.slice(4, 8), 16) / 65536, y: parseInt(data.txid.slice(4, 8), 16) / 65536,
rotation: parseInt(data.txid.slice(16, 17), 16) / 16, rotation: parseInt(data.txid.slice(16, 17), 16) / 16,
paintIndex: parseInt(data.txid.slice(17, 21), 16) / 65536, paintIndex: parseInt(data.txid.slice(17, 21), 16) / 65536,
color: isMixing ? COLORS.black : !isSimple ? COLORS.white : color: isMixing ? COLORS.black : isComplex ? COLORS.white :
'var(--color-'+ 'var(--color-'+
Math.floor(parseInt(data.txid.slice(21, 23), 16) / 256 * this.blockColors.length)+ Math.floor(parseInt(data.txid.slice(21, 23), 16) / 256 * this.blockColors.length)+
')' ')'