1import{r as n,j as e,H as k,L as x}from"./react-vendor-d250d348.js";import{b as _,H as D,E as M,I as m,C as h,h as p,F as S,L as g}from"./index-721397ec.js";import{V as j}from"./VisibilityBadge-319a8f40.js";import{aJ as E,ay as T,$ as L}from"./lucide-1ed530d4.js";import{m as I}from"./framer-motion-589284f1.js";import"./sentry-5ddef7e0.js";import"./supabase-b5d9a3f8.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"72d1b8b3cf2f419b3766a3c986aa32488299d6dc"};var i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="b127391a-1236-4089-8699-9b63c64a0f13",t._sentryDebugIdIdentifier="sentry-dbid-b127391a-1236-4089-8699-9b63c64a0f13")}catch{}})();const u=20,V=()=>{const{user:t}=_(),[i,l]=n.useState([]),[b,f]=n.useState(!0),[d,o]=n.useState(!1),[y,N]=n.useState(1),[c,F]=n.useState(0);n.useEffect(()=>{if(!t)return;(async()=>{try{const{drives:r,total:a}=await g(t.id,{page:1,limit:u});l(r),F(a)}catch(r){console.error("Drives load error:",r)}finally{f(!1)}})()},[t]);const v=async()=>{o(!0);try{const s=y+1,{drives:r}=await g(t.id,{page:s,limit:u});l(a=>[...a,...r]),N(s)}catch(s){console.error("Load more error:",s)}finally{o(!1)}},w=i.length<c;return e.jsxs(e.Fragment,{children:[e.jsxs(k,{children:[e.jsx("title",{children:"My Drives | FastTrack"}),e.jsx("meta",{name:"description",content:"All your tracked drives on FastTrack."}),e.jsx("meta",{name:"robots",content:"noindex"})]}),e.jsx(D,{}),e.jsx("main",{className:"min-h-screen bg-[#0a0a0a] ft-pt-header-gap pb-16",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-8",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsx(x,{to:"/my/dashboard",className:"text-gray-400 hover:text-[#00FF7F] transition-colors",children:e.jsx(E,{size:20})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-white",children:"My Drives"}),e.jsxs("p",{className:"text-gray-500 text-sm",children:[c," drive",c!==1?"s":""]})]})]}),b?e.jsx("div",{className:"flex items-center justify-center py-32",children:e.jsx("div",{className:"w-8 h-8 border-2 border-[#00FF7F] border-t-transparent rounded-full animate-spin"})}):i.length===0?e.jsxs("div",{className:"text-center py-20",children:[e.jsx(T,{size:48,className:"text-gray-700 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No drives yet"}),e.jsx("p",{className:"text-gray-600 text-sm",children:"Start tracking drives in the FastTrack app!"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid grid-cols-[1.5fr,1fr,1fr,1fr,0.8fr] gap-2 px-4 py-3 text-xs text-gray-500 uppercase tracking-wider border-b border-[#2a2a2a] mb-1",children:[e.jsx("span",{children:"Vehicle"}),e.jsx("span",{className:"text-right",children:"Distance"}),e.jsx("span",{className:"text-right",children:"Top Speed"}),e.jsx("span",{className:"text-right",children:"Duration"}),e.jsx("span",{className:"text-right",children:"Date"})]}),e.jsx("div",{className:"space-y-1",children:i.map((s,r)=>{const a=s.start_time&&s.end_time?Math.round((s.end_time-s.start_time)/6e4):null;return e.jsx(x,{to:`/drives/${M(s)}`,children:e.jsxs(I.div,{initial:{opacity:0}
1,animate:{opacity:1},transition:{delay:Math.min(r*.02,.4)},className:"bg-[#1a1a1a] border border-[#2a2a2a] rounded-lg hover:border-[#00FF7F]/20 transition-colors",children:[e.jsxs("div",{className:"hidden sm:grid grid-cols-[1.5fr,1fr,1fr,1fr,0.8fr] gap-2 px-4 py-3.5 items-center",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-wrap",children:[e.jsx("p",{className:"text-white text-sm font-medium truncate",children:s.vehicle_name||"Unknown"}),e.jsx(j,{visibility:s.visibility})]}),e.jsx("p",{className:"text-right font-scoreboard tabular-nums tracking-wider text-sm",children:s.distance!=null?e.jsxs("span",{className:"text-blue-400",children:[m(s.distance)," mi"]}):e.jsx("span",{className:"text-gray-700",children:"--"})}),e.jsx("p",{className:"text-right font-scoreboard tabular-nums tracking-wider text-sm",children:s.max_speed?e.jsxs("span",{className:"text-[#00FF7F]",children:[h(s.max_speed)," mph"]}):e.jsx("span",{className:"text-gray-700",children:"--"})}),e.jsx("p",{className:"text-right font-scoreboard tabular-nums tracking-wider text-sm",children:a!=null?e.jsxs("span",{className:"text-gray-300",children:[a,"m"]}):e.jsx("span",{className:"text-gray-700",children:"--"})}),e.jsx("p",{className:"text-right text-gray-500 text-xs",children:p(s.created_at)})]}),e.jsxs("div",{className:"sm:hidden p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-wrap",children:[e.jsx("p",{className:"text-white text-sm font-medium truncate",children:s.vehicle_name||"Unknown"}),e.jsx(j,{visibility:s.visibility})]}),e.jsx("p",{className:"text-gray-500 text-xs flex-shrink-0",children:p(s.created_at)})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.distance!=null&&e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-xs",children:"Distance"}),e.jsxs("p",{className:"text-blue-400 font-scoreboard tabular-nums tracking-wider",children:[m(s.distance)," mi"]})]}),s.max_speed>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-xs",children:"Top Speed"}),e.jsx("p",{className:"text-[#00FF7F] font-scoreboard tabular-nums tracking-wider",children:h(s.max_speed)})]}),a!=null&&e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-xs",children:"Duration"}),e.jsxs("p",{className:"text-gray-300 font-scoreboard tabular-nums tracking-wider",children:[a,"m"]})]})]})]})]})},s.id)})}),w&&e.jsx("div",{className:"text-center mt-6",children:e.jsxs("button",{onClick:v,disabled:d,className:"inline-flex items-center gap-2 px-6 py-2.5 rounded-lg border border-[#00FF7F]/40 text-[#00FF7F] text-sm font-medium hover:bg-[#00FF7F]/10 transition-colors disabled:opacity-50",children:[d?e.jsx("div",{className:"w-4 h-4 border-2 border-[#00FF7F] border-t-transparent rounded-full animate-spin"}):e.jsx(L,{size:16}),"Load More"]})})]})]})}),e.jsx(S,{})]})};export{V 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.