PageSourceSearch

https://mindgolf.ai/assets/ClubDetail-LD9HBwVo.js

js mindgolf.ai collected 2026-10-05 14:52:41 UTC 15,165 bytes, 1 lines download raw bytes

1import{r as u,q as ne,n as ae,j as e}from"./vendor-ahVw9cdH.js";import{aK as te,d9 as ie,bi as re,aL as me,aJ as ce,fp as le,aM as P,ac as H,bb as de,ba as ue,dZ as X,q as pe,bj as xe,a5 as R,aW as Y,bd as Z,b5 as fe,a6 as L,bk as he,eq as ge,bp as je,az as be,a7 as Ne,aX as ve,af as ke}from"./index-DXi0I5ak.js";import{T as ye}from"./TierBadge-BC65gWHk.js";import{A as _e}from"./AppBreadcrumb-DQQeh5xA.js";import{g as Se}from"./club-constants-CuFYEor4.js";import{A as Ce}from"./AICoachInsightCard-6xTqKPWd.js";import{A as Ie}from"./AIAssistantTrigger-C4Hxq-OR.js";import{u as Me}from"./useContextualInsight-C8UKmzgH.js";import{u as we,c as De}from"./useTrendDefinitions-BxLQgFuE.js";import{E as Q}from"./EmptyStateJourneyCard-Cjvz8giF.js";import{T as Te}from"./TrendBadge-1HuwsAIy.js";import{T as Ae}from"./TimeframeControls-CwLitKXI.js";import{g as K}from"./baseline-utils-BHKuQoMF.js";import{M as Ge,K as Ee}from"./KPITrendChart-BK3mreQq.js";import{I as ee}from"./InfoTooltip-CpjFUwGS.js";import"./radix--pSzM2y8.js";import"./supabase-DYrB2Yg5.js";import"./charts-CSweoJhv.js";import"./query-CeIq2NOR.js";import"./forms-Cc1FL3tT.js";import"./breadcrumb-C59QT_kB.js";import"./AICoachDrawer-D3Vuqmo6.js";import"./ChatInput-BDsLqnQQ.js";import"./useUnifiedCoachChat-BsErDRXx.js";import"./save-B9yLpn_M.js";import"./AILoadingIndicator-iQITGPSS.js";import"./subject-copy-B85nrqvU.js";import"./rocket-TSTWgVwM.js";import"./zap-FPBcTry6.js";import"./minus-D7WxUA4j.js";import"./circle-help-BWJGwUEn.js";import"./calendar-VJ0tAwC5.js";import"./setYear-lX1ccTYE.js";import"./endOfWeek-CvZ6jUGu.js";import"./isSameDay-CFziqlbR.js";import"./golf-stat-tiers-B_t78XU2.js";import"./goal-profile-to-dashboard-C5sJoTpD.js";import"./CircularProgress-BuIze6Y1.js";import"./BaselineComparison-xTuO38DM.js";import"./TrendChartEmptyState-BEf0QVo9.js";import"./arrow-up-8F0XduxV.js";function Re(k){const{data:D=[]}=te(),{data:p,hasMatchedData:I}=ie(),f=u.useMemo(()=>{var S;if(!I||!p)return[];const T=D.filter(c=>c.processingStatus==="approved");if(T.length===0)return[];const y=new Map;for(const c of T)for(const l of c.shots){const N=(S=l.golf_metrics)==null?void 0:S.club_used,d=l.mental_metrics;if(N){const s=y.get(N)||{shotCount:0,mentalSum:0,mentalCount:0};if(s.shotCount++,d&&d.commitment_kpi!==null&&d.emotions_kpi!==null&&d.focus_kpi!==null){const A=(d.commitment_kpi+d.emotions_kpi+d.focus_kpi)/3;s.mentalSum+=A,s.mentalCount++}y.set(N,s)}}const _=Array.from(y.values()).reduce((c,l)=>c+l.shotCount,0),$=p.totalSG,F=[];for(const[c,l]of y.entries()){if(l.shotCount===0)continue;const N=l.shotCount/_,d=$*N,s=l.mentalCount>0?l.mentalSum/l.mentalCount:null;F.push({club:c,sgValue:Math.round(d*100)/100,shotCount:l.shotCount,avgMentalScore:s})}return F.sort((c,l)=>l.shotCount-c.shotCount)},[D,I,p]);return{clubs:f,hasSGData:I&&f.length>0,isLoading:!1}}function _t(){var V,J,W;const{clubName:k}=ne(),D=ae(),[p,I]=u.useState("year"),[f,T]=u.useState(0),{userId:y}=re(),_=y??void 0,[$,F]=u.useState(!1),S=Me("club",k?decodeURIComponent(k):"","this_year",null,3,!!k&&$),{data:c=[],isLoading:l}=te(),{data:N}=we(),{data:d}=me(),s=k?decodeURIComponent(k):"",{isLoading:A}=ce(_),{clubs:U,hasSGData:B}=Re(),{clubs:O,isLoading:q,hasUnlockedClubs:Le}=le(_),a=u.useMemo(()=>s?O.find(t=>t.club===s):null,[O,s]);u.useMemo(()=>!B||!s?null:U.find(t=>t.club===s),[U,B,s]);const x=u.useMemo(()=>d?{commitment:K(d,"commitment_kpi"),emotions:K(d,"emotions_kpi"),focus:K(d,"focus_kpi")}:null,[d]),se=u.useMemo(()=>[{name:"Commitment",key:"commitment_kpi",icon:H,color:"text-blue-700",baseline:(x==null?void 0:x.commitment)??null,description:P.commitment_kpi.description},{name:"Emotions",key:"emotions_kpi",icon:de,color:"text-pink-500",baseline:(x==null?void 0:x.emotions)??null,description:P.emotions_kpi.description},{name:"Focus",key:"focus_kpi",icon:ue,color:"text-amber-600",baseline:(x==null?void 0:x.focus)??null,description:P.focus_kpi.description}],[x]),m=u.useMemo(()=>{const{start:t,end:o}=X(p,f),n=[];return c.forEach(r=>{const i=new Date(r.roundDate);i<t||i>o||r.shots.forEach(g=>{var w;if(((w=g.golf_metrics)==null?void 0:w.club_used)===s){const b=g.mental_metrics;
1b.commitment_kpi!==null&&b.emotions_kpi!==null&&b.focus_kpi!==null&&n.push({roundId:r.roundId,roundDate:r.roundDate,hole:g.hole_number,commitment:b.commitment_kpi,emotions:b.emotions_kpi,focus:b.focus_kpi})}})}),n},[c,s,p,f]),M=u.useMemo(()=>{if(p==="year"&&f===0)return null;const{start:t,end:o}=X(p,f+1),n=[];if(c.forEach(i=>{const g=new Date(i.roundDate);g<t||g>o||i.shots.forEach(w=>{var b;if(((b=w.golf_metrics)==null?void 0:b.club_used)===s){const C=w.mental_metrics;C.commitment_kpi!==null&&C.emotions_kpi!==null&&C.focus_kpi!==null&&n.push({commitment:C.commitment_kpi,emotions:C.emotions_kpi,focus:C.focus_kpi})}})}),n.length===0)return null;const r=n.reduce((i,g)=>({commitment:i.commitment+g.commitment,emotions:i.emotions+g.emotions,focus:i.focus+g.focus}),{commitment:0,emotions:0,focus:0});return{commitment:r.commitment/n.length,emotions:r.emotions/n.length,focus:r.focus/n.length,overall:(r.commitment+r.emotions+r.focus)/(n.length*3)}},[c,s,p,f]),j=u.useMemo(()=>{if(m.length===0)return{commitment:0,emotions:0,focus:0};const t=m.reduce((o,n)=>({commitment:o.commitment+n.commitment,emotions:o.emotions+n.emotions,focus:o.focus+n.focus}),{commitment:0,emotions:0,focus:0});return{commitment:t.commitment/m.length,emotions:t.emotions/m.length,focus:t.focus/m.length}},[m]),G=(j.commitment+j.emotions+j.focus)/3,z=M&&M.overall>0?(G-M.overall)/M.overall*100:0,E=u.useMemo(()=>{const t=new Map;return m.forEach(o=>{t.has(o.roundId)||t.set(o.roundId,{date:o.roundDate,commitment:[],emotions:[],focus:[]});const n=t.get(o.roundId);n.commitment.push(o.commitment),n.emotions.push(o.emotions),n.focus.push(o.focus)}),Array.from(t.values()).map((o,n)=>({index:n+1,label:pe(new Date(o.date),"MMM d"),commitment:o.commitment.reduce((r,i)=>r+i,0)/o.commitment.length*10,emotions:o.emotions.reduce((r,i)=>r+i,0)/o.emotions.length*10,focus:o.focus.reduce((r,i)=>r+i,0)/o.focus.length*10})).sort((o,n)=>o.index-n.index)},[m]),oe=u.useMemo(()=>E.map(t=>({date:t.label,score:(t.commitment+t.emotions+t.focus)/30})),[E]),h=N&&E.length>=2?De(oe,p,N):null,v=u.useMemo(()=>{const t=[];return c.forEach(o=>{o.shots.forEach(n=>{var r;if(((r=n.golf_metrics)==null?void 0:r.club_used)===s){const i=n.mental_metrics;i.commitment_kpi!==null&&i.emotions_kpi!==null&&i.focus_kpi!==null&&t.push({roundId:o.roundId,roundDate:o.roundDate,hole:n.hole_number,commitment:i.commitment_kpi,emotions:i.emotions_kpi,focus:i.focus_kpi})}})}),t},[c,s]);return u.useMemo(()=>{if(v.length===0)return{commitment:0,emotions:0,focus:0};const t=v.reduce((o,n)=>({commitment:o.commitment+n.commitment,emotions:o.emotions+n.emotions,focus:o.focus+n.focus}),{commitment:0,emotions:0,focus:0});return{commitment:t.commitment/v.length,emotions:t.emotions/v.length,focus:t.focus/v.length}},[v]),l?e.jsx(xe,{}):s?e.jsxs("div",{className:"space-y-3",children:[e.jsx(_e,{items:[{label:"Home",href:"/dashboard"},{label:"Analytics",href:"/performance"},{label:s}]}),e.jsx(Ie,{variant:"inline",contextType:"club_detail",contextKey:`club_${s}`,pageTitle:`${s} — club performance`,viewerRole:"player",ctaLabel:`Explore ${s}`,description:`Get a personalized read on your ${s} performance and trends.`,contextData:{clubName:s,timeframe:p},keyInsightsScope:_?{scope:"aggregate",userId:_}:void 0}),e.jsx(Ae,{timeframe:p,periodOffset:f,onTimeframeChange:I,onPeriodOffsetChange:T,compact:!0}),e.jsxs(R,{children:[e.jsx(Y,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:Se(s)}),e.jsx(Z,{className:"text-base",children:s})]}),m.length>0&&e.jsx(ye,{tier:fe(Math.round(G*10)),size:"sm"})]})}),e.jsx(L,{className:"pb-4",children:m.length===0?e.jsx("div",{className:"py-2",children:e.jsx(Q,{description:`No shots with ${s} in ${he(p,f)}. Record a round to track your club performance.`,variant:"compact"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-3 gap-2 sm:gap-4",children:se.map(t=>{const o=t.key==="commitment_kpi"?j.commitment:t.key==="emotions_kpi"?j.emotions:j.focus;return e.jsx(Ge,{value:o,baseline:t.baseline,label:t.name,metricKey:t.key,description:t.description,icon:t.icon,iconColor:t.color,size:"md",showBaselineMarker:!0,showBaselineText:!1,showInlineComparison:!0},t.key)})}),e.jsxs("div",{className:"flex items-center justify-center gap-2 sm:gap-3 mt-4 pt-3 border-t text-[10px] sm:text-xs text-muted-foreground",children:[p!=="year"&&M&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:z>=0?"text-green-500":"text-red-500",children:[e.jsxs("strong",{children:[z>=0?"+":"",z.toFixed(1),"%"]})," vs prev"]}
1),e.jsx("span",{className:"text-muted-foreground/50",children:"•"})]}),e.jsxs("span",{children:[e.jsx("strong",{className:"text-foreground",children:new Set(m.map(t=>t.roundId)).size})," rounds"]}),e.jsx("span",{className:"text-muted-foreground/50",children:"•"}),e.jsxs("span",{children:[e.jsx("strong",{className:"text-foreground",children:m.length})," shots"]}),h&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground/50",children:"•"}),e.jsx(Te,{trend:h.trend,size:"sm",tierContext:h.metrics.tierTransitions?{startTierName:h.metrics.tierTransitions.startTierName,endTierName:h.metrics.tierTransitions.endTierName,netTierChange:h.metrics.tierTransitions.netTierChange}:void 0})]})]})]})})]}),(a==null?void 0:a.isUnlocked)&&e.jsxs(R,{children:[e.jsxs(Y,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Z,{className:"text-base flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-violet-500"}),"Strokes Gained Impact"]}),e.jsx(ge,{value:a.sgImpact,size:"md"})]}),e.jsxs(je,{className:"text-xs",children:["How your mental game with ",s," affects strokes gained"]})]}),e.jsxs(L,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-between text-xs text-muted-foreground",children:e.jsxs("span",{className:"flex items-center gap-1",children:["Recent vs Historical",e.jsx(ee,{description:"Compares your recent mental score with this club against your all-time average."})]})}),e.jsxs("div",{className:"bg-muted/30 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg font-bold",children:((V=a.recentMentalAvg)==null?void 0:V.toFixed(1))??"-"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Recent Avg"})]}),e.jsx("div",{className:"text-muted-foreground text-sm",children:"→"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg font-bold",children:((J=a.historicalMentalAvg)==null?void 0:J.toFixed(1))??"-"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Historical Avg"})]}),e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:be("text-lg font-bold",(a.sgImpact??0)>=0?"text-emerald-600":"text-red-600"),children:[(a.recentMentalAvg??0)-(a.historicalMentalAvg??0)>=0?"+":"",((a.recentMentalAvg??0)-(a.historicalMentalAvg??0)).toFixed(1)]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Deviation"})]})]}),e.jsxs("p",{className:"text-[10px] text-muted-foreground text-center mt-2",children:["Based on ",a.sampleSize," matched rounds"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs border-t pt-3",children:[e.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:["Confidence (R²)",e.jsx(ee,{description:"Measures how reliably your mental score with this club predicts strokes gained."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium",children:[((a.rSquared??0)*100).toFixed(0),"%"]}),e.jsx(Ne,{variant:"outline",className:"text-[10px]",children:a.confidenceLabel})]})]})]})]}),(A||q)&&m.length>0&&e.jsx(R,{children:e.jsx(L,{className:"py-6",children:e.jsx(ve,{className:"h-24 w-full"})})}),!(a!=null&&a.isUnlocked)&&!A&&!q&&m.length>0&&e.jsx(R,{className:"border-dashed border-2 border-violet-500/20",children:e.jsxs(L,{className:"pt-6 pb-6 text-center space-y-4",children:[e.jsx("div",{className:"mx-auto w-12 h-12 rounded-full bg-violet-500/10 flex items-center justify-center",children:e.jsx(H,{className:"h-6 w-6 text-violet-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold",children:"Unlock Strokes Gained Impact"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1 max-w-xs mx-auto",children:["Import SG data and record more rounds to see how your mental game with ",e.jsx("span",{className:"font-medium",children:s})," affects your strokes gained"]})]}),e.jsxs("div",{className:"bg-violet-500/10 border border-violet-500/20 rounded-lg p-4 max-w-xs mx-auto text-left",children:[e.jsxs("p",{className:"text-xs font-medium text-violet-600 dar
1k:text-violet-400 mb-2 flex items-center gap-2",children:[e.jsx(ke,{className:"h-3.5 w-3.5"}),"What you'll unlock:"]}),e.jsxs("ul",{className:"space-y-1.5 text-xs text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-violet-500 mt-0.5",children:"•"}),e.jsxs("span",{children:[e.jsx("strong",{className:"text-foreground",children:"SG Impact"})," — See strokes gained/lost per round"]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-violet-500 mt-0.5",children:"•"}),e.jsxs("span",{children:[e.jsx("strong",{className:"text-foreground",children:"Recent vs Historical"})," — Mental deviation context"]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-violet-500 mt-0.5",children:"•"}),e.jsxs("span",{children:[e.jsx("strong",{className:"text-foreground",children:"Confidence"})," — Based on regression R²"]})]})]})]})]})}),m.length>0&&e.jsx(Ce,{dimensionLabel:s,dimensionKey:`club_${s}`,contextType:"on_course",contextKeyOverride:"club",contextData:{clubName:s,currentScore:G,commitmentScore:j.commitment,emotionsScore:j.emotions,focusScore:j.focus,trend:(W=h==null?void 0:h.trend)==null?void 0:W.key,totalSGImpact:a==null?void 0:a.sgImpact,roundCount:new Set(m.map(t=>t.roundId)).size,shotCount:m.length},insight:`Your ${s} mental score is at ${Math.round(G*10)}%${(a==null?void 0:a.sgImpact)!==void 0?` with ${a.sgImpact>=0?"+":""}${a.sgImpact.toFixed(2)} SG impact`:""}. Tap to explore patterns and get personalized coaching.`,contextualInsight:S.insight,contextualExercise:S.exercise,contextualLoading:S.isLoading}),m.length>0&&e.jsx(Ee,{chartData:E,kpiBaselines:x,trendAnalysis:h,title:"Performance Trend",description:`Mental KPIs when using ${s}`,showEmptyState:!0,emptyStateType:"rounds",emptyStateMetricLabel:s}),v.length===0&&e.jsx(Q,{description:`No shots with ${s} recorded yet. Record a round to see mental performance with this club.`,variant:"compact"})]}):(D("/golf"),null)}export{_t 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.