PageSourceSearch

https://edgemxtiming.com/assets/TrackDetail-BsXsF6hp.js

js edgemxtiming.com collected 2026-10-02 01:28:08 UTC 15,570 bytes, 11 lines download raw bytes

1import{c as X,r,j as e,m as D,o as P,p as $,B as i,n as F,E as se,F as ae,G as te,H as ne,b as V,I as K,S as le,w as re,x as ie,y as ce,z as de,J as oe,u as A,K as he,e as me,i as ue,f as J,d as xe,L as B,v as pe,D as ge,M as je,O as fe}from"./index-Ct8eLu1I.js";import{u as Y,a as ve,b as Ne}from"./useTrackLayouts-KitONxSp.js";import{d as Z,c as I,e as ye,g as be,h as _e,i as we,t as Q,f as Ce,R as Te,b as ke,a as G}from"./TrackFormDialog-BpXq1nQ1.js";import{T as Se}from"./TrackTraceMap-CsH7PoJO.js";import{P as ee}from"./plus-Dwixvwn_.js";import{P as U}from"./pencil-7iZSNVNj.js";import{T as Le}from"./trash-2-LxvlgA12.js";import{M as ze}from"./map-pin-DUB0IYFr.js";import{C as Me}from"./chevron-left-m_yK3qef.js";import{C as Ee}from"./calendar-days-DHySvoZM.js";import{G as Oe}from"./globe-Cc4mX4QA.js";import{P as Ae}from"./phone-CEN_vm4h.js";import"./textarea-ZX0L5GAv.js";import"./checkbox-s2xEAdOA.js";import"./slider-7jwSdK_r.js";import"./search-BsvfnwMH.js";import"./rotate-ccw-LStRxjRV.js";import"./flag-BttTACQc.js";import"./upload-BEA5_Dm0.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const De=X("MapPinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Pe=X("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);function $e({trackId:f,canEdit:s,embedded:v=!1}){const{data:N=[]}=Y(f),h=ve(),T=Ne(f),{data:l}=Z(f),[n,x]=r.useState(!1),[c,k]=r.useState(!1),[p,S]=r.useState(null),[y,L]=r.useState(""),[b,_]=r.useState(""),[z,g]=r.useState("feet"),[w,m]=r.useState(""),[M,C]=r.useState(null),R=()=>{S(null),L(""),_(""),g("feet"),m(""),C(null),x(!0)},H=t=>{S(t),L(t.name),_(t.length_value!=null?String(t.length_value):""),g(t.length_unit||"feet"),m(t.notes??""),C(t.map_trace??null),x(!0)},E=async()=>{if(!y.trim()){A.error("Give the lap a name");return}try{await h.mutateAsync({id:p==null?void 0:p.id,input:{track_id:f,name:y.trim(),length_value:b.trim()?Number(b):null,length_unit:z,notes:w.trim()||null,...M?{map_trace:M}:{}}}),x(!1),A.success("Lap saved")}catch(t){A.error((t==null?void 0:t.message)||"Could not save that lap")}},d=async t=>{try{await T.mutateAsync(t.id),A.success("Lap removed")}catch(u){A.error((u==null?void 0:u.message)||"Could not remove that lap")}};return!s&&N.length===0?null:e.jsxs(D,{className:v?"border-0 shadow-none bg-transparent":void 0,children:[e.jsxs(P,{className:`flex flex-row items-center justify-between gap-3 ${v?"p-0 pb-2 space-y-0":""}`,children:[e.jsxs($,{className:`flex items-center gap-2 ${v?"text-sm text-muted-foreground":"text-lg"}`,children:[e.jsx(Pe,{className:"h-4 w-4"})," Lap versions"]}),s&&e.jsxs(i,{size:"sm",variant:"outline",onClick:R,children:[e.jsx(ee,{className:"h-4 w-4 mr-1"})," Add lap"]})]}),e.jsx(F,{className:v?"p-0":void 0,children:N.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a shorter lap here if some classes (like 50s) run a cut-down version of this track. Classes without a lap version use the track's main length."}):e.jsx("ul",{className:"divide-y divide-border",children:N.map(t=>e.jsxs("li",{className:"py-2 flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[I(t.length_value,t.length_unit),t.notes?` — ${t.notes}`:""]})]}),s&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(i,{size:"icon",variant:"ghost",onClick:()=>H(t),"aria-label":"Edit lap",children:e.jsx(U,{className:"h-4 w-4"})}),e.jsx(i,{size:"icon",variant:"ghost",onClick:()=>d(t),"aria-label":"Remove lap",children:e.jsx(Le,{className:"h-4 w-4"})})]})]},t.id))})}),e.jsx(se,{open:n,onOpenChange:x,children:e.jsxs(ae,{children:[e.jsx(te,{children:e.jsx(ne,{children:p?"Edit lap version":"Add lap version"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(V,{htmlFor:"layout-name",children:"Name"}),e.jsx(K,{id:"layout-name",value:y,onChange:t=>L(t.target.value),placeholder:"Short lap (50cc)"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(V,{htmlFor:"layout-length",children:"Lap length"}),e.jsx(K,{id:"layout-length",inputMode:"decimal",value:b,onChange:t=>_(t.target.value),placeholder:"1800"}),e.jsxs(i,{type:"button",variant:"link",size:"sm",className:"px-0 h-auto mt-1",onClick:()=>k(!0),children:[e.jsx(De,{className:"h-3.5 w-3.5 mr-1"})," Trace it on the map"]})]}),e.jsxs("div",{children:[e.jsx(V,{children:"Unit"}),e.jsxs(le,{value:z,onValueChange:t=>g(t),children:[e.jsx(re,{children:e.jsx(ie,{})}),e.jsx(ce,{children:ye.map(t=>e.jsx(de,{value:t.value,children:t.label},t.value))})]})]})]}),e.jsxs("div",{children:[e.jsx(V,{htmlFor:"layout-notes",children:"Notes"}),e.jsx(K,{id:"layout-notes",value:w,onChange:t=>m(t.target.value),placeholder:"Cuts the back section"})]})]}),e.jsxs(oe,{children:[e.jsx(i,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),e.jsx(i,{onClick:E,disabled:h.isPending,children:"Save"})]})]})}),e.jsx(be,{open:c,onOpenChange:k,latitude:l==null?void 0:l.latitude,longitude:l==null?void 0:l.longitude,searchHint:[l==null?void 0:l.name,l==null?void 0:l.city,l==null?void 0:l.state].filter(
11Boolean).join(", "),initialTrace:M,onApply:({feet:t,trace:u})=>{_(String(t)),g("feet"),C(u)}})]})}const ts=()=>{var W;const{trackId:f}=he(),{data:s,isLoading:v}=Z(f),{data:N=[]}=_e(f),{user:h,isSuperAdmin:T}=me(),{data:l=[]}=we(s),n=l.find(a=>a.id===(s==null?void 0:s.parent_track_id))??null;l.filter(a=>a.id!==(s==null?void 0:s.id));const x=a=>!a.parent_track_id&&l.length>1&&!a.length_value&&!a.map_trace,c=l.filter(a=>!x(a)||a.id===(s==null?void 0:s.id)),k=l.filter(a=>!x(a)),p=ue(),S=Math.max(0,c.findIndex(a=>a.id===(s==null?void 0:s.id))),y=a=>{if(c.length<2)return;const o=c[(S+a+c.length)%c.length];o&&o.id!==(s==null?void 0:s.id)&&p(`/tracks/${o.id}`)},[L,b]=r.useState(!1),[_,z]=r.useState(!1),[g,w]=r.useState(null),m=a=>{var o;return((o=a.course_name)==null?void 0:o.trim())||(a.parent_track_id?a.name:"Main course")},[M,C]=r.useState(!1),{data:R=[]}=Y(s==null?void 0:s.id),[H,E]=r.useState(0);r.useEffect(()=>{E(0)},[s==null?void 0:s.id]);const d=r.useMemo(()=>{var O;const a=[{name:`${((O=s==null?void 0:s.course_name)==null?void 0:O.trim())||(s!=null&&s.parent_track_id?s==null?void 0:s.name:"Main course")} lap`,src:Q(s==null?void 0:s.map_trace)??(s==null?void 0:s.photo_url)??null,trace:s==null?void 0:s.map_trace,length:I((s==null?void 0:s.length_value)??null,(s==null?void 0:s.length_unit)??"feet")}],o=R.map(j=>({name:j.name,src:Q(j.map_trace)??(s==null?void 0:s.photo_url)??null,trace:j.map_trace,length:I(j.length_value,j.length_unit)}));return[...a,...o]},[R,s==null?void 0:s.map_trace,s==null?void 0:s.photo_url,s==null?void 0:s.length_value,s==null?void 0:s.length_unit,s==null?void 0:s.course_name,s==null?void 0:s.parent_track_id,s==null?void 0:s.name]),t=d[Math.min(H,d.length-1)],u=!!s&&(T||!!h&&s.created_by_user_id===h.id);return v?e.jsx(J,{children:e.jsx("div",{className:"flex justify-center py-24",children:e.jsx(xe,{className:"h-8 w-8 animate-spin text-primary"})})}):s?e.jsxs(J,{children:[e.jsx("section",{className:"bg-muted py-10",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsx(B,{to:"/tracks",className:"text-sm text-muted-foreground hover:text-foreground",children:"← All tracks"}),e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 mt-3",children:[e.jsxs("div",{children:[n&&e.jsxs(B,{to:`/tracks/${n.id}`,className:"text-sm text-primary hover:underline",children:["Part of ",n.name]}),e.jsx("h1",{className:"font-display text-4xl text-foreground",children:s.name}),e.jsxs("p",{className:"text-muted-foreground mt-1 flex items-center gap-2",children:[e.jsx(ze,{className:"h-4 w-4"}),Ce(s.city,s.state)||"Location not set"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.is_verified&&e.jsx(pe,{variant:"secondary",children:"Verified"}),u&&n&&e.jsxs(i,{variant:"outline",onClick:()=>z(!0),children:[e.jsx(U,{className:"h-4 w-4 mr-2"})," Edit ",n.name]}),u&&e.jsxs(i,{variant:"outline",onClick:()=>b(!0),children:[e.jsx(U,{className:"h-4 w-4 mr-2"})," ",n?"Edit track":"Edit facility"]})]})]})]})}),e.jsx("section",{className:"py-10 bg-background",children:e.jsxs("div",{className:"container mx-auto px-4 grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[(s.photo_url||c.length>1||d.length>1)&&e.jsxs("div",{className:"relative",children:[(W=t.trace)!=null&&W.points&&t.trace.points.length>=3?e.jsx(Se,{trace:t.trace,interactive:!1,className:"w-full h-[520px] rounded-lg border border-border bg-card"}):t.src?e.jsx("img",{src:t.src,alt:`${s.name} ${t.name} map`,loading:"lazy",className:"w-full rounded-lg border border-border bg-card object-contain max-h-[520px]"}):e.jsxs("div",{className:"w-full rounded-lg border border-border bg-card p-12 text-center text-muted-foreground",children:["No map saved for ",t.name," yet."]}),c.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(i,{variant:"outline",size:"icon","aria-label":"Previous track here",className:"absolute left-2 top-1/2 z-[1000] -translate-y-1/2 rounded-full shadow bg-background",onClick:()=>y(-1),children:e.jsx(Me,{className:"h-5 w-5"})}),e.jsx(i,{variant:"outline",size:"icon","aria-label":"Next track here",className:"absolute right-2 top-1/2 z-[1000] -translate-y-1/2 roun
11ded-full shadow bg-background",onClick:()=>y(1),children:e.jsx(ge,{className:"h-5 w-5"})})]}),d.length>1&&e.jsxs("div",{className:"absolute right-4 top-4 z-[1000] flex flex-col gap-2",children:[e.jsx(i,{variant:"outline",size:"icon","aria-label":"Previous lap version",className:"rounded-full shadow bg-background",onClick:()=>E(a=>(a-1+d.length)%d.length),children:e.jsx(je,{className:"h-5 w-5"})}),e.jsx(i,{variant:"outline",size:"icon","aria-label":"Next lap version",className:"rounded-full shadow bg-background",onClick:()=>E(a=>(a+1)%d.length),children:e.jsx(fe,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"absolute bottom-2 left-2 z-[1000] rounded-lg bg-background/90 border border-border px-3 py-1.5 text-sm font-medium shadow",children:[m(s),c.length>1&&e.jsxs("span",{className:"text-muted-foreground font-normal",children:[" · ",S+1," of ",c.length]}),d.length>1&&e.jsxs("div",{className:"text-xs font-normal text-muted-foreground",children:[t.name," · lap ",H+1," of ",d.length,t.length?` · ${t.length}`:""]})]})]}),s.notes&&e.jsxs(D,{children:[e.jsx(P,{children:e.jsx($,{className:"text-lg",children:"Notes"})}),e.jsx(F,{className:"whitespace-pre-wrap text-muted-foreground",children:s.notes})]}),e.jsxs(D,{children:[e.jsxs(P,{className:"flex flex-row items-center justify-between gap-3 space-y-0",children:[e.jsxs($,{className:"text-lg",children:["Tracks at ",(n??s).name]}),u&&e.jsxs(i,{variant:"outline",size:"sm",onClick:()=>C(!0),children:[e.jsx(ee,{className:"h-4 w-4 mr-2"})," Add a track"]})]}),e.jsxs(F,{className:"space-y-4",children:[k.length<=1&&e.jsx("p",{className:"text-muted-foreground text-sm",children:"This is the only track saved here. Add another one if this place has more than one course — each gets its own map, lap distance and lap versions."}),k.map(a=>e.jsxs("div",{className:"rounded-lg border border-border p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.id===s.id?e.jsxs("span",{className:"font-medium",children:[m(a)," ",e.jsx("span",{className:"text-muted-foreground text-sm",children:"(you're here)"})]}):e.jsx(B,{to:`/tracks/${a.id}`,className:"text-primary hover:underline font-medium",children:m(a)}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-muted-foreground text-sm",children:I(a.length_value,a.length_unit)}),(T||!!h&&a.created_by_user_id===h.id)&&e.jsx(i,{variant:"ghost",size:"sm","aria-label":`Edit ${m(a)}`,onClick:()=>w(a.id),children:e.jsx(U,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"mt-3 border-t border-border pt-3",children:e.jsx($e,{trackId:a.id,canEdit:T||!!h&&a.created_by_user_id===h.id,embedded:!0})})]},a.id))]})]}),e.jsxs(D,{children:[e.jsx(P,{children:e.jsxs($,{className:"text-lg flex items-center gap-2",children:[e.jsx(Ee,{className:"h-4 w-4"})," Races here"]})}),e.jsx(F,{children:N.length===0?e.jsx("p",{className:"text-muted-foreground",children:"No races have been attached to this track yet."}):e.jsx("ul",{className:"divide-y divide-border",children:N.map(a=>e.jsxs("li",{className:"py-2 flex justify-between gap-3",children:[e.jsx("span",{children:a.name}),e.jsx("span",{className:"text-muted-foreground text-sm",children:a.event_date})]},a.id))})})]})]}),e.jsxs(D,{className:"h-fit",children:[e.jsxs(P,{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Track details"}),e.jsx($,{className:"text-xl leading-tight",children:m(s)})]}),e.jsxs(F,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Te,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:I(s.length_value,s.length_unit)})]}),s.surface&&e.jsxs("div",{className:"capitalize",children:["Surface: ",s.surface]}),s.track_type&&e.jsxs("div",{children:["Type: ",ke(s.track_type)]}),(()=>{const a=n??s,o=a.address??s.address,O=a.address?a.postal_code:s.postal_code,j=a.website??s.website,q=a.phone??s.phone;return e.jsxs(e.Fragment,{children:[o&&e.jsxs("div",{className:"text-muted-foreground",children:[o,O?` ${O}`:""]}),j&&e.jsxs("a",{href:j,target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 text-primary underline",children:[e.jsx(Oe,{className:"h-4 w-4"})," Website"]}),q&&e.jsxs("a",{href:`tel:${q}`,className:"flex items-center gap-2 text-primary underline",children:[e.jsx(Ae,{className:"h-4 w-4"})," ",q]})]})})(),!s.length_value&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a track length and lap times at this track will start showing average speed."})]})]})]})}),e.jsx(G,{open:L,onOpenChange:b,track:s,onDeleted:()=>p(n?`/tracks/${n.id}`:"/tracks")}),n&&e.jsx(G,{open:_,onOpenChange:z,track:n}),g&&e.jsx(G,{open:!!g,onOpenChange:a=>!a&&w(null),track:l.find(a=>a.id===g)??null,editMode:"course",onDeleted:a=>{w(null),a.id===s.id&&p(n?`/tracks/${n.id}`:"/tracks")}}),e.jsx(G,{open:M,onOpenChange:C,seed:{parent_track_id:(n??s).id,city:(n??s).city,state:(n??s).state,address:(n??s).address,postal_code:(n??s).postal_code,latitude:(n??s).latitude,longitude:(n??s).longitude,track_type:(n??s).track_type,surface:(n??s).surface,website:(n??s).website,phone:(n??s).phone}})]}):e.jsx(J,{children:e.jsxs("div",{className:"container mx-auto px-4 py-24 text-center",children:[e.jsx("h1",{className:"font-display text-3xl mb-2",children:"Track not found"}),e.jsx(B,{to:"/tracks",className:"text-primary underline",children:"Back to all tracks"})]})})};export{ts 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.