This commit is contained in:
tim
2025-01-16 20:17:03 -04:00
parent 19a8ffbbd4
commit 0545cd6e97
51 changed files with 482 additions and 436 deletions

View File

@@ -4,6 +4,7 @@ import {token} from "@/blockchain/token.js";
import Color from "color";
import {DateTime} from "luxon";
import router from "@/router/index.js";
import {dateString} from "@/common.js";
export function nav(name) {
// noinspection JSIgnoredPromiseFromCall
@@ -101,18 +102,6 @@ export function timestampString(seconds) {
}
export function dateString(datetime) {
return datetime.toLocaleString({dateStyle: 'medium', timeStyle: 'short'})
}
export function timestamp(date = null) {
if (date === null)
date = new Date()
return Math.round(date.getTime() / 1000)
}
export function pairKey(chainId, tokenA, tokenB) {
const token0 = tokenA.a < tokenB.a ? tokenA.a : tokenB.a
const token1 = tokenA.a > tokenB.a ? tokenA.a : tokenB.a
@@ -172,7 +161,12 @@ export function uuid() {
}
export function lightenColor(color, lightness = 85, alpha = null) {
let c = new Color(color).hsl().lightness(lightness).rgb()
let c = new Color(color).hsl()
if (useStore().theme === 'light')
c = c.lightness(lightness)
else
c = c.lightness(100-lightness)
c = c.rgb()
if (alpha !== null)
c = c.alpha(alpha)
return c.string()