import{n as e}from"./createLucideIcon-x_DqbPgA.js";import{t}from"./useQuery-qKYvnzn0.js";import{n}from"./chunk-UVKPFVEO-CKgCEGmW.js";import{t as r}from"./clock-DIkpCm8X.js";import{t as i}from"./external-link-CO5xDXge.js";import{t as a}from"./client-BAPwymp0.js";var o=e();function s(){let{data:e,isLoading:s}=t({queryKey:[`timeline`],queryFn:()=>a.get(`/api/v1/items/timeline?days=30`)}),c=e=>{let t=new Date(e),n=new Date,r=new Date(n);return r.setDate(r.getDate()-1),t.toDateString()===n.toDateString()?`Today`:t.toDateString()===r.toDateString()?`Yesterday`:t.toLocaleDateString(`en-US`,{weekday:`long`,month:`short`,day:`numeric`})};return(0,o.jsxs)(`div`,{className:`animate-fade-in max-w-5xl mx-auto px-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-3 mb-6`,children:[(0,o.jsx)(r,{className:`w-6 h-6 text-sky-600`}),(0,o.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900 dark:text-gray-100`,children:`Timeline`})]}),s?(0,o.jsx)(`div`,{className:`space-y-6`,children:Array.from({length:3}).map((e,t)=>(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,o.jsx)(`div`,{className:`w-3 h-3 rounded-full animate-pulse bg-gray-200 dark:bg-gray-700`}),(0,o.jsx)(`div`,{className:`h-4 w-24 animate-pulse bg-gray-200 dark:bg-gray-700 rounded`})]}),(0,o.jsxs)(`div`,{className:`ml-6 space-y-2`,children:[(0,o.jsx)(`div`,{className:`h-16 animate-pulse bg-gray-100 dark:bg-gray-800 rounded-xl`}),(0,o.jsx)(`div`,{className:`h-16 animate-pulse bg-gray-100 dark:bg-gray-800 rounded-xl`})]})]},t))}):e?.length?(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(`div`,{className:`absolute left-[5px] top-4 bottom-4 w-px bg-gray-200 dark:bg-gray-800`}),(0,o.jsx)(`div`,{className:`space-y-8`,children:e.map(e=>(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,o.jsx)(`div`,{className:`w-3 h-3 rounded-full bg-[#0096C7] flex-shrink-0 relative z-10 ring-2 ring-white dark:ring-[#0C1222]`}),(0,o.jsx)(`h2`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:c(e.date)}),(0,o.jsxs)(`span`,{className:`text-xs text-gray-400 bg-gray-100 dark:bg-gray-800 px-2 py-0.5 rounded-full`,children:[e.items.length,` items`]}),(0,o.jsx)(`div`,{className:`flex-1 border-t border-gray-200 dark:border-gray-800`})]}),(0,o.jsx)(`div`,{className:`ml-6 space-y-2`,children:e.items.map(e=>(0,o.jsxs)(n,{to:`/item/${e.id}`,className:`flex items-start gap-3 p-3 rounded-xl border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 hover:shadow-md hover:border-sky-200 dark:hover:border-sky-800 transition-all duration-200 cursor-pointer`,children:[(0,o.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,o.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:e.title}),e.summary&&(0,o.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1 line-clamp-1`,children:e.summary}),(0,o.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5 text-[10px] text-gray-400`,children:[(0,o.jsx)(`span`,{className:`bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded`,children:e.source_platform}),(0,o.jsx)(`span`,{children:new Date(e.created_at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]})]}),e.url&&(0,o.jsx)(i,{className:`w-3.5 h-3.5 text-gray-400 flex-shrink-0 mt-1`})]},e.id))})]},e.date))})]}):(0,o.jsxs)(`div`,{className:`text-center py-16 rounded-2xl border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900`,children:[(0,o.jsx)(r,{className:`w-12 h-12 text-gray-300 dark:text-gray-600 mx-auto mb-4`}),(0,o.jsx)(`p`,{className:`text-gray-700 dark:text-gray-300 text-lg font-medium mb-1`,children:`No items in the last 30 days`}),(0,o.jsx)(`p`,{className:`text-sm text-gray-400 dark:text-gray-500`,children:`Saved items will appear on your timeline.`})]})]})}export{s as default};