import{a as e,n as t,r as n}from"./createLucideIcon-x_DqbPgA.js";import{t as r}from"./BookmarkCard-3EgrSMYF.js";import{t as i}from"./book-marked-CqHvIJYo.js";import{t as a}from"./book-open-sKRokCqo.js";import{t as o}from"./circle-check-big-BGRXsaKU.js";import{n as s,r as c,t as l}from"./use-reading-list-DmuBfF8W.js";import{o as u}from"./use-notes-BA4IjZRc.js";import{t as d}from"./NoteCard-DvRFuS8W.js";var f=e(n(),1),p=t();function m(){let[e,t]=(0,f.useState)(`reading`),{data:n,isLoading:m}=c(),{data:h,isLoading:g}=s(),{data:_}=u(),v=l(),y=_?.filter(e=>e.reading_status===`reading_list`)||[],b=_?.filter(e=>e.reading_status===`read`)||[],x=e===`reading`?m:g,S=e===`reading`?n:h,C=e===`reading`?y:b;return(0,p.jsxs)(`div`,{className:`max-w-6xl mx-auto px-4 py-6`,children:[(0,p.jsx)(`div`,{className:`flex items-center justify-between mb-6`,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(i,{className:`w-6 h-6 text-sky-600`}),(0,p.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900 dark:text-gray-100`,children:`Reading List`})]})}),(0,p.jsxs)(`div`,{className:`flex gap-1 mb-6 bg-gray-100 dark:bg-gray-800 rounded-lg p-1 w-fit`,children:[(0,p.jsxs)(`button`,{onClick:()=>t(`reading`),className:`inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${e===`reading`?`bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm`:`text-gray-500 dark:text-gray-400 hover:text-gray-700`}`,children:[(0,p.jsx)(a,{className:`w-4 h-4`}),`To Read`,n&&(0,p.jsx)(`span`,{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full bg-sky-100 dark:bg-sky-900/30 text-sky-600 dark:text-sky-400`,children:(n?.length||0)+y.length})]}),(0,p.jsxs)(`button`,{onClick:()=>t(`read`),className:`inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${e===`read`?`bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm`:`text-gray-500 dark:text-gray-400 hover:text-gray-700`}`,children:[(0,p.jsx)(o,{className:`w-4 h-4`}),`Read`,h&&(0,p.jsx)(`span`,{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400`,children:(h?.length||0)+b.length})]})]}),x?(0,p.jsx)(`div`,{className:`flex items-center justify-center h-32`,children:(0,p.jsx)(`div`,{className:`animate-pulse text-sky-600`,children:`Loading...`})}):!S?.length&&!C?.length?(0,p.jsxs)(`div`,{className:`text-center py-16`,children:[(0,p.jsx)(a,{className:`w-12 h-12 mx-auto text-gray-300 dark:text-gray-600 mb-4`}),(0,p.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400 text-lg`,children:e===`reading`?`Your reading list is empty`:`No read items`}),(0,p.jsx)(`p`,{className:`text-gray-400 dark:text-gray-500 text-sm mt-1`,children:e===`reading`?`Add items or notes to your reading list from their detail pages`:`Items you mark as read will appear here`})]}):(0,p.jsxs)(`div`,{className:`space-y-6`,children:[S&&S.length>0&&(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`h2`,{className:`text-sm font-medium text-gray-500 dark:text-gray-400 mb-3`,children:[`Items (`,S.length,`)`]}),(0,p.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:S.map(t=>(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(r,{item:t}),e===`reading`&&(0,p.jsxs)(`button`,{onClick:()=>v.mutate({id:t.id,type:`item`}),className:`absolute top-2 right-2 inline-flex items-center gap-1 px-2 py-1 text-xs rounded-full bg-green-600 text-white hover:bg-green-700 shadow transition-colors z-10`,children:[(0,p.jsx)(o,{className:`w-3 h-3`}),`Done`]})]},t.id))})]}),C&&C.length>0&&(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`h2`,{className:`text-sm font-medium text-gray-500 dark:text-gray-400 mb-3`,children:[`Notes (`,C.length,`)`]}),(0,p.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:C.map(t=>(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(d,{note:t}),e===`reading`&&(0,p.jsxs)(`button`,{onClick:()=>v.mutate({id:t.id,type:`note`}),className:`absolute top-2 right-2 inline-flex items-center gap-1 px-2 py-1 text-xs rounded-full bg-green-600 text-white hover:bg-green-700 shadow transition-colors z-10`,children:[(0,p.jsx)(o,{className:`w-3 h-3`}),`Done`]})]},t.id))})]})]})]})}export{m as default};