PageSourceSearch

https://ratner-tv.lovable.app/assets/Favorites-C1OsfNWv.js

js ratner-tv.lovable.app collected 2026-10-03 03:42:00 UTC 4,172 bytes, 1 lines download raw bytes

1import{j as s}from"./markdown-CAb8WmfO.js";import{r as t}from"./charts-Cpw4WycC.js";import{u as N,L as a}from"./router-CKbXuuze.js";import{L as _}from"./LibraryLayout-JH-XLxvg.js";import{u as w,s as c,S as y,l as d}from"./index-DX4lcBd_.js";import{L,$ as n,bU as k}from"./icons-D71SFH7y.js";import"./radix-mkhwvnnH.js";import"./supabase-Dizu_ZNU.js";import"./date-DTmnPEgw.js";const C=()=>{const{user:r,loading:o}=w(),u=N(),[m,x]=t.useState([]),[h,g]=t.useState([]),[f,p]=t.useState(!0);t.useEffect(()=>{if(!o){if(!r){u("/auth");return}v()}},[r,o]);const v=async()=>{if(!r)return;const[{data:e},{data:b}]=await Promise.all([c.from("favorites").select("id, course_id, course:courses(id, title, thumbnail_url, short_description, slug)").eq("user_id",r.id),c.from("album_favorites").select("id, album:audio_albums(id, title, slug, cover_url, description)").eq("user_id",r.id)]);x(e||[]),g(b||[]),p(!1)};if(!r)return null;const i=m.filter(e=>e.course).map(e=>({id:e.id,slug:e.course.slug,title:e.course.title,thumbnail_url:e.course.thumbnail_url,description:e.course.short_description})),l=h.filter(e=>e.album).map(e=>e.album),j=i.length===0&&l.length===0;return s.jsxs(_,{children:[s.jsx(y,{title:"Избранное",description:"Ваши сохранённые материалы: курсы, медитации, видео и подкасты на платформе Секреты Силы."}),f?s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(L,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):j?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-3",children:[s.jsx(n,{className:"w-10 h-10 text-muted-foreground/40"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Добавляйте материалы в избранное"}),s.jsx(a,{to:"/courses",className:"text-sm text-interactive hover:underline",children:"Перейти в медиатеку"})]}):s.jsxs("div",{className:"space-y-10",children:[i.length>0&&s.jsxs("section",{children:[s.jsx("h2",{className:"text-sm uppercase tracking-wider text-muted-foreground mb-4",children:"Курсы и материалы"}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:i.map(e=>s.jsxs(a,{to:`/courses/${e.slug}`,className:"group bg-card rounded-lg overflow-hidden border border-border hover:border-interactive/40 transition-all block",children:[s.jsx("div",{className:"aspect-video bg-muted relative overflow-hidden",children:e.thumbnail_url?s.jsx("img",{src:d(e.thumbnail_url,{width:480})||e.thumbnail_url,alt:e.title,loading:"lazy",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center",children:s.jsx(n,{className:"w-8 h-8 text-muted-foreground/30"})})}),s.jsxs("div",{className:"p-3.5",children:[s.jsx("h3",{className:"font-semibold text-foreground text-sm line-clamp-1",children:e.title}),e.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:e.description})]})]},e.id))})]}),l.length>0&&s.jsxs("section",{children:[s.jsx("h2",{className:"text-sm uppercase tracking-wider text-muted-foreground mb-4",children:"Музыкальные альбомы"}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4",children:l.map(e=>s.jsxs(a,{to:`/music/${e.slug}`,className:"group block",children:[s.jsx("div",{className:"aspect-square rounded-lg bg-card border border-border overflow-hidden",children:e.cover_url?s.jsx("img",{src:d(e.cover_url,{width:360})||e.cover_url,alt:e.title,loading:"lazy",className:"w-full h-full object-cover group-hover:scale-105 transition-transform"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:s.jsx(k,{className:"w-10 h-10",strokeWidth:1.2})})}),s.jsx("div",{className:"mt-2 text-sm font-medium text-foreground truncate",children:e.title}),e.description&&s.jsx("div",{className:"text-xs text-muted-foreground line-clamp-2",children:e.description})]},e.id))})]})]})]})};export{C 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.