PageSourceSearch

https://sovross-gazeta.ru/assets/index-B1H0VNaF.js

js sovross-gazeta.ru collected 2026-10-09 00:52:07 UTC 4,781 bytes, 1 lines download raw bytes

1import{aS as m,r as c,o as M,j as e,d as T,i as j,ap as P,aq as H,ar as R,as as q,a9 as p,aa as g,am as w,aT as E,ac as v,ad as N,ae as D,af as y,ag as b,B as d,y as O,Y as B,a7 as A,t as I,ao as K}from"./main-BKfYQDmi.js";import{B as L}from"./breadcrumbs-ifSuKlm-.js";import{D as F,a as U,b as k,c as Q,d as V}from"./dashboard-BkMhrL6S.js";import{D as Y}from"./data-table-B0Y4fpbV.js";import{S as z}from"./search-C8UyAUqI.js";import"./useLocation-B-FxUGyg.js";import"./arrow-left-DTPq4bur.js";import"./table-BJFIcrNC.js";function re(){const{userId:s}=m.useParams(),{orpc:t}=m.useRouteContext(),[r,l]=c.useState(""),{comments:n}=m.useLoaderData(),{data:i,fetchNextPage:u,hasNextPage:h,isFetchingNextPage:x}=M({queryKey:["comments","byUser",s,r],queryFn:({pageParam:a=0})=>t.comments.getByUserId.call({id:s,limit:20,offset:a,search:r}),getNextPageParam:(a,o)=>{if(!(a.length<20))return o.length*20},initialData:{pages:[n],pageParams:[0]},initialPageParam:0}),f=c.useRef(null);c.useEffect(()=>{const a=f.current;if(!a)return;const o=()=>{a.scrollHeight-a.scrollTop<=a.clientHeight+50&&h&&!x&&u()};return a.addEventListener("scroll",o),()=>a.removeEventListener("scroll",o)},[h,x,u]);const S=(i==null?void 0:i.pages.flat())??[];return e.jsxs(F,{className:"flex flex-col gap-4",children:[e.jsxs(U,{className:"flex flex-col w-full gap-2",children:[e.jsx(L,{className:"!text-sm text-neutral-500 px-0"}),e.jsxs("div",{className:"flex flex-row w-full justify-between items-center",children:[e.jsx(k,{hideNavigation:!0,children:e.jsx(Q,{children:"Комментарии"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(z,{search:r,setSearch:l})})]})]}),e.jsxs(V,{ref:f,className:"overflow-auto relative",children:[e.jsx(Y,{columns:G,data:S}),x&&e.jsx("div",{className:"py-4 text-center text-neutral-500",children:e.jsx(T,{className:"bg-black"})})]})]})}const G=[{accessorKey:"news",header:()=>e.jsx("p",{className:"w-full text-left",children:"Статья"}),cell:({row:{original:s}})=>{var t;return e.jsx("div",{className:"w-full text-left",children:(t=s.news)==null?void 0:t.name})}},{accessorKey:"createdAt",header:()=>e.jsx("p",{className:"text-left",children:"Дата комментария"}),cell:({row:{original:s}})=>e.jsx("div",{className:"w-full text-left",children:j(new Date(s.createdAt),"dd.MM.yyyy, HH:mm")})},{id:"actions",cell:({row:{original:s}})=>e.jsx("div",{className:"flex items-center justify-end",children:e.jsxs(P,{children:[e.jsx(H,{children:e.jsx(R,{})}),e.jsxs(q,{children:[e.jsx(J,{comment:s}),e.jsx(C,{comment:s})]})]})})}];function J({comment:s}){var l;const[t,r]=c.useState(!1);return e.jsxs(p,{open:t,onOpenChange:r,children:[e.jsx(g,{asChild:!0,children:e.jsxs(w,{onSelect:n=>n.preventDefault(),children:[e.jsx(E,{className:"text-white"}),e.jsx("span",{children:"Комментарий"})]})}),e.jsxs(v,{className:"w-sm",children:[e.jsx(N,{children:e.jsx(D,{children:"Комментарий"})}),e.jsxs("div",{className:"px-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[e.jsx("div",{className:"relative rounded-full w-8 h-8 overflow-hidden",children:e.jsx("img",{src:((l=s.user)==null?void 0:l.image)??"",className:"w-full h-full object-cover",alt:s.user.name})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("p",{className:"text-sm font-normal",children:s.user.name}),e.jsx("p",{className:"text-muted text-xs font-normal",children:j(new Date(s.createdAt),"dd.MM.yyyy, HH:mm")})]})]}),e.jsx("p",{children:s.text})]}),e.jsxs(y,{className:"flex flex-row justify-end gap-4",children:[e.jsx(b,{children:e.jsx(d,{variant:"white",children:"Закрыть"})}),e.jsx(C,{comment:s,inDialog:!0})]})]})]})}function C({comment:s,inDialog:t}){const[r,l]=c.useState(!1),n=O(B.comments.delete.mutationOptions({onSuccess:()=>{l(!1),A.invalidateQueries({queryKey:["comments"]}),I.success("Комментарий удален")}}));return e.jsxs(p,{open:r,onOpenChange:l,children:[e.jsx(g,{asChild:!0,children:t?e.jsx(d,{variant:"destructive",children:"Удалить"}):e.jsxs(w,{variant:"destructive",onSelect:i=>i.preventDefault(),children:[e.jsx(K,{}),e.jsx("span",{children:"Удалить"})]})}),e.jsxs(v,{className:"w-sm",children:[e.jsx(N,{children:e.jsx(D,{children:"Удалить комментарий"})}),e.jsxs("p",{className:"px-4",children:["Вы действительно хотите удалить этот комментарий?",e.jsx("br",{})," Действие нельзя отменить."]}),e.jsxs(y,{className:"flex flex-row justify-end gap-4",children:[e.jsx(b,{children:e.jsx(d,{variant:"white",children:"Закрыть"})}),e.jsx(d,{variant:"destructive",onClick:()=>n.mutate({id:s.id}),children:"Удалить"})]})]})]})}export{re as component};

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.