Style Strike ticker: single column, currency symbols, Danish formatting, sats display
Show 54€ equivalent in sats with dark blue styling, light gray background, and Danish number formatting for BTC/USDT and BTC/EUR values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -102,21 +102,42 @@
|
|||||||
|
|
||||||
;; --- Strike rendering ---
|
;; --- Strike rendering ---
|
||||||
|
|
||||||
(def ^:private strike-pairs ["BTC/USDT" "BTC/EUR" "USDT/EUR" "EUR/BTC"])
|
(def ^:private strike-pairs
|
||||||
|
[["BTC/USDT" "$"]
|
||||||
|
["BTC/EUR" "\u20AC"]
|
||||||
|
["USDT/EUR" ""]
|
||||||
|
["EUR/BTC" ""]])
|
||||||
|
|
||||||
|
(defn- format-strike-amount [prefix amount]
|
||||||
|
(if amount
|
||||||
|
(let [v (double (bigdec amount))]
|
||||||
|
(case prefix
|
||||||
|
"$" (str prefix (da-fmt "%,.2f" v))
|
||||||
|
"\u20AC" (str prefix (da-fmt "%,.2f" v))
|
||||||
|
amount))
|
||||||
|
"\u2014"))
|
||||||
|
|
||||||
|
(defn- eur-to-sats [rates]
|
||||||
|
(when-let [eur-btc (get rates "EUR/BTC")]
|
||||||
|
(long (* 54 (double (bigdec eur-btc)) 100000000))))
|
||||||
|
|
||||||
(defn- strike-json->html [text]
|
(defn- strike-json->html [text]
|
||||||
(let [rates (json/read-str text)]
|
(let [rates (json/read-str text)
|
||||||
|
sats (eur-to-sats rates)]
|
||||||
(str "<div id=\"strike-display\">"
|
(str "<div id=\"strike-display\">"
|
||||||
"<div class=\"bg-white rounded-2xl shadow-sm border border-gray-200 p-6\">"
|
"<div class=\"rounded-2xl shadow-sm border border-gray-200 p-6\" style=\"background:#f3f4f6;\">"
|
||||||
"<p class=\"text-center text-sm font-bold text-gray-500 mb-3\">Strike Ticker</p>"
|
(if sats
|
||||||
"<div class=\"grid grid-cols-2 gap-x-6 gap-y-1\">"
|
(str "<p class=\"text-center text-2xl font-bold mb-3\" style=\"color:#1e3a5f;\">"
|
||||||
|
(da-fmt "%,d" sats) " <span style=\"color:#1e3a5f;\">sats</span></p>")
|
||||||
|
"")
|
||||||
|
"<div style=\"display:grid;grid-template-columns:1fr;row-gap:0.25rem;\">"
|
||||||
(apply str
|
(apply str
|
||||||
(for [pair strike-pairs
|
(for [[pair prefix] strike-pairs
|
||||||
:let [amount (get rates pair)]]
|
:let [amount (get rates pair)]]
|
||||||
(str "<div class=\"flex justify-between items-center py-1\">"
|
(str "<div style=\"display:flex;justify-content:space-between;align-items:center;padding:0.25rem 0;\">"
|
||||||
"<span class=\"text-sm text-gray-500\">" pair "</span>"
|
"<span class=\"text-sm text-gray-500\">" pair "</span>"
|
||||||
"<span class=\"text-sm font-bold text-gray-900\">"
|
"<span class=\"text-sm font-bold text-gray-900\">"
|
||||||
(or amount "\u2014")
|
(format-strike-amount prefix amount)
|
||||||
"</span></div>")))
|
"</span></div>")))
|
||||||
"</div></div></div>")))
|
"</div></div></div>")))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user