1import{r as n,j as e,L as x}from"./react-Cp7UwHTF.js";import{u as w}from"./query-BLxOLfP6.js";import{a9 as v,v as N,B as p,ab as C,I as S,ac as k,X as P,w as o,E as c,a as g,A as E}from"./index-TAULGflN.js";import{c as L}from"./schema-4XJ1R_aB.js";import{C as f}from"./circle-play-RmvHs2Gn.js";import"./radix-BhgcTijy.js";import"./motion-CUgva-M6.js";import"./types-DXJQHAug.js";function V(i){if(!i)return"";const l=Math.floor(i/60),d=i%60;return`${l}:${String(d).padStart(2,"0")}`}function R(){const{user:i}=v(),[l,d]=n.useState(""),[a,m]=n.useState(null),{data:r,isLoading:j}=w({queryKey:["/api/videos"]});n.useEffect(()=>{if(N({title:"WeighPay Demo & Training Videos â Chaptered Transcripts | WeighPay",description:"Watch WeighPay product demos and training walkthroughs with full chaptered transcripts. Scale tickets, CRV, LPR, dispatch, compliance, and more.",canonical:"https://weighpay.com/videos"}),!document.querySelector('link[rel="alternate"][data-videos-rss="1"]')){const s=document.createElement("link");s.rel="alternate",s.type="application/rss+xml",s.title="WeighPay Demo & Training Videos",s.href="https://weighpay.com/rss-videos.xml",s.setAttribute("data-videos-rss","1"),document.head.appendChild(s)}return()=>{var s;(s=document.querySelector('link[rel="alternate"][data-videos-rss="1"]'))==null||s.remove()}},[]);const h=n.useMemo(()=>{const t=new Set;return r==null||r.forEach(s=>s.category&&t.add(s.category)),Array.from(t).sort()},[r]),u=n.useMemo(()=>{if(!r)return[];const t=l.trim().toLowerCase();return r.filter(s=>{const y=!t||s.title.toLowerCase().includes(t)||s.description.toLowerCase().includes(t),b=!a||s.category===a;return y&&b})},[r,l,a]);return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background to-muted/20",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-12",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap mb-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm mb-2",children:[e.jsx(f,{className:"w-4 h-4"}),"WeighPay Videos"]}),e.jsx("h1",{className:"text-4xl font-bold mb-2","data-testid":"text-videos-title",children:"Demo & Training Videos"}),e.jsx("p",{className:"text-lg text-muted-foreground max-w-3xl",children:"Product demos and training walkthroughs with chaptered transcripts. Jump to the section you need or read the full transcript."})]}),i&&L(i)&&e.jsx(x,{href:"/admin/seo/videos",children:e.jsx(p,{variant:"outline","data-testid":"link-admin-videos",children:"Manage Videos"})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-6",children:[e.jsxs("div",{className:"relative flex-1 min-w-[220px] max-w-md",children:[e.jsx(C,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(S,{value:l,onChange:t=>d(t.target.value),placeholder:"Search videosâ¦","aria-label":"Search videos",className:"pl-9","data-testid":"input-search-videos"})]}),h.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.map(t=>e.jsx(k,{variant:a===t?"default":"outline","aria-pressed":a===t,onClick:()=>m(a===t?null:t),"data-testid":`badge-category-${t}`,children:t},t)),a&&e.jsxs(p,{variant:"ghost",size:"sm",onClick:()=>m(null),"data-testid":"button-clear-category",children:[e.jsx(P,{className:"w-3 h-3 mr-1"})," Clear"]})]})]}),j?e.jsx(o,{children:e.jsx(c,{className:"py-12 flex justify-center",children:e.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})})}):u.length===0?e.jsx(o,{children:e.jsx(c,{className:"py-12 text-center text-muted-foreground","data-testid":"text-empty-videos",children:"No videos published yet."})}):e.jsx("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:u.map(t=>{const s=t.thumbnailUrl||`https://i.ytimg.com/vi/${t.youtubeId}/hqdefault.jpg`;return e.jsx(x,{href:`/videos/${t.slug}`,children:e.jsxs(o,{className:"overflow-hidden hover-elevate h-full","data-testid":`card-video-${t.slug}`,children:[e.jsxs("div",{className:"relative aspect-video bg-muted",children:[e.jsx("img",{src:s,alt:t.title,className:"w-full h-full object-cover",loading:"lazy"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30",children:e.jsx(f,{className:"w-14 h-14 text-white drop-shadow-lg"})}),t.durationSeconds>0&&e.jsx("span",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:V(t.durationSeconds)})]}),e.jsxs(c,{className:"py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[t.category&&e.jsx(g,{variant:"secondary",children:t.category}),!t.published&&e.jsx(g,{variant:"destructive",children:"draft"})]}),e.jsx("h2",{className:"font-semibold mb-1 line-clamp-2","data-testid":`text-title-${t.slug}`,children:t.title}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:t.description}),e.jsxs("div",{className:"mt-3 text-sm text-primary inline-flex items-center gap-1",children:["Watch & read transcript ",e.jsx(E,{className:"w-3 h-3"})]})]})]})},t.id)})})]})})}export{R 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.