PageSourceSearch

https://www.hobbymonitor.com/assets/member-detail-BJpXGeeK.js

js hobbymonitor.com collected 2026-09-24 13:59:30 UTC 9,681 bytes, 1 lines download raw bytes

1import{a as e,u as r,j as t}from"./query-vendor-DZMRrbMU.js";import{P as s,u as a,L as i,aN as d,aO as n,k as l}from"./index-Ww_mg2y_.js";import{h as o,aB as m,ai as c}from"./icon-vendor-BVA9AJ-N.js";import{R as u,C as x,a as h,X as p,Y as f,T as g,A as b,L as j}from"./chart-vendor-C9AHoz67.js";import"./ui-vendor-BNlO3lKu.js";import"./firebase-vendor-CX_xv3XA.js";import"./form-vendor-BbpM4sBQ.js";import"./date-vendor-CXQvy03X.js";import"./image-vendor-CbOcgYXP.js";function v(e){return null==e?"--":`$${e.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`}function y(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function N(){const N=s(),{user:w}=a(),k=N.slug??"",P=Number(N.memberId),[S,F]=e.useState(90),[$,C]=e.useState(()=>"undefined"==typeof window?7:"30"===localStorage.getItem("index-member-ma")?30:7);e.useEffect(()=>localStorage.setItem("index-member-ma",String($)),[$]);const R=w&&("premium"===(null==w?void 0:w.tier)||"pro"===(null==w?void 0:w.tier)||(null==w?void 0:w.isAdmin)),{data:I}=r({queryKey:["market-index",k,null==w?void 0:w.uid],queryFn:async()=>{const e={};w&&(e.Authorization=`Bearer ${await w.getIdToken()}`);const r=await fetch(`/api/market-indices/${k}`,{headers:e});if(!r.ok)throw new Error("Failed to load index");return r.json()},staleTime:6e5}),L=null==I?void 0:I.data,T=null==L?void 0:L.members.find(e=>e.id===P),q=e.useMemo(()=>{if(!L||!(null==T?void 0:T.latestRawPrice))return null;const e=L.members.reduce((e,r)=>e+(r.latestRawPrice?parseFloat(r.latestRawPrice):0),0);return e<=0?null:parseFloat(T.latestRawPrice)/e*100},[L,T]),{data:z}=r({queryKey:["member-history",k,P,S,null==w?void 0:w.uid],enabled:!!R&&!!k&&Number.isFinite(P),queryFn:async()=>{const e={};w&&(e.Authorization=`Bearer ${await w.getIdToken()}`);const r=await fetch(`/api/market-indices/${k}/members/${P}/history?days=${S}`,{headers:e});if(!r.ok)throw new Error("Failed to load history");return r.json()},staleTime:6e5}),D=e.useMemo(()=>{const e=((null==z?void 0:z.data)??[]).map(e=>({date:y(e.recordedDate),price:e.rawPrice?parseFloat(e.rawPrice):null}));return e.map((r,t)=>{const s=Math.max(0,t-$+1),a=e.slice(s,t+1).map(e=>e.price).filter(e=>null!=e);return{...r,trend:a.length?Math.round(a.reduce((e,r)=>e+r,0)/a.length):null}})},[z,$]),{data:M}=r({queryKey:["member-listings",k,P,null==w?void 0:w.uid],enabled:!!R&&!!k&&Number.isFinite(P),queryFn:async()=>{const e={};w&&(e.Authorization=`Bearer ${await w.getIdToken()}`);const r=await fetch(`/api/market-indices/${k}/members/${P}/listings`,{headers:e});if(!r.ok)throw new Error("Failed to load listings");return r.json()},staleTime:6e5}),U=(null==M?void 0:M.data)??[],A=(null==T?void 0:T.latestRawPrice)?parseFloat(T.latestRawPrice):null,G=(null==T?void 0:T.latestGradedPrice)?parseFloat(T.latestGradedPrice):null;return t.jsx("div",{className:"min-h-dvh bg-background",children:t.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-4",children:[t.jsxs(i,{href:`/indices/${k}`,className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground mb-4",children:[t.jsx(o,{className:"h-4 w-4"})," ",(null==L?void 0:L.name)??"Index"]}),T?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-4 mb-5",children:[t.jsx("div",{className:"w-20 shrink-0",children:t.jsx(d,{variant:"premium",aspectRatio:"portrait",borderGlow:!0,children:T.coverImagePath&&"skip"!==T.coverImagePath?t.jsx("img",{src:`/api/images/300/85${T.coverImagePath}`,alt:T.displayName,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full flex items-center justify-center bg-muted text-muted-foreground text-xs",children:"No image"})})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-xl md:text-2xl font-bold text-foreground leading-tight",children:T.displayName}),t.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:["Member of ",null==L?void 0:L.name]}),T.lastPriceUpdate&&t.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Updated ",y(T.lastPriceUpdate)]})]})]}),R?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 bg-card rounded-lg border border-border p-4 mb-5",children:[t.jsx(n,{value:v(A),label:"Raw",valueColor:"green"}),t.jsx(n,{value:v(G),label:"PSA 10",valueColor:"blue"}),t.jsx(n,{value:T.latestSaleCount??"--",label:"Sales"}),t.jsx(n,{value:null!=T.latestConfidence?`${T.latestConfidence}%`:"--",label:"Confidence",valueColor:"amber"})]}),null!=q&&t.jsxs("div",{className:"bg-card rounded-lg border border-border p-4 mb-5",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Weight in index"}),t.jsxs("span",{className:"text-sm font-bold tabular-nums text-foreground",children:[q.toFixed(1),"%"]})]}),t.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-primary rounded-full",style:{width:`${Math.min(100,q)}%`}})}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:"Share of this equal-weighted index by current raw value."})]}),t.jsxs("div",{className:"bg-card rounded-lg border border-border p-4 mb-5",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3 gap-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(c,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Price History"})]}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap justify-end",children:[t.jsx("div",{className:"flex gap-1",children:[30,90,180].map(e=>t.jsxs("button",{onClick:()=>F(e),className:l("px-2 py-0.5 rounded text-xs font-medium transition-colors",S===e?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:[e,"d"]},e))}),t.jsx("div",{className:"flex gap-1 bg-muted/50 rounded p-0.5",role:"tablist","aria-label":"Trend smoothing",children:[7,30].map(e=>t.jsxs("button",{role:"tab","aria-selected":$===e,onClick:()=>C(e),className:l("px-2 py-0.5 rounded text-xs font-medium transition-colors",$===e?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[e,"d avg"]},e))})]})]}),0===D.length?t.jsx("p",{className:"text-xs text-muted-foreground text-center py-10",children:"History will appear after a few days of tracking."}):t.jsx("div",{className:"h-[220px]",children:t.jsx(u,{width:"100%",height:"100%",children:t.jsxs(x,{data:D,margin:{top:5,right:10,bottom:5,left:0},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"memberPriceGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"5%",
1stopColor:"hsl(var(--primary))",stopOpacity:.2}),t.jsx("stop",{offset:"95%",stopColor:"hsl(var(--primary))",stopOpacity:0})]})}),t.jsx(h,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",opacity:.5}),t.jsx(p,{dataKey:"date",tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"},interval:"preserveStartEnd",tickLine:!1,axisLine:!1}),t.jsx(f,{tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"},tickFormatter:e=>`$${e}`,tickLine:!1,axisLine:!1,width:45}),t.jsx(g,{contentStyle:{backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"},formatter:(e,r)=>[`$${e.toLocaleString()}`,"price"===r?"Raw":`${$}d avg`]}),t.jsx(b,{type:"monotone",dataKey:"price",stroke:"hsl(var(--primary))",strokeOpacity:.3,strokeWidth:1,fill:"url(#memberPriceGrad)",dot:!1,connectNulls:!0}),t.jsx(j,{type:"monotone",dataKey:"trend",name:"trend",stroke:"#f59e0b",strokeWidth:2.5,dot:!1,connectNulls:!0})]})})}),t.jsxs("div",{className:"flex items-center justify-center gap-4 mt-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-0.5 bg-primary/30 rounded"})," Raw"]}),t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-[2px] bg-amber-500 rounded"})," ",$,"d avg"]})]})]}),U.length>0&&t.jsxs("div",{className:"bg-card rounded-lg border border-border p-4",children:[t.jsx("h3",{className:"text-sm font-medium text-foreground mb-3",children:"Recent Sales"}),t.jsx("div",{className:"divide-y divide-border",children:U.slice(0,12).map(e=>t.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-foreground truncate",children:e.listingTitle??"Sale"}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:y(e.soldDate)})]}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsxs("span",{className:"text-sm font-semibold tabular-nums text-foreground",children:["$",parseFloat(e.price).toLocaleString()]})})]},e.id))})]})]}):t.jsxs("div",{className:"bg-card rounded-lg border border-border p-8 text-center",children:[t.jsx(m,{className:"h-5 w-5 text-muted-foreground mx-auto mb-2"}),t.jsx("h3",{className:"text-sm font-medium text-foreground mb-1",children:"Premium Feature"}),t.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Unlock member prices, price history, and recent sales."}),t.jsx(i,{href:"/about#pricing",className:"inline-flex items-center px-4 py-2 rounded-md bg-primary text-primary-foreground text-sm font-medium",children:"Upgrade to Premium"})]})]}):t.jsx("div",{className:"bg-card rounded-lg border border-border p-8 text-center text-sm text-muted-foreground",children:"Member not found in this index."})]})})}export{N as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.