From 5859f754209e7ecba0393586fd35d1e22a21f11f Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Wed, 3 May 2023 00:46:01 +0530 Subject: [PATCH 1/7] allowing 8 decimal places for rupee token --- index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.html b/index.html index cb41817..8603c2b 100644 --- a/index.html +++ b/index.html @@ -144,7 +144,7 @@ function formatAmount(amount = 0, currency = 'inr') { if (!amount) return '0'; - return amount.toLocaleString(currency === 'inr' ? `en-IN` : 'en-US', { currency, maximumFractionDigits: currency === 'inr' ? 2 : 8 }) + return amount.toLocaleString(currency === 'inr' ? `en-IN` : 'en-US', { currency, maximumFractionDigits: 8 }) } // fetch data and return json async function fetchJson(url, options = {}) { @@ -1682,7 +1682,6 @@ } - // THIS TAG CONTAINS CODE REQUIRED FOR THE NAVBAR TO FUNCTION function returnHexNumber(s) { var regExp = /^[-+]?[0-9A-Fa-f]+\.?[0-9A-Fa-f]*?$/; return (typeof s === 'string' && regExp.test(s)); From 9d3013447ab207e7afa7aeeea1485f34794a2afd Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Thu, 11 May 2023 01:21:28 +0530 Subject: [PATCH 2/7] UX improvements and code refactoring --- index.html | 47 +++++++++++++++++++-------------------- scripts/components.min.js | 8 +++---- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/index.html b/index.html index 8603c2b..7a6508f 100644 --- a/index.html +++ b/index.html @@ -771,12 +771,16 @@
Sender
- ${sender} + + ${sender} +
${receiver ? html`
Receiver
- ${receiver} + + ${receiver} +
`: '' } @@ -1115,11 +1119,15 @@
Sender
- ${sender} + + ${sender} +
Receiver
- ${receiver} + + ${receiver} +
@@ -1153,7 +1161,9 @@
Incorporation address
- ${incAddress} + + ${incAddress} +
token name
@@ -1234,7 +1244,9 @@
Contract address
- ${incAddress} + + ${incAddress} +
token used
@@ -1475,6 +1487,9 @@ const deposits = await fetchJson(`${floGlobals.tokenApiUrl}/api/v2/smartContractDeposits?contractName=${contract.name}&contractAddress=${contract.address}`) return deposits.depositInfo } + function getReceiver(vin, vout) { + return vout.find(output => output.scriptPubKey.addresses.find(address => address !== vin[0].addr))?.scriptPubKey.addresses[0] || vin[0].addr + } function parseTransactions(txList) { if (!Array.isArray(txList)) @@ -1510,17 +1525,9 @@ switch (type) { case 'transfer': if (transferType == "token" || transferType == 'nft') { - let receiverAddress = ""; - for (const output of vout) { - if (output["scriptPubKey"]["addresses"][0] !== vin[0]["addr"]) { - receiverAddress = output["scriptPubKey"]["addresses"][0]; - break; - } - } - obj = Object.assign({}, obj, { sender: vin[0]["addr"], - receiver: receiverAddress, + receiver: getReceiver(vin, vout), amount: tokenAmount, type: transferType == "token" ? "tokentransfer" : "nfttransfer", }); @@ -1528,17 +1535,9 @@ break; } else if (transferType == 'smartContract') { // smart contract transfer - let receiverAddress = ""; - for (const output of vout) { - if (output["scriptPubKey"]["addresses"][0] !== vin[0]["addr"]) { - receiverAddress = output["scriptPubKey"]["addresses"][0]; - break; - } - } - obj = Object.assign({}, obj, { sender: vin[0]["addr"], - receiver: receiverAddress, + receiver: getReceiver(vin, vout), amount: tokenAmount, contractName, userChoice, diff --git a/scripts/components.min.js b/scripts/components.min.js index a75fd42..98a58d3 100644 --- a/scripts/components.min.js +++ b/scripts/components.min.js @@ -1,7 +1,7 @@ // Components downloaded: chips,copy,input,notifications,spinner,theme-toggle -const smChips = document.createElement("template"); smChips.innerHTML = '
', customElements.define("sm-chips", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smChips.content.cloneNode(!0)), this.chipsWrapper = this.shadowRoot.querySelector(".sm-chips"), this.coverLeft = this.shadowRoot.querySelector(".cover--left"), this.coverRight = this.shadowRoot.querySelector(".cover--right"), this.navButtonLeft = this.shadowRoot.querySelector(".nav-button--left"), this.navButtonRight = this.shadowRoot.querySelector(".nav-button--right"), this.slottedOptions = void 0, this._value = void 0, this.scrollDistance = 0, this.assignedElements = [], this.scrollLeft = this.scrollLeft.bind(this), this.scrollRight = this.scrollRight.bind(this), this.fireEvent = this.fireEvent.bind(this), this.setSelectedOption = this.setSelectedOption.bind(this) } get value() { return this._value } set value(t) { this.setSelectedOption(t) } scrollLeft() { this.chipsWrapper.scrollBy({ left: -this.scrollDistance, behavior: "smooth" }) } scrollRight() { this.chipsWrapper.scrollBy({ left: this.scrollDistance, behavior: "smooth" }) } setSelectedOption(t) { this._value !== t && (this._value = t, this.assignedElements.forEach(e => { e.value == t ? (e.setAttribute("selected", ""), e.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" })) : e.removeAttribute("selected") })) } fireEvent() { this.dispatchEvent(new CustomEvent("change", { bubbles: !0, composed: !0, detail: { value: this._value } })) } connectedCallback() { this.setAttribute("role", "listbox"); const t = this.shadowRoot.querySelector("slot"); t.addEventListener("slotchange", e => { clearTimeout(this.slotChangeTimeout), this.slotChangeTimeout = setTimeout(() => { n.disconnect(), i.disconnect(), this.assignedElements = t.assignedElements(), this.assignedElements.forEach(t => { t.hasAttribute("selected") && (this._value = t.value) }), this.hasAttribute("multiline") || (this.assignedElements.length > 0 ? (n.observe(this.assignedElements[0]), i.observe(this.assignedElements[this.assignedElements.length - 1])) : (this.navButtonLeft.classList.add("hide"), this.navButtonRight.classList.add("hide"), this.coverLeft.classList.add("hide"), this.coverRight.classList.add("hide"), n.disconnect(), i.disconnect())) }, 100) }); const e = new ResizeObserver(t => { t.forEach(t => { if (t.contentBoxSize) { const e = Array.isArray(t.contentBoxSize) ? t.contentBoxSize[0] : t.contentBoxSize; this.scrollDistance = .6 * e.inlineSize } else this.scrollDistance = .6 * t.contentRect.width }) }); e.observe(this), this.chipsWrapper.addEventListener("option-clicked", t => { this._value !== t.target.value && (this.setSelectedOption(t.target.value), this.fireEvent()) }); const n = new IntersectionObserver(t => { t.forEach(t => { t.isIntersecting ? (this.navButtonLeft.classList.add("hide"), this.coverLeft.classList.add("hide")) : (this.navButtonLeft.classList.remove("hide"), this.coverLeft.classList.remove("hide")) }) }, { threshold: .9, root: this }), i = new IntersectionObserver(t => { t.forEach(t => { t.isIntersecting ? (this.navButtonRight.classList.add("hide"), this.coverRight.classList.add("hide")) : (this.navButtonRight.classList.remove("hide"), this.coverRight.classList.remove("hide")) }) }, { threshold: .9, root: this }); this.navButtonLeft.addEventListener("click", this.scrollLeft), this.navButtonRight.addEventListener("click", this.scrollRight) } disconnectedCallback() { this.navButtonLeft.removeEventListener("click", this.scrollLeft), this.navButtonRight.removeEventListener("click", this.scrollRight) } }); const smChip = document.createElement("template"); smChip.innerHTML = ' ', customElements.define("sm-chip", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smChip.content.cloneNode(!0)), this._value = void 0, this.radioButton = this.shadowRoot.querySelector("input"), this.fireEvent = this.fireEvent.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this) } get value() { return this._value } fireEvent() { this.dispatchEvent(new CustomEvent("option-clicked", { bubbles: !0, composed: !0, detail: { value: this._value } })) } handleKeyDown(t) { "Enter" !== t.key && "Space" !== t.key || this.fireEvent() } connectedCallback() { this.setAttribute("role", "option"), this.setAttribute("tabindex", "0"), this._value = this.getAttribute("value"), this.addEventListener("click", this.fireEvent), this.addEventListener("keydown", this.handleKeyDown) } disconnectedCallback() { this.removeEventListener("click", this.fireEvent), this.removeEventListener("keydown", this.handleKeyDown) } }); -const smCopy = document.createElement("template"); smCopy.innerHTML = '

', customElements.define("sm-copy", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smCopy.content.cloneNode(!0)), this.copyContent = this.shadowRoot.querySelector(".copy-content"), this.copyButton = this.shadowRoot.querySelector(".copy-button"), this.copy = this.copy.bind(this) } static get observedAttributes() { return ["value"] } set value(t) { this.setAttribute("value", t) } get value() { return this.getAttribute("value") } fireEvent() { this.dispatchEvent(new CustomEvent("copy", { composed: !0, bubbles: !0, cancelable: !0 })) } copy() { navigator.clipboard.writeText(this.copyContent.textContent).then(t => this.fireEvent()).catch(t => console.error(t)) } connectedCallback() { this.copyButton.addEventListener("click", this.copy) } attributeChangedCallback(t, n, o) { "value" === t && (this.copyContent.textContent = o) } disconnectedCallback() { this.copyButton.removeEventListener("click", this.copy) } }); -const smInput = document.createElement("template"); smInput.innerHTML = '
', customElements.define("sm-input", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smInput.content.cloneNode(!0)), this.inputParent = this.shadowRoot.querySelector(".input"), this.input = this.shadowRoot.querySelector("input"), this.clearBtn = this.shadowRoot.querySelector(".clear"), this.label = this.shadowRoot.querySelector(".label"), this.feedbackText = this.shadowRoot.querySelector(".feedback-text"), this.outerContainer = this.shadowRoot.querySelector(".outer-container"), this.optionList = this.shadowRoot.querySelector(".datalist"), this._helperText = "", this._errorText = "", this.isRequired = !1, this.datalist = [], this.validationFunction = void 0, this.reflectedAttributes = ["value", "required", "disabled", "type", "inputmode", "readonly", "min", "max", "pattern", "minlength", "maxlength", "step", "list", "autocomplete"], this.reset = this.reset.bind(this), this.clear = this.clear.bind(this), this.focusIn = this.focusIn.bind(this), this.focusOut = this.focusOut.bind(this), this.fireEvent = this.fireEvent.bind(this), this.checkInput = this.checkInput.bind(this), this.allowOnlyNum = this.allowOnlyNum.bind(this), this.handleOptionClick = this.handleOptionClick.bind(this), this.handleInputNavigation = this.handleInputNavigation.bind(this), this.handleDatalistNavigation = this.handleDatalistNavigation.bind(this), this.handleFocus = this.handleFocus.bind(this), this.handleBlur = this.handleBlur.bind(this) } static get observedAttributes() { return ["value", "placeholder", "required", "disabled", "type", "inputmode", "readonly", "min", "max", "pattern", "minlength", "maxlength", "step", "helper-text", "error-text", "list"] } get value() { return this.input.value } set value(t) { t !== this.input.value && (this.input.value = t, this.checkInput()) } get placeholder() { return this.getAttribute("placeholder") } set placeholder(t) { this.setAttribute("placeholder", t) } get type() { return this.getAttribute("type") } set type(t) { this.setAttribute("type", t) } get validity() { return this.input.validity } get disabled() { return this.hasAttribute("disabled") } set disabled(t) { t ? this.inputParent.classList.add("disabled") : this.inputParent.classList.remove("disabled") } get readOnly() { return this.hasAttribute("readonly") } set readOnly(t) { t ? this.setAttribute("readonly", "") : this.removeAttribute("readonly") } set customValidation(t) { this.validationFunction = t } set errorText(t) { this._errorText = t } set helperText(t) { this._helperText = t } get isValid() { if ("" !== this.input.value) { const t = this.input.checkValidity(); let e = !0; return this.validationFunction && (e = Boolean(this.validationFunction(this.input.value))), t && e ? (this.feedbackText.classList.remove("error"), this.feedbackText.classList.add("success"), this.feedbackText.textContent = "") : this._errorText && (this.feedbackText.classList.add("error"), this.feedbackText.classList.remove("success"), this.feedbackText.innerHTML = ` ${this._errorText}`), t && e } } reset() { this.value = "" } clear() { this.value = "", this.input.focus(), this.fireEvent() } focusIn() { this.input.focus() } focusOut() { this.input.blur() } fireEvent() { let t = new Event("input", { bubbles: !0, cancelable: !0, composed: !0 }); this.dispatchEvent(t) } searchDatalist(t) { const e = this.datalist.filter(e => e.toLowerCase().includes(t.toLowerCase())); if (e.sort((e, n) => { const i = e.toLowerCase().indexOf(t.toLowerCase()), s = n.toLowerCase().indexOf(t.toLowerCase()); return i - s }), e.length) { if (this.optionList.children.length > e.length) { const t = this.optionList.children.length - e.length; for (let e = 0; e < t; e++)this.optionList.removeChild(this.optionList.lastChild) } e.forEach((t, e) => { if (this.optionList.children[e]) this.optionList.children[e].textContent = t; else { const e = document.createElement("li"); e.textContent = t, e.classList.add("datalist-item"), e.setAttribute("tabindex", "0"), this.optionList.appendChild(e) } }), this.optionList.classList.remove("hidden") } else this.optionList.classList.add("hidden") } checkInput(t) { this.hasAttribute("readonly") || ("" !== this.input.value ? this.clearBtn.classList.remove("hidden") : this.clearBtn.classList.add("hidden")), this.hasAttribute("placeholder") && "" !== this.getAttribute("placeholder").trim() && ("" !== this.input.value ? (this.animate ? this.inputParent.classList.add("animate-placeholder") : this.label.classList.add("hidden"), this.datalist.length && (this.searchTimeout && clearTimeout(this.searchTimeout), this.searchTimeout = setTimeout(() => { this.searchDatalist(this.input.value.trim()) }, 100))) : (this.animate ? this.inputParent.classList.remove("animate-placeholder") : this.label.classList.remove("hidden"), this.feedbackText.textContent = "", this.datalist.length && (this.optionList.innerHTML = "", this.optionList.classList.add("hidden")))) } allowOnlyNum(t) { 1 === t.key.length && (("." !== t.key || !t.target.value.includes(".") && 0 !== t.target.value.length) && ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."].includes(t.key) || t.preventDefault()) } handleOptionClick(t) { this.input.value = t.target.textContent, this.optionList.classList.add("hidden"), this.input.focus() } handleInputNavigation(t) { "ArrowDown" === t.key ? (t.preventDefault(), this.optionList.children.length && this.optionList.children[0].focus()) : "ArrowUp" === t.key && (t.preventDefault(), this.optionList.children.length && this.optionList.children[this.optionList.children.length - 1].focus()) } handleDatalistNavigation(t) { "ArrowUp" === t.key ? (t.preventDefault(), this.shadowRoot.activeElement.previousElementSibling ? this.shadowRoot.activeElement.previousElementSibling.focus() : this.input.focus()) : "ArrowDown" === t.key ? (t.preventDefault(), this.shadowRoot.activeElement.nextElementSibling ? this.shadowRoot.activeElement.nextElementSibling.focus() : this.input.focus()) : "Enter" !== t.key && " " !== t.key || (t.preventDefault(), this.input.value = t.target.textContent, this.optionList.classList.add("hidden"), this.input.focus()) } handleFocus(t) { this.datalist.length && this.searchDatalist(this.input.value.trim()) } handleBlur(t) { this.datalist.length && this.optionList.classList.add("hidden") } connectedCallback() { this.animate = this.hasAttribute("animate"), this.setAttribute("role", "textbox"), this.input.addEventListener("input", this.checkInput), this.clearBtn.addEventListener("click", this.clear), this.datalist.length && (this.optionList.addEventListener("click", this.handleOptionClick), this.input.addEventListener("keydown", this.handleInputNavigation), this.optionList.addEventListener("keydown", this.handleDatalistNavigation)), this.input.addEventListener("focusin", this.handleFocus), this.addEventListener("focusout", this.handleBlur) } attributeChangedCallback(t, e, n) { e !== n && (this.reflectedAttributes.includes(t) && (this.hasAttribute(t) ? this.input.setAttribute(t, this.getAttribute(t) ? this.getAttribute(t) : "") : this.input.removeAttribute(t)), "placeholder" === t ? (this.label.textContent = n, this.setAttribute("aria-label", n)) : this.hasAttribute("value") ? this.checkInput() : "type" === t ? this.hasAttribute("type") && "number" === this.getAttribute("type") ? (this.input.setAttribute("inputmode", "decimal"), this.input.addEventListener("keydown", this.allowOnlyNum)) : this.input.removeEventListener("keydown", this.allowOnlyNum) : "helper-text" === t ? this._helperText = this.getAttribute("helper-text") : "error-text" === t ? this._errorText = this.getAttribute("error-text") : "required" === t ? (this.isRequired = this.hasAttribute("required"), this.isRequired ? this.setAttribute("aria-required", "true") : this.setAttribute("aria-required", "false")) : "readonly" === t ? this.hasAttribute("readonly") ? this.inputParent.classList.add("readonly") : this.inputParent.classList.remove("readonly") : "disabled" === t ? this.hasAttribute("disabled") ? this.inputParent.classList.add("disabled") : this.inputParent.classList.remove("disabled") : "list" === t && this.hasAttribute("list") && "" !== this.getAttribute("list").trim() && (this.datalist = this.getAttribute("list").split(","))) } disconnectedCallback() { this.input.removeEventListener("input", this.checkInput), this.clearBtn.removeEventListener("click", this.clear), this.input.removeEventListener("keydown", this.allowOnlyNum), this.optionList.removeEventListener("click", this.handleOptionClick), this.input.removeEventListener("keydown", this.handleInputNavigation), this.optionList.removeEventListener("keydown", this.handleDatalistNavigation), this.input.removeEventListener("focusin", this.handleFocus), this.removeEventListener("focusout", this.handleBlur) } }); -const smNotifications = document.createElement("template"); smNotifications.innerHTML = '
', customElements.define("sm-notifications", class extends HTMLElement { constructor() { super(), this.shadow = this.attachShadow({ mode: "open" }).append(smNotifications.content.cloneNode(!0)), this.notificationPanel = this.shadowRoot.querySelector(".notification-panel"), this.animationOptions = { duration: 300, fill: "forwards", easing: "cubic-bezier(0.175, 0.885, 0.32, 1.275)" }, this.push = this.push.bind(this), this.createNotification = this.createNotification.bind(this), this.removeNotification = this.removeNotification.bind(this), this.clearAll = this.clearAll.bind(this), this.remove = this.remove.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.startX = 0, this.currentX = 0, this.endX = 0, this.swipeDistance = 0, this.swipeDirection = "", this.swipeThreshold = 0, this.startTime = 0, this.swipeTime = 0, this.swipeTimeThreshold = 200, this.currentTarget = null, this.mediaQuery = window.matchMedia("(min-width: 640px)"), this.handleOrientationChange = this.handleOrientationChange.bind(this), this.isLandscape = !1 } randString(n) { let t = ""; const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for (let e = 0; e < n; e++)t += i.charAt(Math.floor(Math.random() * i.length)); return t } createNotification(n, t = {}) { const { pinned: i = !1, icon: e = "", action: o } = t, r = document.createElement("div"); r.id = this.randString(8), r.classList.add("notification"); let a = ""; return a += `
${e}
${n} `, o && (a += ` `), i && (r.classList.add("pinned"), a += ' '), r.innerHTML = a, r } push(n, t = {}) { const i = this.createNotification(n, t); return this.isLandscape ? this.notificationPanel.append(i) : this.notificationPanel.prepend(i), this.notificationPanel.animate([{ transform: `translateY(${this.isLandscape ? "" : "-"}${i.clientHeight}px)` }, { transform: "none" }], this.animationOptions), i.animate([{ transform: "translateY(-1rem)", opacity: "0" }, { transform: "none", opacity: "1" }], this.animationOptions).onfinish = (n => { n.target.commitStyles(), n.target.cancel() }), i.querySelector(".action") && i.querySelector(".action").addEventListener("click", t.action.callback), i.id } removeNotification(n, t = "left") { if (!n) return; const i = "left" === t ? "-" : "+"; n.animate([{ transform: this.currentX ? `translateX(${this.currentX}px)` : "none", opacity: "1" }, { transform: `translateX(calc(${i}${Math.abs(this.currentX)}px ${i} 1rem))`, opacity: "0" }], this.animationOptions).onfinish = (() => { n.remove() }) } remove(n) { const t = this.notificationPanel.querySelector(`#${n}`); t && this.removeNotification(t) } clearAll() { Array.from(this.notificationPanel.children).forEach(n => { this.removeNotification(n) }) } handlePointerMove(n) { this.currentX = n.clientX - this.startX, this.currentTarget.style.transform = `translateX(${this.currentX}px)` } handleOrientationChange(n) { this.isLandscape = n.matches, n.matches } connectedCallback() { this.handleOrientationChange(this.mediaQuery), this.mediaQuery.addEventListener("change", this.handleOrientationChange), this.notificationPanel.addEventListener("pointerdown", n => { n.target.closest(".close") ? this.removeNotification(n.target.closest(".notification")) : n.target.closest(".notification") && (this.swipeThreshold = n.target.closest(".notification").getBoundingClientRect().width / 2, this.currentTarget = n.target.closest(".notification"), this.currentTarget.setPointerCapture(n.pointerId), this.startTime = Date.now(), this.startX = n.clientX, this.startY = n.clientY, this.notificationPanel.addEventListener("pointermove", this.handlePointerMove)) }), this.notificationPanel.addEventListener("pointerup", n => { this.endX = n.clientX, this.endY = n.clientY, this.swipeDistance = Math.abs(this.endX - this.startX), this.swipeTime = Date.now() - this.startTime, this.endX > this.startX ? this.swipeDirection = "right" : this.swipeDirection = "left", this.swipeTime < this.swipeTimeThreshold ? this.swipeDistance > 50 && this.removeNotification(this.currentTarget, this.swipeDirection) : this.swipeDistance > this.swipeThreshold ? this.removeNotification(this.currentTarget, this.swipeDirection) : this.currentTarget.animate([{ transform: `translateX(${this.currentX}px)` }, { transform: "none" }], this.animationOptions).onfinish = (n => { n.target.commitStyles(), n.target.cancel() }), this.notificationPanel.removeEventListener("pointermove", this.handlePointerMove), this.notificationPanel.releasePointerCapture(n.pointerId), this.currentX = 0 }); const n = new MutationObserver(n => { n.forEach(n => { "childList" === n.type && n.addedNodes.length && !n.addedNodes[0].classList.contains("pinned") && setTimeout(() => { this.removeNotification(n.addedNodes[0]) }, 5e3) }) }); n.observe(this.notificationPanel, { childList: !0 }) } disconnectedCallback() { mediaQueryList.removeEventListener("change", handleOrientationChange) } }); +const smChips = document.createElement("template"); smChips.innerHTML = '
', customElements.define("sm-chips", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smChips.content.cloneNode(!0)), this.chipsWrapper = this.shadowRoot.querySelector(".sm-chips"), this.coverLeft = this.shadowRoot.querySelector(".cover--left"), this.coverRight = this.shadowRoot.querySelector(".cover--right"), this.navButtonLeft = this.shadowRoot.querySelector(".nav-button--left"), this.navButtonRight = this.shadowRoot.querySelector(".nav-button--right"), this.slottedOptions = void 0, this._value = void 0, this.scrollDistance = 0, this.assignedElements = [], this.scrollLeft = this.scrollLeft.bind(this), this.scrollRight = this.scrollRight.bind(this), this.fireEvent = this.fireEvent.bind(this), this.setSelectedOption = this.setSelectedOption.bind(this) } get value() { return this._value } set value(t) { this.setSelectedOption(t) } scrollLeft() { this.chipsWrapper.scrollBy({ left: -this.scrollDistance, behavior: "smooth" }) } scrollRight() { this.chipsWrapper.scrollBy({ left: this.scrollDistance, behavior: "smooth" }) } setSelectedOption(t) { this._value !== t && (this._value = t, this.assignedElements.forEach(e => { e.value == t ? (e.setAttribute("selected", ""), e.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" })) : e.removeAttribute("selected") })) } fireEvent() { this.dispatchEvent(new CustomEvent("change", { bubbles: !0, composed: !0, detail: { value: this._value } })) } connectedCallback() { this.setAttribute("role", "listbox"); const t = this.shadowRoot.querySelector("slot"); t.addEventListener("slotchange", e => { n.disconnect(), i.disconnect(), this.observeSelf.disconnect(), clearTimeout(this.slotChangeTimeout), this.slotChangeTimeout = setTimeout(() => { this.assignedElements = t.assignedElements(), this.assignedElements.forEach(t => { t.hasAttribute("selected") && (this._value = t.value) }), this.observeSelf.observe(this) }, 0) }); const e = new ResizeObserver(t => { t.forEach(t => { if (t.contentBoxSize) { const e = Array.isArray(t.contentBoxSize) ? t.contentBoxSize[0] : t.contentBoxSize; this.scrollDistance = .6 * e.inlineSize } else this.scrollDistance = .6 * t.contentRect.width }) }); e.observe(this), this.observeSelf = new IntersectionObserver((t, e) => { t.forEach(t => { t.isIntersecting && !this.hasAttribute("multiline") && this.assignedElements.length > 0 && (n.observe(this.assignedElements[0]), i.observe(this.assignedElements[this.assignedElements.length - 1]), e.unobserve(this)) }) }, { threshold: 1 }), this.chipsWrapper.addEventListener("option-clicked", t => { this._value !== t.target.value && (this.setSelectedOption(t.target.value), this.fireEvent()) }); const n = new IntersectionObserver(t => { t.forEach(t => { t.isIntersecting ? (this.navButtonLeft.classList.add("hide"), this.coverLeft.classList.add("hide")) : (this.navButtonLeft.classList.remove("hide"), this.coverLeft.classList.remove("hide")) }) }, { threshold: 1, root: this }), i = new IntersectionObserver(t => { t.forEach(t => { t.isIntersecting ? (this.navButtonRight.classList.add("hide"), this.coverRight.classList.add("hide")) : (this.navButtonRight.classList.remove("hide"), this.coverRight.classList.remove("hide")) }) }, { threshold: 1, root: this }); this.navButtonLeft.addEventListener("click", this.scrollLeft), this.navButtonRight.addEventListener("click", this.scrollRight) } disconnectedCallback() { this.navButtonLeft.removeEventListener("click", this.scrollLeft), this.navButtonRight.removeEventListener("click", this.scrollRight) } }); const smChip = document.createElement("template"); smChip.innerHTML = ' ', customElements.define("sm-chip", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smChip.content.cloneNode(!0)), this._value = void 0, this.radioButton = this.shadowRoot.querySelector("input"), this.fireEvent = this.fireEvent.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this) } get value() { return this._value } fireEvent() { this.dispatchEvent(new CustomEvent("option-clicked", { bubbles: !0, composed: !0, detail: { value: this._value } })) } handleKeyDown(t) { "Enter" !== t.key && "Space" !== t.key || this.fireEvent() } connectedCallback() { this.setAttribute("role", "option"), this.setAttribute("tabindex", "0"), this._value = this.getAttribute("value"), this.addEventListener("click", this.fireEvent), this.addEventListener("keydown", this.handleKeyDown) } disconnectedCallback() { this.removeEventListener("click", this.fireEvent), this.removeEventListener("keydown", this.handleKeyDown) } }); +const smCopy = document.createElement("template"); smCopy.innerHTML = '

', customElements.define("sm-copy", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smCopy.content.cloneNode(!0)), this.copyContent = this.shadowRoot.querySelector(".copy-content"), this.copyButton = this.shadowRoot.querySelector(".copy-button"), this.copy = this.copy.bind(this) } static get observedAttributes() { return ["value"] } set value(t) { this.setAttribute("value", t) } get value() { return this.getAttribute("value") } fireEvent() { this.dispatchEvent(new CustomEvent("copy", { composed: !0, bubbles: !0, cancelable: !0 })) } copy() { navigator.clipboard.writeText(this.getAttribute("value")).then(t => this.fireEvent()).catch(t => console.error(t)) } connectedCallback() { this.copyButton.addEventListener("click", this.copy) } attributeChangedCallback(t, n, o) { "value" === t && 0 === this.copyContent.querySelector("slot").assignedNodes().length && (this.copyContent.textContent = o) } disconnectedCallback() { this.copyButton.removeEventListener("click", this.copy) } }); +const smInput = document.createElement("template"); smInput.innerHTML = '
', customElements.define("sm-input", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smInput.content.cloneNode(!0)), this.inputParent = this.shadowRoot.querySelector(".input"), this.input = this.shadowRoot.querySelector("input"), this.clearBtn = this.shadowRoot.querySelector(".clear"), this.label = this.shadowRoot.querySelector(".label"), this.feedbackText = this.shadowRoot.querySelector(".feedback-text"), this.outerContainer = this.shadowRoot.querySelector(".outer-container"), this.optionList = this.shadowRoot.querySelector(".datalist"), this._helperText = "", this._errorText = "", this.isRequired = !1, this.datalist = [], this.validationFunction = void 0, this.reflectedAttributes = ["value", "required", "disabled", "type", "inputmode", "readonly", "min", "max", "pattern", "minlength", "maxlength", "step", "list", "autocomplete"], this.reset = this.reset.bind(this), this.clear = this.clear.bind(this), this.focusIn = this.focusIn.bind(this), this.focusOut = this.focusOut.bind(this), this.fireEvent = this.fireEvent.bind(this), this.checkInput = this.checkInput.bind(this), this.showError = this.showError.bind(this), this.allowOnlyNum = this.allowOnlyNum.bind(this), this.handleOptionClick = this.handleOptionClick.bind(this), this.handleInputNavigation = this.handleInputNavigation.bind(this), this.handleDatalistNavigation = this.handleDatalistNavigation.bind(this), this.handleFocus = this.handleFocus.bind(this), this.handleBlur = this.handleBlur.bind(this) } static get observedAttributes() { return ["value", "placeholder", "required", "disabled", "type", "inputmode", "readonly", "min", "max", "pattern", "minlength", "maxlength", "step", "helper-text", "error-text", "list"] } get value() { return this.input.value } set value(t) { t !== this.input.value && (this.input.value = t, this.checkInput()) } get placeholder() { return this.getAttribute("placeholder") } set placeholder(t) { this.setAttribute("placeholder", t) } get type() { return this.getAttribute("type") } set type(t) { this.setAttribute("type", t) } get validity() { return this.input.validity } get disabled() { return this.hasAttribute("disabled") } set disabled(t) { t ? (this.inputParent.classList.add("disabled"), this.setAttribute("disabled", "")) : (this.inputParent.classList.remove("disabled"), this.removeAttribute("disabled")) } get readOnly() { return this.hasAttribute("readonly") } set readOnly(t) { t ? this.setAttribute("readonly", "") : this.removeAttribute("readonly") } set customValidation(t) { this.validationFunction = t } set errorText(t) { this._errorText = t } showError() { this.feedbackText.className = "feedback-text error", this.feedbackText.innerHTML = ` ${this._errorText}` } set helperText(t) { this._helperText = t } get isValid() { if ("" !== this.input.value) { const t = this.input.checkValidity(); let e = !0; return this.validationFunction && (e = Boolean(this.validationFunction(this.input.value))), t && e ? (this.feedbackText.className = "feedback-text success", this.feedbackText.textContent = "") : this._errorText && this.showError(), t && e } } reset() { this.value = "" } clear() { this.value = "", this.input.focus(), this.fireEvent() } focusIn() { this.input.focus() } focusOut() { this.input.blur() } fireEvent() { let t = new Event("input", { bubbles: !0, cancelable: !0, composed: !0 }); this.dispatchEvent(t) } searchDatalist(t) { const e = this.datalist.filter(e => e.toLowerCase().includes(t.toLowerCase())); if (e.sort((e, n) => { const i = e.toLowerCase().indexOf(t.toLowerCase()), s = n.toLowerCase().indexOf(t.toLowerCase()); return i - s }), e.length) { if (this.optionList.children.length > e.length) { const t = this.optionList.children.length - e.length; for (let e = 0; e < t; e++)this.optionList.removeChild(this.optionList.lastChild) } e.forEach((t, e) => { if (this.optionList.children[e]) this.optionList.children[e].textContent = t; else { const e = document.createElement("li"); e.textContent = t, e.classList.add("datalist-item"), e.setAttribute("tabindex", "0"), this.optionList.appendChild(e) } }), this.optionList.classList.remove("hidden") } else this.optionList.classList.add("hidden") } checkInput(t) { this.hasAttribute("readonly") || ("" !== this.input.value ? this.clearBtn.classList.remove("hidden") : this.clearBtn.classList.add("hidden")), this.hasAttribute("placeholder") && "" !== this.getAttribute("placeholder").trim() && ("" !== this.input.value ? (this.animate ? this.inputParent.classList.add("animate-placeholder") : this.label.classList.add("hidden"), this.datalist.length && (this.searchTimeout && clearTimeout(this.searchTimeout), this.searchTimeout = setTimeout(() => { this.searchDatalist(this.input.value.trim()) }, 100))) : (this.animate ? this.inputParent.classList.remove("animate-placeholder") : this.label.classList.remove("hidden"), this.feedbackText.textContent = "", this.datalist.length && (this.optionList.innerHTML = "", this.optionList.classList.add("hidden")))) } allowOnlyNum(t) { 1 === t.key.length && (("." !== t.key || !t.target.value.includes(".") && 0 !== t.target.value.length) && ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."].includes(t.key) || t.preventDefault()) } handleOptionClick(t) { this.input.value = t.target.textContent, this.optionList.classList.add("hidden"), this.input.focus() } handleInputNavigation(t) { "ArrowDown" === t.key ? (t.preventDefault(), this.optionList.children.length && this.optionList.children[0].focus()) : "ArrowUp" === t.key && (t.preventDefault(), this.optionList.children.length && this.optionList.children[this.optionList.children.length - 1].focus()) } handleDatalistNavigation(t) { "ArrowUp" === t.key ? (t.preventDefault(), this.shadowRoot.activeElement.previousElementSibling ? this.shadowRoot.activeElement.previousElementSibling.focus() : this.input.focus()) : "ArrowDown" === t.key ? (t.preventDefault(), this.shadowRoot.activeElement.nextElementSibling ? this.shadowRoot.activeElement.nextElementSibling.focus() : this.input.focus()) : "Enter" !== t.key && " " !== t.key || (t.preventDefault(), this.input.value = t.target.textContent, this.optionList.classList.add("hidden"), this.input.focus()) } handleFocus(t) { this.datalist.length && this.searchDatalist(this.input.value.trim()) } handleBlur(t) { this.datalist.length && this.optionList.classList.add("hidden") } connectedCallback() { this.animate = this.hasAttribute("animate"), this.setAttribute("role", "textbox"), this.input.addEventListener("input", this.checkInput), this.clearBtn.addEventListener("click", this.clear), this.datalist.length && (this.optionList.addEventListener("click", this.handleOptionClick), this.input.addEventListener("keydown", this.handleInputNavigation), this.optionList.addEventListener("keydown", this.handleDatalistNavigation)), this.input.addEventListener("focusin", this.handleFocus), this.addEventListener("focusout", this.handleBlur) } attributeChangedCallback(t, e, n) { if (e !== n) switch (this.reflectedAttributes.includes(t) && (this.hasAttribute(t) ? this.input.setAttribute(t, this.getAttribute(t) ? this.getAttribute(t) : "") : this.input.removeAttribute(t)), t) { case "placeholder": this.label.textContent = n, this.setAttribute("aria-label", n); break; case "value": this.checkInput(); break; case "type": this.hasAttribute("type") && "number" === this.getAttribute("type") ? (this.input.setAttribute("inputmode", "decimal"), this.input.addEventListener("keydown", this.allowOnlyNum)) : this.input.removeEventListener("keydown", this.allowOnlyNum); break; case "helper-text": this._helperText = n; break; case "error-text": this._errorText = n; break; case "required": this.isRequired = this.hasAttribute("required"), this.isRequired ? this.setAttribute("aria-required", "true") : this.setAttribute("aria-required", "false"); break; case "readonly": this.hasAttribute("readonly") ? this.inputParent.classList.add("readonly") : this.inputParent.classList.remove("readonly"); break; case "disabled": this.hasAttribute("disabled") ? this.inputParent.classList.add("disabled") : this.inputParent.classList.remove("disabled"); break; case "list": this.hasAttribute("list") && "" !== this.getAttribute("list").trim() && (this.datalist = this.getAttribute("list").split(",")) } } disconnectedCallback() { this.input.removeEventListener("input", this.checkInput), this.clearBtn.removeEventListener("click", this.clear), this.input.removeEventListener("keydown", this.allowOnlyNum), this.optionList.removeEventListener("click", this.handleOptionClick), this.input.removeEventListener("keydown", this.handleInputNavigation), this.optionList.removeEventListener("keydown", this.handleDatalistNavigation), this.input.removeEventListener("focusin", this.handleFocus), this.removeEventListener("focusout", this.handleBlur) } }); +const smNotifications = document.createElement("template"); smNotifications.innerHTML = '
', customElements.define("sm-notifications", class extends HTMLElement { constructor() { super(), this.shadow = this.attachShadow({ mode: "open" }).append(smNotifications.content.cloneNode(!0)), this.notificationPanel = this.shadowRoot.querySelector(".notification-panel"), this.animationOptions = { duration: 300, fill: "forwards", easing: "cubic-bezier(0.175, 0.885, 0.32, 1.275)" }, this.push = this.push.bind(this), this.createNotification = this.createNotification.bind(this), this.removeNotification = this.removeNotification.bind(this), this.clearAll = this.clearAll.bind(this), this.remove = this.remove.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.startX = 0, this.currentX = 0, this.endX = 0, this.swipeDistance = 0, this.swipeDirection = "", this.swipeThreshold = 0, this.startTime = 0, this.swipeTime = 0, this.swipeTimeThreshold = 200, this.currentTarget = null, this.mediaQuery = window.matchMedia("(min-width: 640px)"), this.handleOrientationChange = this.handleOrientationChange.bind(this), this.isLandscape = !1 } randString(n) { let t = ""; const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for (let i = 0; i < n; i++)t += e.charAt(Math.floor(Math.random() * e.length)); return t } createNotification(n, t = {}) { const { pinned: e = !1, icon: i = "", action: o } = t, r = document.createElement("div"); r.id = this.randString(8), r.className = `notification ${e ? "pinned" : ""}`; const a = document.createElement("div"); a.className = "icon-container", a.innerHTML = i; const s = document.createElement("output"); if (s.textContent = n, r.append(a, s), o) { const n = document.createElement("button"); n.className = "action", n.innerText = o.label, n.addEventListener("click", o.callback) } if (e) { const n = document.createElement("button"); n.className = "close", n.innerHTML = ' ', n.addEventListener("click", () => { this.remove(r.id) }), r.append(n) } return r } push(n, t = {}) { const e = this.createNotification(n, t); return this.isLandscape ? this.notificationPanel.append(e) : this.notificationPanel.prepend(e), this.notificationPanel.animate([{ transform: `translateY(${this.isLandscape ? "" : "-"}${e.clientHeight}px)` }, { transform: "none" }], this.animationOptions), e.animate([{ transform: "translateY(-1rem)", opacity: "0" }, { transform: "none", opacity: "1" }], this.animationOptions).onfinish = (n => { n.target.commitStyles(), n.target.cancel() }), e.querySelector(".action") && e.querySelector(".action").addEventListener("click", t.action.callback), e.id } removeNotification(n, t = "left") { if (!n) return; const e = "left" === t ? "-" : "+"; n.animate([{ transform: this.currentX ? `translateX(${this.currentX}px)` : "none", opacity: "1" }, { transform: `translateX(calc(${e}${Math.abs(this.currentX)}px ${e} 1rem))`, opacity: "0" }], this.animationOptions).onfinish = (() => { n.remove() }) } remove(n) { const t = this.notificationPanel.querySelector(`#${n}`); t && this.removeNotification(t) } clearAll() { Array.from(this.notificationPanel.children).forEach(n => { this.removeNotification(n) }) } handlePointerMove(n) { this.currentX = n.clientX - this.startX, this.currentTarget.style.transform = `translateX(${this.currentX}px)` } handleOrientationChange(n) { this.isLandscape = n.matches, n.matches } connectedCallback() { this.handleOrientationChange(this.mediaQuery), this.mediaQuery.addEventListener("change", this.handleOrientationChange), this.notificationPanel.addEventListener("pointerdown", n => { n.target.closest(".close") ? this.removeNotification(n.target.closest(".notification")) : n.target.closest(".notification") && (this.swipeThreshold = n.target.closest(".notification").getBoundingClientRect().width / 2, this.currentTarget = n.target.closest(".notification"), this.currentTarget.setPointerCapture(n.pointerId), this.startTime = Date.now(), this.startX = n.clientX, this.startY = n.clientY, this.notificationPanel.addEventListener("pointermove", this.handlePointerMove)) }), this.notificationPanel.addEventListener("pointerup", n => { this.endX = n.clientX, this.endY = n.clientY, this.swipeDistance = Math.abs(this.endX - this.startX), this.swipeTime = Date.now() - this.startTime, this.endX > this.startX ? this.swipeDirection = "right" : this.swipeDirection = "left", this.swipeTime < this.swipeTimeThreshold ? this.swipeDistance > 50 && this.removeNotification(this.currentTarget, this.swipeDirection) : this.swipeDistance > this.swipeThreshold ? this.removeNotification(this.currentTarget, this.swipeDirection) : this.currentTarget.animate([{ transform: `translateX(${this.currentX}px)` }, { transform: "none" }], this.animationOptions).onfinish = (n => { n.target.commitStyles(), n.target.cancel() }), this.notificationPanel.removeEventListener("pointermove", this.handlePointerMove), this.notificationPanel.releasePointerCapture(n.pointerId), this.currentX = 0 }); const n = new MutationObserver(n => { n.forEach(n => { "childList" === n.type && n.addedNodes.length && !n.addedNodes[0].classList.contains("pinned") && setTimeout(() => { this.removeNotification(n.addedNodes[0]) }, 5e3) }) }); n.observe(this.notificationPanel, { childList: !0 }) } disconnectedCallback() { mediaQueryList.removeEventListener("change", handleOrientationChange) } }); const spinner = document.createElement("template"); spinner.innerHTML = ''; class SpinnerLoader extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(spinner.content.cloneNode(!0)) } } window.customElements.define("sm-spinner", SpinnerLoader); const themeToggle = document.createElement("template"); themeToggle.innerHTML = ' '; class ThemeToggle extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(themeToggle.content.cloneNode(!0)), this.isChecked = !1, this.hasTheme = "light", this.toggleState = this.toggleState.bind(this), this.fireEvent = this.fireEvent.bind(this), this.handleThemeChange = this.handleThemeChange.bind(this) } static get observedAttributes() { return ["checked"] } daylight() { this.hasTheme = "light", document.body.dataset.theme = "light", this.setAttribute("aria-checked", "false") } nightlight() { this.hasTheme = "dark", document.body.dataset.theme = "dark", this.setAttribute("aria-checked", "true") } toggleState() { this.toggleAttribute("checked"), this.fireEvent() } handleKeyDown(e) { " " === e.key && this.toggleState() } handleThemeChange(e) { e.detail.theme !== this.hasTheme && ("dark" === e.detail.theme ? this.setAttribute("checked", "") : this.removeAttribute("checked")) } fireEvent() { this.dispatchEvent(new CustomEvent("themechange", { bubbles: !0, composed: !0, detail: { theme: this.hasTheme } })) } connectedCallback() { this.setAttribute("role", "switch"), this.setAttribute("aria-label", "theme toggle"), "dark" === localStorage.getItem(`${window.location.hostname}-theme`) ? (this.nightlight(), this.setAttribute("checked", "")) : "light" === localStorage.getItem(`${window.location.hostname}-theme`) ? (this.daylight(), this.removeAttribute("checked")) : window.matchMedia("(prefers-color-scheme: dark)").matches ? (this.nightlight(), this.setAttribute("checked", "")) : (this.daylight(), this.removeAttribute("checked")), this.addEventListener("click", this.toggleState), this.addEventListener("keydown", this.handleKeyDown), document.addEventListener("themechange", this.handleThemeChange) } disconnectedCallback() { this.removeEventListener("click", this.toggleState), this.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("themechange", this.handleThemeChange) } attributeChangedCallback(e, t, n) { "checked" === e && (this.hasAttribute("checked") ? (this.nightlight(), localStorage.setItem(`${window.location.hostname}-theme`, "dark")) : (this.daylight(), localStorage.setItem(`${window.location.hostname}-theme`, "light"))) } } window.customElements.define("theme-toggle", ThemeToggle); \ No newline at end of file From dd853ae7774e959d8dd5f8c43b91646274c6d2b2 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Thu, 11 May 2023 01:29:02 +0530 Subject: [PATCH 3/7] minor UX improvement --- index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 7a6508f..9219a2c 100644 --- a/index.html +++ b/index.html @@ -837,7 +837,11 @@
Supply

${supply ? formatAmount(supply, token.toLowerCase() === 'rupee' ? 'inr' : 'usd') : 'Infinite'}

Incorporation address
-

${incAddress}

+ +

+ ${incAddress} +

+
Transactions @@ -1228,7 +1232,6 @@ }, contractCreationCard(obj) { const { hash, blockHeight, token, contractName, incAddress, contractType, expiration, participationFees, availableChoices, time } = obj; - console.log(obj); return html`
  • contract creation @@ -1649,7 +1652,6 @@ receiver = vout[i]["scriptPubKey"]["addresses"][0]; } } - console.log(transaction) // todo - temporary fixes below. Fix these on the Database and API level let transactionType = '' if (type == 'transfer') { From 228c6300298746d53adb69a4de7d6fd6bdbaa669 Mon Sep 17 00:00:00 2001 From: Vivek Teega Date: Tue, 6 Jun 2023 04:15:56 +0530 Subject: [PATCH 4/7] Bug fix: deposit details section now shows the sellingToken as the currency --- index.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 9219a2c..c515269 100644 --- a/index.html +++ b/index.html @@ -446,6 +446,8 @@ html`${contractDeposits.map(deposit => render.depositCard({ ...deposit, acceptingToken: acceptingToken, + sellingToken: sellingToken, + }))}` ) else @@ -1037,7 +1039,9 @@ `; }, depositCard(details) { - const { currentBalance, depositorAddress, originalBalance, status, time, transactionHash, acceptingToken } = details + const { currentBalance, depositorAddress, originalBalance, status, time, transactionHash, acceptingToken, sellingToken } = details + console.log("I'm at the debug point") + debugger return html`
  • @@ -1047,11 +1051,11 @@
    Deposited
    - ${formatAmount(originalBalance, 'usd')} ${acceptingToken} + ${originalBalance} ${sellingToken}
    Current balance
    - ${formatAmount(currentBalance, 'usd')} ${acceptingToken} + ${currentBalance} ${sellingToken}
    Status
    From 9d3127d177016994d40f63cf395de671cae32681 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Tue, 6 Jun 2023 19:30:49 +0530 Subject: [PATCH 5/7] Text changes and bug fixes --- css/main.css | 11 +++++- css/main.min.css | 2 +- css/main.scss | 10 +++++- index.html | 93 ++++++++++++++++++++++++++++++++++-------------- 4 files changed, 87 insertions(+), 29 deletions(-) diff --git a/css/main.css b/css/main.css index 1bb8bee..8e70ea8 100644 --- a/css/main.css +++ b/css/main.css @@ -1066,13 +1066,22 @@ theme-toggle { #participant_container, #deposits_container { display: grid; - gap: 2.5rem; + gap: 0.5rem; + background-color: transparent; + padding: 0; } .participant, .deposit-card { flex-wrap: wrap; gap: 2rem; + background-color: rgba(var(--foreground-color), 1); + padding: max(1rem, 1.5vw); + border-radius: 0.5rem; +} +.participant .address, +.deposit-card .address { + min-width: 12rem; } @media only screen and (min-width: 640px) { diff --git a/css/main.min.css b/css/main.min.css index de136f0..d75e6f3 100644 --- a/css/main.min.css +++ b/css/main.min.css @@ -1 +1 @@ -*{padding:0;margin:0;box-sizing:border-box;font-family:"Inter",sans-serif}:root{font-size:clamp(1rem,1.2vmax,1.2rem)}html,body{height:100%}body{--accent-color: #3d5afe;--secondary-color: #ffac2e;--text-color: 34, 34, 34;--foreground-color: 252, 253, 255;--background-color: 241, 243, 248;--danger-color: rgb(255, 75, 75);--green: #1cad59;--yellow: rgb(220, 165, 0);color:rgba(var(--text-color), 1);background-color:rgba(var(--background-color), 1)}body[data-theme=dark]{--accent-color: #92a2ff;--secondary-color: #d60739;--text-color: 200, 200, 200;--foreground-color: 27, 28, 29;--background-color: 21, 22, 22;--danger-color: rgb(255, 106, 106);--green: #00e676;--yellow: rgb(255, 213, 5)}body[data-theme=dark] ::-webkit-calendar-picker-indicator{filter:invert(1)}h1,h2,h3,h4,h5,h6{letter-spacing:-0.01em;font-weight:700}p,strong{line-height:1.7;color:rgba(var(--text-color), 0.9);max-width:70ch}img{-o-object-fit:cover;object-fit:cover}a:where([class]){color:inherit;text-decoration:none}a:where([class]):focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color), 1) inset}a{color:var(--accent-color)}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}button,.button{-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative;display:inline-flex;border:none;background-color:rgba(0,0,0,0);overflow:hidden;color:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);align-items:center;font-size:inherit;font-weight:500;white-space:nowrap;padding:.8rem;border-radius:.3rem;justify-content:center;flex-shrink:0}button:focus-visible,.button:focus-visible{outline:var(--accent-color) solid medium}button:not(:disabled),.button:not(:disabled){cursor:pointer}.button{background-color:rgba(var(--text-color), 0.02);border:solid thin rgba(var(--text-color), 0.06)}.button--primary{color:rgba(var(--background-color), 1);background-color:var(--accent-color)}.button--primary .icon{fill:rgba(var(--background-color), 1)}.button--colored{color:var(--accent-color)}.button--colored .icon{fill:var(--accent-color)}.button--danger{background-color:rgba(255,115,115,.062745098);color:var(--danger-color)}.button--danger .icon{fill:var(--danger-color)}.button--small{padding:.4rem .6rem}.button--outlined{border:solid rgba(var(--text-color), 0.3) .1rem;background-color:rgba(var(--foreground-color), 1)}.button--transparent{background-color:rgba(0,0,0,0)}button:disabled{opacity:.4;cursor:not-allowed;filter:saturate(0)}.cta{text-transform:uppercase;font-size:.8rem;font-weight:700;letter-spacing:.05em;padding:.8rem 1rem}.icon{width:1.2rem;height:1.2rem;fill:rgba(var(--text-color), 0.8);flex-shrink:0}.icon-only{padding:.5rem;border-radius:.3rem;aspect-ratio:1/1}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}details summary{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;align-items:center;justify-content:space-between;color:var(--accent-color)}details[open] summary{margin-bottom:1rem}details[open]>summary .down-arrow{transform:rotate(180deg)}sm-input{--border-radius: 0.5rem;--background-color: rgba(var(--foreground-color), 1)}sm-spinner{--size: 1.5rem;--stroke-width: 0.1rem}sm-chips{--gap: 0.3rem}sm-chip{position:relative;font-size:.9rem;--border-radius: 0.5rem;--padding: 0.5rem 0.8rem;--background: rgba(var(--text-color), 0.06);-webkit-user-select:none;-moz-user-select:none;user-select:none;font-weight:500}sm-chip[selected]{--background: var(--accent-color);color:rgba(var(--background-color), 1)}ul{list-style:none}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.wrap-around{overflow-wrap:break-word;word-wrap:break-word;word-break:break-word}.full-bleed{grid-column:1/-1}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.sticky{position:-webkit-sticky;position:sticky}.top-0{top:0}.flex{display:flex}.flex-wrap{flex-wrap:wrap}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.grid{display:grid}.flow-column{grid-auto-flow:column}.gap-0-3{gap:.3rem}.gap-0-5{gap:.5rem}.gap-1{gap:1rem}.gap-1-5{gap:1.5rem}.gap-2{gap:2rem}.gap-3{gap:3rem}.text-align-right{text-align:right}.text-align-left{text-align:left}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-content-start{align-content:flex-start}.align-start{align-content:flex-start}.align-center{align-items:center}.align-end{align-items:flex-end}.text-center{text-align:center}.justify-start{justify-items:start}.justify-content-start{justify-content:start}.justify-content-center{justify-content:center}.justify-right{margin-left:auto}.align-self-start{align-self:start}.align-self-center{align-self:center}.align-self-end{align-self:end}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.flex-direction-column{flex-direction:column}.space-between{justify-content:space-between}.space-evenly{justify-content:space-evenly}.w-100{width:100%}.h-100{height:100%}.padding-block-1{padding-block:1rem}.margin-right-0-3{margin-right:.3rem}.margin-right-0-5{margin-right:.5rem}.margin-right-1{margin-right:1rem}.margin-left-0-5{margin-left:.5rem}.margin-left-auto{margin-left:auto}.margin-right-auto{margin-right:auto}.margin-top-1{margin-top:1rem}.margin-bottom-0-5{margin-bottom:.5rem}.margin-bottom-1{margin-bottom:1rem}.margin-bottom-2{margin-bottom:2rem}.margin-block-0-5{margin-block:.5rem}.margin-block-1{margin-block:1rem}.margin-block-1-5{margin-block:1.5rem}.margin-inline-1{margin-inline:1rem}.margin-inline-1-5{margin-inline:1.5rem}.hidden{display:none !important}.h1{font-size:2.5rem}.h2{font-size:2rem}.h3{font-size:1.4rem}.h4{font-size:1rem}.h5{font-size:.8rem}.grid-3{grid-template-columns:1fr auto auto}.flow-column{grid-auto-flow:column}.w-100{width:100%}.color-0-8{color:rgba(var(--text-color), 0.8)}.weight-400{font-weight:400}.weight-500{font-weight:500}.ws-pre-line{white-space:pre-line}.card{background-color:rgba(var(--foreground-color), 1);border-radius:.5rem;padding:max(1rem,3vw)}.ripple{height:8rem;width:8rem;position:absolute;border-radius:50%;transform:scale(0);background:radial-gradient(circle, rgba(var(--text-color), 0.3) 0%, rgba(0, 0, 0, 0) 50%);pointer-events:none}.interactive{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.observe-empty-state:empty{display:none}.observe-empty-state:not(:empty)~.empty-state{display:none}.multi-state-button{display:grid;text-align:center;align-items:center;justify-items:center}.multi-state-button>*{grid-area:1/1/2/2}.multi-state-button button{z-index:1}#confirmation_popup,#prompt_popup{flex-direction:column}#confirmation_popup h4,#prompt_popup h4{font-size:1.2rem;margin-bottom:1rem}#confirmation_popup .flex,#prompt_popup .flex{margin-top:1rem}.popup__header{position:relative;display:grid;gap:.5rem;width:100%;padding:0 1.5rem;align-items:center}.popup__header>*{grid-row:1}.popup__header h3,.popup__header h4{grid-column:1/-1;justify-self:center;align-self:center}.popup__header__close{grid-column:1;margin-left:-1rem;justify-self:flex-start}section{position:relative}section .dark-background{display:grid;grid-template-rows:auto 1fr}ul[type=circle]{padding:1.5rem 2.5rem;list-style:circle}ul[type=circle] li{margin-bottom:1rem}ul[type=circle] li:last-of-type{margin-bottom:0}ul{list-style:none}.top-bottom-padding{padding:1.5rem 0}.margin,.page{margin:0 1rem}.page{display:flex;flex-direction:column}.card{padding:2rem 1.5rem;border-radius:.5rem;background:rgba(var(--text-color), 0.06);margin:1.5rem 0}.card h2{margin-bottom:1.5rem}.transaction-container{display:grid;margin-top:1.5rem;gap:.5rem}.label{text-transform:capitalize;font-size:.8rem;margin-bottom:.3rem;color:rgba(var(--text-color), 0.8);margin-top:1.5rem;font-weight:500}.label:first-of-type{margin-top:0}.label+*{font-weight:700}.header{justify-items:center;flex-direction:column}#homepage{padding-top:0}#first_section{display:grid}header.grid-2{margin-top:2rem}@-webkit-keyframes flyInLeft{from{opacity:0;transform:translateX(-0.5rem)}to{opacity:1;transform:none}}@keyframes flyInLeft{from{opacity:0;transform:translateX(-0.5rem)}to{opacity:1;transform:none}}@-webkit-keyframes flyInRight{from{opacity:0;transform:translateX(0.5rem)}to{opacity:1;transform:none}}@keyframes flyInRight{from{opacity:0;transform:translateX(0.5rem)}to{opacity:1;transform:none}}#highlights{padding:1.5rem 0;display:grid;grid-template-columns:repeat(auto-fit, minmax(14rem, 1fr));gap:1.5rem}#highlights .highlight-item{opacity:0;display:flex;flex-direction:column;padding:1rem 1.5rem;border-left:.1rem solid rgba(var(--text-color), 0.2);--animation-duration: 0.3s}#highlights .highlight-item .label{margin-top:auto}#highlights .highlight-item h1{font-size:2rem;letter-spacing:.1rem;font-weight:500;text-transform:uppercase;overflow-wrap:break-word}#highlights .highlight-item:first-of-type{text-transform:uppercase}#highlights .highlight-item:nth-of-type(2){text-transform:capitalize}#highlights .highlight-item:first-of-type{-webkit-animation:flyInLeft var(--animation-duration) forwards;animation:flyInLeft var(--animation-duration) forwards}#highlights .highlight-item:nth-of-type(2){-webkit-animation:flyInLeft var(--animation-duration) .1s forwards;animation:flyInLeft var(--animation-duration) .1s forwards}#highlights .highlight-item:nth-of-type(3){-webkit-animation:flyInLeft var(--animation-duration) .2s forwards;animation:flyInLeft var(--animation-duration) .2s forwards}#highlights .highlight-item:last-of-type{-webkit-animation:flyInLeft var(--animation-duration) .3s forwards;animation:flyInLeft var(--animation-duration) .3s forwards}#main_header{display:grid;grid-template-columns:1fr 1fr;grid-template-areas:"logo theme" "search search";margin-top:1rem;gap:1rem}#logo{grid-area:logo;color:inherit}theme-toggle{grid-area:theme;justify-self:end;align-self:center}#search_wrapper{grid-area:search;width:min(28rem,100%);position:relative}#main_search_field{width:100%;--min-height: 2.8rem}#suggestions{position:absolute;top:100%;left:0;width:100%;background:rgba(var(--foreground-color), 1);border-radius:.5rem;z-index:1;overflow:hidden;max-height:0;transition:max-height .2s ease-in-out}#suggestions:not(:empty){max-height:20rem;overflow-y:auto}.suggestion{padding:.8rem 1rem;display:flex;align-items:center;cursor:pointer}.suggestion:hover,.suggestion:active,.suggestion:focus{background:rgba(var(--text-color), 0.06);outline:none}.suggestion .address{font-size:.8rem;color:rgba(var(--text-color), 0.6);margin-left:auto}#page_header{padding:1rem 0;align-items:center}#page_header h3{text-transform:capitalize}.page{padding:0 0 1rem 0}.page h3.heading{text-transform:capitalize;font-weight:500}.page>h3.heading{margin-top:2rem}.balance-card{display:flex;flex-direction:column;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' style='fill:none; stroke: %23ffffff08'%3E%3Ccircle cx='3.5' cy='3.5' r='2.12'/%3E%3Ccircle cx='5' cy='10' r='1'/%3E%3Ccircle cx='8.5' cy='4.5' r='1.5'/%3E%3Ccircle cx='6' cy='33' r='2'/%3E%3Ccircle cx='14' cy='29' r='1'/%3E%3Ccircle cx='9.5' cy='22.5' r='1.5'/%3E%3Ccircle cx='29.5' cy='17.5' r='4.5'/%3E%3Ccircle cx='22' cy='8' r='1'/%3E%3Ccircle cx='15.5' cy='12.5' r='2.5'/%3E%3Ccircle cx='27.5' cy='30.5' r='0.5'/%3E%3Ccircle cx='18.5' cy='35.5' r='2.5'/%3E%3Ccircle cx='32' cy='36' r='1'/%3E%3Ccircle cx='35' cy='25' r='1'/%3E%3Ccircle cx='23' cy='21' r='2'/%3E%3Ccircle cx='36.5' cy='1.5' r='0.5'/%3E%3Ccircle cx='30.5' cy='3.5' r='1.5'/%3E%3Ccircle cx='34.5' cy='6.5' r='1.5'/%3E%3C/svg%3E"),linear-gradient(135deg, rgb(77, 32, 167), rgb(33, 16, 110));background-size:cover;color:#fff;border-radius:.5rem;padding:max(1.5rem,3vw);margin-bottom:2rem}.balance-card h2,.balance-card h3,.balance-card h4,.balance-card h5{opacity:.8}.balance-card h3{font-size:1.5rem}.balance-card .label{color:#fff;opacity:.7}.choice,.status{padding:.5rem .8rem;border-radius:2rem;display:inline-flex;align-items:center;margin-bottom:.5rem;text-transform:capitalize;margin-right:auto}.choice-container{display:flex;flex-wrap:wrap}.choice{border:solid 1px rgba(var(--text-color), 0.2)}.choice:last-of-type{margin-bottom:0}.status{font-size:.8rem}.status.active{background:rgba(var(--text-color), 0.1);color:var(--accent-color)}.status.closed{background:rgba(var(--foreground-color), 1);border:solid 1px rgba(var(--text-color), 0.2)}.address,.token,.hash,.contract,.block-height{cursor:pointer;color:var(--accent-color)}.address{text-transform:none !important;word-break:break-all}.contract-choice{display:grid;gap:.5rem 1rem}.contract-choice:last-of-type{margin-bottom:0}#token_balance_list{display:flex;flex-wrap:wrap;gap:.5rem}.token-balance{display:flex;flex-direction:column;padding:1rem;background-color:rgba(0,0,0,.2);border-radius:.5rem;font-size:1.2rem}.transaction{display:grid;gap:1.5rem;padding:max(1rem,2vw);border-radius:.5rem;background-color:rgba(var(--foreground-color), 0.8);content-visibility:auto}.transaction .contract-info{align-items:flex-start;display:grid;gap:1.5rem}.transaction>.icon:first-of-type{fill:none;stroke:rgba(var(--text-color), 0.8);stroke-width:4;stroke-linecap:round;stroke-linejoin:round;overflow:visible;height:2.5rem;width:2.5rem;padding:.7rem;border-radius:1rem;background:rgba(var(--text-color), 0.1)}.transaction time{font-size:.9rem}#loading{position:fixed;display:grid;top:0;left:0;bottom:0;right:0;place-content:center;justify-items:center;background:rgba(var(--foreground-color), 1);z-index:10}#loading h4{margin-top:1.5rem;font-weight:500}#all_blocks_page,#top_blocks_container{display:grid;grid-template-columns:repeat(auto-fit, minmax(20rem, 1fr));gap:1rem;margin-top:1rem}.block-card{grid-template-columns:5rem 1fr auto;gap:1rem;background-color:rgba(var(--foreground-color), 1);padding:1rem;border-radius:.5rem}.block-card time{font-size:.8rem;color:rgba(var(--text-color), 0.8)}#token_balance_container{display:grid;gap:.5rem;margin-top:1.5rem}#token_balance_container .holder-balance{padding:1rem;border-radius:.5rem;background:rgba(var(--foreground-color), 1)}#error_page{padding:1.5rem 0}#view-wrappe .view-wrapper{display:grid;align-items:flex-start}#view-wrappe .view-wrapper>*{grid-area:1/1}.info-row{flex-direction:column;margin-bottom:1.3rem}#participant_container,#deposits_container{display:grid;gap:2.5rem}.participant,.deposit-card{flex-wrap:wrap;gap:2rem}@media only screen and (min-width: 640px){.margin,.page{margin:0 4vw}section header h1{font-size:2rem}#main_header{grid-template-areas:"logo theme"}#search_wrapper{grid-area:1/1/2/-1;margin:0 auto;max-width:calc(100% - 16rem)}#page_header{padding:1.5rem 0}#transaction_page{display:grid;gap:0 1.5rem;grid-template-columns:40% 60%;grid-template-areas:"header header" ". ."}#transaction_page .head{grid-area:header}.transaction{grid-template-columns:auto 1fr}.transaction>.icon:first-of-type{grid-area:1/1/3/2}.contract-choice{grid-template-columns:2fr 1fr 1fr;align-items:center}#contract_info{-moz-columns:24rem auto;columns:24rem auto;-moz-column-gap:4rem;column-gap:4rem}.info-row{flex-direction:row;gap:.5rem}.info-row h5{min-width:11rem;margin-bottom:0;margin-top:.2rem !important}}@media only screen and (min-width: 1280px){.margin,.page{margin:0 10vw}}@media(hover: hover){button{transition:background-color .3s}button:hover{background:var(--accent-color);color:rgba(var(--foreground-color), 1)}.hover{cursor:pointer}} \ No newline at end of file +*{padding:0;margin:0;box-sizing:border-box;font-family:"Inter",sans-serif}:root{font-size:clamp(1rem,1.2vmax,1.2rem)}html,body{height:100%}body{--accent-color: #3d5afe;--secondary-color: #ffac2e;--text-color: 34, 34, 34;--foreground-color: 252, 253, 255;--background-color: 241, 243, 248;--danger-color: rgb(255, 75, 75);--green: #1cad59;--yellow: rgb(220, 165, 0);color:rgba(var(--text-color), 1);background-color:rgba(var(--background-color), 1)}body[data-theme=dark]{--accent-color: #92a2ff;--secondary-color: #d60739;--text-color: 200, 200, 200;--foreground-color: 27, 28, 29;--background-color: 21, 22, 22;--danger-color: rgb(255, 106, 106);--green: #00e676;--yellow: rgb(255, 213, 5)}body[data-theme=dark] ::-webkit-calendar-picker-indicator{filter:invert(1)}h1,h2,h3,h4,h5,h6{letter-spacing:-0.01em;font-weight:700}p,strong{line-height:1.7;color:rgba(var(--text-color), 0.9);max-width:70ch}img{-o-object-fit:cover;object-fit:cover}a:where([class]){color:inherit;text-decoration:none}a:where([class]):focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color), 1) inset}a{color:var(--accent-color)}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}button,.button{-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative;display:inline-flex;border:none;background-color:rgba(0,0,0,0);overflow:hidden;color:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);align-items:center;font-size:inherit;font-weight:500;white-space:nowrap;padding:.8rem;border-radius:.3rem;justify-content:center;flex-shrink:0}button:focus-visible,.button:focus-visible{outline:var(--accent-color) solid medium}button:not(:disabled),.button:not(:disabled){cursor:pointer}.button{background-color:rgba(var(--text-color), 0.02);border:solid thin rgba(var(--text-color), 0.06)}.button--primary{color:rgba(var(--background-color), 1);background-color:var(--accent-color)}.button--primary .icon{fill:rgba(var(--background-color), 1)}.button--colored{color:var(--accent-color)}.button--colored .icon{fill:var(--accent-color)}.button--danger{background-color:rgba(255,115,115,.062745098);color:var(--danger-color)}.button--danger .icon{fill:var(--danger-color)}.button--small{padding:.4rem .6rem}.button--outlined{border:solid rgba(var(--text-color), 0.3) .1rem;background-color:rgba(var(--foreground-color), 1)}.button--transparent{background-color:rgba(0,0,0,0)}button:disabled{opacity:.4;cursor:not-allowed;filter:saturate(0)}.cta{text-transform:uppercase;font-size:.8rem;font-weight:700;letter-spacing:.05em;padding:.8rem 1rem}.icon{width:1.2rem;height:1.2rem;fill:rgba(var(--text-color), 0.8);flex-shrink:0}.icon-only{padding:.5rem;border-radius:.3rem;aspect-ratio:1/1}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}details summary{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;align-items:center;justify-content:space-between;color:var(--accent-color)}details[open] summary{margin-bottom:1rem}details[open]>summary .down-arrow{transform:rotate(180deg)}sm-input{--border-radius: 0.5rem;--background-color: rgba(var(--foreground-color), 1)}sm-spinner{--size: 1.5rem;--stroke-width: 0.1rem}sm-chips{--gap: 0.3rem}sm-chip{position:relative;font-size:.9rem;--border-radius: 0.5rem;--padding: 0.5rem 0.8rem;--background: rgba(var(--text-color), 0.06);-webkit-user-select:none;-moz-user-select:none;user-select:none;font-weight:500}sm-chip[selected]{--background: var(--accent-color);color:rgba(var(--background-color), 1)}ul{list-style:none}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.wrap-around{overflow-wrap:break-word;word-wrap:break-word;word-break:break-word}.full-bleed{grid-column:1/-1}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.sticky{position:-webkit-sticky;position:sticky}.top-0{top:0}.flex{display:flex}.flex-wrap{flex-wrap:wrap}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.grid{display:grid}.flow-column{grid-auto-flow:column}.gap-0-3{gap:.3rem}.gap-0-5{gap:.5rem}.gap-1{gap:1rem}.gap-1-5{gap:1.5rem}.gap-2{gap:2rem}.gap-3{gap:3rem}.text-align-right{text-align:right}.text-align-left{text-align:left}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-content-start{align-content:flex-start}.align-start{align-content:flex-start}.align-center{align-items:center}.align-end{align-items:flex-end}.text-center{text-align:center}.justify-start{justify-items:start}.justify-content-start{justify-content:start}.justify-content-center{justify-content:center}.justify-right{margin-left:auto}.align-self-start{align-self:start}.align-self-center{align-self:center}.align-self-end{align-self:end}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.flex-direction-column{flex-direction:column}.space-between{justify-content:space-between}.space-evenly{justify-content:space-evenly}.w-100{width:100%}.h-100{height:100%}.padding-block-1{padding-block:1rem}.margin-right-0-3{margin-right:.3rem}.margin-right-0-5{margin-right:.5rem}.margin-right-1{margin-right:1rem}.margin-left-0-5{margin-left:.5rem}.margin-left-auto{margin-left:auto}.margin-right-auto{margin-right:auto}.margin-top-1{margin-top:1rem}.margin-bottom-0-5{margin-bottom:.5rem}.margin-bottom-1{margin-bottom:1rem}.margin-bottom-2{margin-bottom:2rem}.margin-block-0-5{margin-block:.5rem}.margin-block-1{margin-block:1rem}.margin-block-1-5{margin-block:1.5rem}.margin-inline-1{margin-inline:1rem}.margin-inline-1-5{margin-inline:1.5rem}.hidden{display:none !important}.h1{font-size:2.5rem}.h2{font-size:2rem}.h3{font-size:1.4rem}.h4{font-size:1rem}.h5{font-size:.8rem}.grid-3{grid-template-columns:1fr auto auto}.flow-column{grid-auto-flow:column}.w-100{width:100%}.color-0-8{color:rgba(var(--text-color), 0.8)}.weight-400{font-weight:400}.weight-500{font-weight:500}.ws-pre-line{white-space:pre-line}.card{background-color:rgba(var(--foreground-color), 1);border-radius:.5rem;padding:max(1rem,3vw)}.ripple{height:8rem;width:8rem;position:absolute;border-radius:50%;transform:scale(0);background:radial-gradient(circle, rgba(var(--text-color), 0.3) 0%, rgba(0, 0, 0, 0) 50%);pointer-events:none}.interactive{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.observe-empty-state:empty{display:none}.observe-empty-state:not(:empty)~.empty-state{display:none}.multi-state-button{display:grid;text-align:center;align-items:center;justify-items:center}.multi-state-button>*{grid-area:1/1/2/2}.multi-state-button button{z-index:1}#confirmation_popup,#prompt_popup{flex-direction:column}#confirmation_popup h4,#prompt_popup h4{font-size:1.2rem;margin-bottom:1rem}#confirmation_popup .flex,#prompt_popup .flex{margin-top:1rem}.popup__header{position:relative;display:grid;gap:.5rem;width:100%;padding:0 1.5rem;align-items:center}.popup__header>*{grid-row:1}.popup__header h3,.popup__header h4{grid-column:1/-1;justify-self:center;align-self:center}.popup__header__close{grid-column:1;margin-left:-1rem;justify-self:flex-start}section{position:relative}section .dark-background{display:grid;grid-template-rows:auto 1fr}ul[type=circle]{padding:1.5rem 2.5rem;list-style:circle}ul[type=circle] li{margin-bottom:1rem}ul[type=circle] li:last-of-type{margin-bottom:0}ul{list-style:none}.top-bottom-padding{padding:1.5rem 0}.margin,.page{margin:0 1rem}.page{display:flex;flex-direction:column}.card{padding:2rem 1.5rem;border-radius:.5rem;background:rgba(var(--text-color), 0.06);margin:1.5rem 0}.card h2{margin-bottom:1.5rem}.transaction-container{display:grid;margin-top:1.5rem;gap:.5rem}.label{text-transform:capitalize;font-size:.8rem;margin-bottom:.3rem;color:rgba(var(--text-color), 0.8);margin-top:1.5rem;font-weight:500}.label:first-of-type{margin-top:0}.label+*{font-weight:700}.header{justify-items:center;flex-direction:column}#homepage{padding-top:0}#first_section{display:grid}header.grid-2{margin-top:2rem}@-webkit-keyframes flyInLeft{from{opacity:0;transform:translateX(-0.5rem)}to{opacity:1;transform:none}}@keyframes flyInLeft{from{opacity:0;transform:translateX(-0.5rem)}to{opacity:1;transform:none}}@-webkit-keyframes flyInRight{from{opacity:0;transform:translateX(0.5rem)}to{opacity:1;transform:none}}@keyframes flyInRight{from{opacity:0;transform:translateX(0.5rem)}to{opacity:1;transform:none}}#highlights{padding:1.5rem 0;display:grid;grid-template-columns:repeat(auto-fit, minmax(14rem, 1fr));gap:1.5rem}#highlights .highlight-item{opacity:0;display:flex;flex-direction:column;padding:1rem 1.5rem;border-left:.1rem solid rgba(var(--text-color), 0.2);--animation-duration: 0.3s}#highlights .highlight-item .label{margin-top:auto}#highlights .highlight-item h1{font-size:2rem;letter-spacing:.1rem;font-weight:500;text-transform:uppercase;overflow-wrap:break-word}#highlights .highlight-item:first-of-type{text-transform:uppercase}#highlights .highlight-item:nth-of-type(2){text-transform:capitalize}#highlights .highlight-item:first-of-type{-webkit-animation:flyInLeft var(--animation-duration) forwards;animation:flyInLeft var(--animation-duration) forwards}#highlights .highlight-item:nth-of-type(2){-webkit-animation:flyInLeft var(--animation-duration) .1s forwards;animation:flyInLeft var(--animation-duration) .1s forwards}#highlights .highlight-item:nth-of-type(3){-webkit-animation:flyInLeft var(--animation-duration) .2s forwards;animation:flyInLeft var(--animation-duration) .2s forwards}#highlights .highlight-item:last-of-type{-webkit-animation:flyInLeft var(--animation-duration) .3s forwards;animation:flyInLeft var(--animation-duration) .3s forwards}#main_header{display:grid;grid-template-columns:1fr 1fr;grid-template-areas:"logo theme" "search search";margin-top:1rem;gap:1rem}#logo{grid-area:logo;color:inherit}theme-toggle{grid-area:theme;justify-self:end;align-self:center}#search_wrapper{grid-area:search;width:min(28rem,100%);position:relative}#main_search_field{width:100%;--min-height: 2.8rem}#suggestions{position:absolute;top:100%;left:0;width:100%;background:rgba(var(--foreground-color), 1);border-radius:.5rem;z-index:1;overflow:hidden;max-height:0;transition:max-height .2s ease-in-out}#suggestions:not(:empty){max-height:20rem;overflow-y:auto}.suggestion{padding:.8rem 1rem;display:flex;align-items:center;cursor:pointer}.suggestion:hover,.suggestion:active,.suggestion:focus{background:rgba(var(--text-color), 0.06);outline:none}.suggestion .address{font-size:.8rem;color:rgba(var(--text-color), 0.6);margin-left:auto}#page_header{padding:1rem 0;align-items:center}#page_header h3{text-transform:capitalize}.page{padding:0 0 1rem 0}.page h3.heading{text-transform:capitalize;font-weight:500}.page>h3.heading{margin-top:2rem}.balance-card{display:flex;flex-direction:column;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' style='fill:none; stroke: %23ffffff08'%3E%3Ccircle cx='3.5' cy='3.5' r='2.12'/%3E%3Ccircle cx='5' cy='10' r='1'/%3E%3Ccircle cx='8.5' cy='4.5' r='1.5'/%3E%3Ccircle cx='6' cy='33' r='2'/%3E%3Ccircle cx='14' cy='29' r='1'/%3E%3Ccircle cx='9.5' cy='22.5' r='1.5'/%3E%3Ccircle cx='29.5' cy='17.5' r='4.5'/%3E%3Ccircle cx='22' cy='8' r='1'/%3E%3Ccircle cx='15.5' cy='12.5' r='2.5'/%3E%3Ccircle cx='27.5' cy='30.5' r='0.5'/%3E%3Ccircle cx='18.5' cy='35.5' r='2.5'/%3E%3Ccircle cx='32' cy='36' r='1'/%3E%3Ccircle cx='35' cy='25' r='1'/%3E%3Ccircle cx='23' cy='21' r='2'/%3E%3Ccircle cx='36.5' cy='1.5' r='0.5'/%3E%3Ccircle cx='30.5' cy='3.5' r='1.5'/%3E%3Ccircle cx='34.5' cy='6.5' r='1.5'/%3E%3C/svg%3E"),linear-gradient(135deg, rgb(77, 32, 167), rgb(33, 16, 110));background-size:cover;color:#fff;border-radius:.5rem;padding:max(1.5rem,3vw);margin-bottom:2rem}.balance-card h2,.balance-card h3,.balance-card h4,.balance-card h5{opacity:.8}.balance-card h3{font-size:1.5rem}.balance-card .label{color:#fff;opacity:.7}.choice,.status{padding:.5rem .8rem;border-radius:2rem;display:inline-flex;align-items:center;margin-bottom:.5rem;text-transform:capitalize;margin-right:auto}.choice-container{display:flex;flex-wrap:wrap}.choice{border:solid 1px rgba(var(--text-color), 0.2)}.choice:last-of-type{margin-bottom:0}.status{font-size:.8rem}.status.active{background:rgba(var(--text-color), 0.1);color:var(--accent-color)}.status.closed{background:rgba(var(--foreground-color), 1);border:solid 1px rgba(var(--text-color), 0.2)}.address,.token,.hash,.contract,.block-height{cursor:pointer;color:var(--accent-color)}.address{text-transform:none !important;word-break:break-all}.contract-choice{display:grid;gap:.5rem 1rem}.contract-choice:last-of-type{margin-bottom:0}#token_balance_list{display:flex;flex-wrap:wrap;gap:.5rem}.token-balance{display:flex;flex-direction:column;padding:1rem;background-color:rgba(0,0,0,.2);border-radius:.5rem;font-size:1.2rem}.transaction{display:grid;gap:1.5rem;padding:max(1rem,2vw);border-radius:.5rem;background-color:rgba(var(--foreground-color), 0.8);content-visibility:auto}.transaction .contract-info{align-items:flex-start;display:grid;gap:1.5rem}.transaction>.icon:first-of-type{fill:none;stroke:rgba(var(--text-color), 0.8);stroke-width:4;stroke-linecap:round;stroke-linejoin:round;overflow:visible;height:2.5rem;width:2.5rem;padding:.7rem;border-radius:1rem;background:rgba(var(--text-color), 0.1)}.transaction time{font-size:.9rem}#loading{position:fixed;display:grid;top:0;left:0;bottom:0;right:0;place-content:center;justify-items:center;background:rgba(var(--foreground-color), 1);z-index:10}#loading h4{margin-top:1.5rem;font-weight:500}#all_blocks_page,#top_blocks_container{display:grid;grid-template-columns:repeat(auto-fit, minmax(20rem, 1fr));gap:1rem;margin-top:1rem}.block-card{grid-template-columns:5rem 1fr auto;gap:1rem;background-color:rgba(var(--foreground-color), 1);padding:1rem;border-radius:.5rem}.block-card time{font-size:.8rem;color:rgba(var(--text-color), 0.8)}#token_balance_container{display:grid;gap:.5rem;margin-top:1.5rem}#token_balance_container .holder-balance{padding:1rem;border-radius:.5rem;background:rgba(var(--foreground-color), 1)}#error_page{padding:1.5rem 0}#view-wrappe .view-wrapper{display:grid;align-items:flex-start}#view-wrappe .view-wrapper>*{grid-area:1/1}.info-row{flex-direction:column;margin-bottom:1.3rem}#participant_container,#deposits_container{display:grid;gap:.5rem;background-color:rgba(0,0,0,0);padding:0}.participant,.deposit-card{flex-wrap:wrap;gap:2rem;background-color:rgba(var(--foreground-color), 1);padding:max(1rem,1.5vw);border-radius:.5rem}.participant .address,.deposit-card .address{min-width:12rem}@media only screen and (min-width: 640px){.margin,.page{margin:0 4vw}section header h1{font-size:2rem}#main_header{grid-template-areas:"logo theme"}#search_wrapper{grid-area:1/1/2/-1;margin:0 auto;max-width:calc(100% - 16rem)}#page_header{padding:1.5rem 0}#transaction_page{display:grid;gap:0 1.5rem;grid-template-columns:40% 60%;grid-template-areas:"header header" ". ."}#transaction_page .head{grid-area:header}.transaction{grid-template-columns:auto 1fr}.transaction>.icon:first-of-type{grid-area:1/1/3/2}.contract-choice{grid-template-columns:2fr 1fr 1fr;align-items:center}#contract_info{-moz-columns:24rem auto;columns:24rem auto;-moz-column-gap:4rem;column-gap:4rem}.info-row{flex-direction:row;gap:.5rem}.info-row h5{min-width:11rem;margin-bottom:0;margin-top:.2rem !important}}@media only screen and (min-width: 1280px){.margin,.page{margin:0 10vw}}@media(hover: hover){button{transition:background-color .3s}button:hover{background:var(--accent-color);color:rgba(var(--foreground-color), 1)}.hover{cursor:pointer}} \ No newline at end of file diff --git a/css/main.scss b/css/main.scss index e550a66..c820f24 100644 --- a/css/main.scss +++ b/css/main.scss @@ -969,12 +969,20 @@ theme-toggle { #participant_container, #deposits_container { display: grid; - gap: 2.5rem; + gap: 0.5rem; + background-color: transparent; + padding: 0; } .participant, .deposit-card { flex-wrap: wrap; gap: 2rem; + background-color: rgba(var(--foreground-color), 1); + padding: max(1rem, 1.5vw); + border-radius: 0.5rem; + .address { + min-width: 12rem; + } } @media only screen and (min-width: 640px) { .margin, diff --git a/index.html b/index.html index 9219a2c..14913d7 100644 --- a/index.html +++ b/index.html @@ -429,8 +429,8 @@ document.getElementById('participant_container'), html`${Object.keys(contractParticipants) .map(participant => render.participantCard({ - acceptingToken: acceptingToken, - sellingToken: sellingToken, + acceptingToken, + sellingToken, ...contractParticipants[participant] })) }` @@ -445,7 +445,7 @@ document.getElementById('deposits_container'), html`${contractDeposits.map(deposit => render.depositCard({ ...deposit, - acceptingToken: acceptingToken, + acceptingToken, }))}` ) else @@ -888,7 +888,7 @@
    Contract Type
    -

    ${replaceDash(contractType)}

    +

    ${replaceDash(contractType) === 'continuos event' ? 'continuous event' : replaceDash(contractType)}

    ${contractSubtype ? html`
    @@ -942,11 +942,11 @@ `: ''} ${contractType === 'continuos-event' && contractSubtype === 'tokenswap' ? html`
    -
    Input token
    +
    deposit token

    ${acceptingToken}

    -
    Output token
    +
    participation token

    ${sellingToken}

    @@ -1231,7 +1231,8 @@ `; }, contractCreationCard(obj) { - const { hash, blockHeight, token, contractName, incAddress, contractType, expiration, participationFees, availableChoices, time } = obj; + const { hash, blockHeight, token, contractName, incAddress, contractType, expiration, participationFees, availableChoices, time, acceptingToken, sellingToken, price } = obj; + console.log(obj) return html`
  • contract creation @@ -1251,23 +1252,47 @@ ${incAddress}
  • -
    -
    token used
    -

    ${token}

    -
    contract type
    -

    ${replaceDash(contractType)}

    +

    + ${replaceDash(contractType) === 'continuos event' ? 'continuous event' : replaceDash(contractType)} +

    + ${token ? html` +
    +
    token used
    +

    ${token}

    +
    + `: ''} + ${acceptingToken ? html` +
    +
    deposit token
    +

    ${acceptingToken}

    +
    + `: ''} + ${sellingToken ? html` +
    +
    participation token
    +

    ${sellingToken}

    +
    + `: ''} ${expiration ? html`
    expiration

    ${getFormattedTime(new Date(expiration).getTime())}

    `: ''} -
    -
    participation amount
    -

    ${participationFees} ${token}

    -
    + ${participationFees ? html` +
    +
    participation amount
    +

    ${participationFees} ${token}

    +
    + `: ''} + ${price ? html` +
    +
    price
    +

    1 ${sellingToken} = ${formatAmount(price, 'usd')} ${acceptingToken}

    +
    + `: ''}
    Transaction ID
    @@ -1505,7 +1530,7 @@ parsedFloData: { contractAddress, contractType, - contractConditions: { expiryTime } = {}, + contractConditions: { expiryTime, accepting_token, selling_token, subtype, price } = {}, contractAmount, type, tokenAmount, @@ -1562,15 +1587,31 @@ case 'smartContractIncorporation': // smart contract incorporation // todo : add checks to determine obj for different types of smart contract incorporation - obj = Object.assign({}, obj, { - contractName, - incAddress: contractAddress, - contractType, - expiration: expiryTime, - participationFees: contractAmount, - availableChoices: "", - type: "contractincorp", - }); + switch (subtype) { + case 'tokenswap': + obj = Object.assign({}, obj, { + contractName, + incAddress: contractAddress, + contractType, + type: "contractincorp", + sellingToken: selling_token, + acceptingToken: accepting_token, + price, + }); + delete obj["token"]; + break; + default: + obj = Object.assign({}, obj, { + contractName, + incAddress: contractAddress, + contractType, + expiration: expiryTime, + participationFees: contractAmount, + availableChoices: "", + type: "contractincorp", + }); + break; + } latestTxArray.push(obj); break; case 'nftIncorporation': From ec39fc3cf98bea201f892a5e012ee001ab10af41 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Tue, 6 Jun 2023 19:36:04 +0530 Subject: [PATCH 6/7] text changes --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index ca1ed63..9528729 100644 --- a/index.html +++ b/index.html @@ -1049,11 +1049,11 @@
    Deposited
    - ${originalBalance} ${sellingToken} + ${formatAmount(originalBalance, 'usd')} ${sellingToken}
    Current balance
    - ${currentBalance} ${sellingToken} + ${formatAmount(currentBalance, 'usd')} ${sellingToken}
    Status
    From c166d30f1515b3d1a58a4ac98a6000d1a95b780a Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Fri, 9 Jun 2023 10:56:23 +0530 Subject: [PATCH 7/7] Added smart contract deposit tx parsing --- index.html | 93 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 75 insertions(+), 18 deletions(-) diff --git a/index.html b/index.html index 9528729..a496fe1 100644 --- a/index.html +++ b/index.html @@ -1079,6 +1079,51 @@ `; }, + contractDepositCard(obj) { + const { hash, blockHeight, token, sender, receiver, amount, type, time, contractAddress, contractName } = obj; + let title = 'Contract deposit'; + return html` +
  • + transfer +
    +
    ${title}
    + ${token} +
    +
    + +
    +
    +
    Sender
    + + ${sender} + +
    +
    +
    Receiver
    + + ${receiver} + +
    +
    +
    +
    Contract name
    +

    ${contractName}

    +
    +
    +
    Amount
    +

    ${formatAmount(amount, token.toLowerCase() === 'rupee' ? 'inr' : 'usd')} ${token}

    +
    +
    +
    +
    Transaction ID
    + +
    + View details +
    +
    +
  • + `; + }, contractTransferCard(obj) { const { hash, token, sender, receiver, amount, contractName, userChoice, time } = obj; return html` @@ -1334,6 +1379,9 @@ case 'nfttransfer': return render.tokenTransferCard(tx) break; + case 'contractdeposit': + return render.contractDepositCard(tx) + break; case 'contracttransfer': return render.contractTransferCard(tx); break; @@ -1528,7 +1576,10 @@ txList.forEach(tx => { const { transactionDetails: { - txid, blockHeight, vin, vout, time }, + txid, blockHeight, vin, vout, time, + receiverAddress, + senderAddress, + }, parsedFloData: { contractAddress, contractType, @@ -1541,7 +1592,8 @@ contractName, triggerCondition, userChoice, - nftHash + nftHash, + depositAmount, } } = tx; let obj = { @@ -1556,8 +1608,8 @@ case 'transfer': if (transferType == "token" || transferType == 'nft') { obj = Object.assign({}, obj, { - sender: vin[0]["addr"], - receiver: getReceiver(vin, vout), + sender: senderAddress, + receiver: receiverAddress, amount: tokenAmount, type: transferType == "token" ? "tokentransfer" : "nfttransfer", }); @@ -1566,8 +1618,8 @@ } else if (transferType == 'smartContract') { // smart contract transfer obj = Object.assign({}, obj, { - sender: vin[0]["addr"], - receiver: getReceiver(vin, vout), + sender: senderAddress, + receiver: receiverAddress, amount: tokenAmount, contractName, userChoice, @@ -1580,7 +1632,7 @@ // token incorporation // smart contract incorporation obj = Object.assign({}, obj, { - incAddress: vin[0]["addr"], + incAddress: senderAddress, supply: tokenAmount, type: "tokenincorp", }); @@ -1619,33 +1671,38 @@ case 'nftIncorporation': // nft incorporation obj = Object.assign({}, obj, { - incAddress: vin[0]["addr"], + incAddress: senderAddress, supply: tokenAmount, type: "nftincorp", nftHash }); latestTxArray.push(obj); break; + case 'smartContractDeposit': + // smart contract deposit + obj = Object.assign({}, obj, { + contractName, + contractAddress, + contractType, + amount: depositAmount, + type: "contractdeposit", + sender: senderAddress, + receiver: receiverAddress, + }); + latestTxArray.push(obj); + break; } } else { // transaction is a FLO Smart Contract Committee trigger - let receiver = "", sender = vin[0]['addr']; - for (const output of vout) { - if (output["scriptPubKey"]["addresses"][0] !== vin[0]["addr"]) { - receiverAddress = output["scriptPubKey"]["addresses"][0]; - break; - } - } - obj = Object.assign({}, obj, { hash: txid, blockHeight, contractName, - contractAddress: receiver, + contractAddress: receiverAddress, winningChoice: triggerCondition, - committeeAddress: sender, + committeeAddress: senderAddress, type: 'contracttrigger' }); latestTxArray.push(obj);