/* ============================================================================ StonksScout — SHARED UI ATOMS ============================================================================ */ function TierBadge({ tier, size="md" }){ const t = tierOf(tier); const pad = size==="sm" ? "px-2 py-0.5 text-[10px]" : size==="lg" ? "px-3 py-1.5 text-[13px]" : "px-2.5 py-1 text-[11px]"; return ( {t.label} ); } function PumpRisk({ size="md" }){ const pad = size==="sm" ? "px-2 py-0.5 text-[10px]" : "px-2.5 py-1 text-[11px]"; return ( Pump Risk ); } function Chip({ children, tone="neutral" }){ const tones = { neutral: { c:"var(--text)", b:"var(--line)", bg:"var(--fill-soft)" }, pos: { c:"#1f9e6b", b:"rgba(70,211,154,0.3)", bg:"rgba(70,211,154,0.07)" }, neg: { c:"#d24b66", b:"rgba(245,85,109,0.3)", bg:"rgba(245,85,109,0.07)" }, }; const s = tones[tone]; return ( {children} ); } function ChangePill({ value, className="" }){ const pos = value>=0; const c = pos ? "#17a86a" : "#ee3f5f"; return ( {fmtPct(value).replace(/^[+\-]/,"")} ); } function Ret({ value }){ if(value==null) return ; const c = value>0 ? "#17a86a" : value<0 ? "#ee3f5f" : "var(--muted)"; return {fmtPct(value)}; } function StatCard({ label, value, sub, accent, mono=true }){ return (
{label} {value} {sub && {sub}}
); } /* Day-change inline (price + arrow %) */ function PriceChange({ price, change }){ return (
{fmtPrice(price)}
); } /* Trade frame block — entry / stop / targets / R:R */ function TradeFrame({ frame, tierColor, dense=false }){ if(!frame || frame.entry_zone==="none" || frame.stop==null){ return (
No trade — flagged setup, no levels issued
); } const cells = [ { k:"ENTRY ZONE", v:frame.entry_zone, c:"var(--text)" }, { k:"STOP", v:fmtPrice(frame.stop), c:"#ee3f5f" }, { k:"TARGETS", v:(frame.targets||[]).map(t=>Number(t).toFixed(1)).join(" → "), c:"#17a86a" }, { k:"R : R", v:fmtRR(frame.r_r), c: tierColor }, ]; return (
{cells.map((c,i)=>(
{c.k}
{c.v}
))}
); } Object.assign(window, { TierBadge, PumpRisk, Chip, ChangePill, Ret, StatCard, PriceChange, TradeFrame });