PageSourceSearch

https://en.b2b.cafe/assets/index-BaA0nhjb.js

js b2b.cafe collected 2026-10-02 01:19:57 UTC 2,998 bytes, 1 lines download raw bytes

1import{r as n,u as s,aW as L,am as M}from"./vendor-DzWMmZj2.js";import{d as O,e as A}from"./vendor-tanstack-D-s8FawA.js";import{b as B,a5 as J,B as E}from"./index-DzzETE43.js";import{U as R}from"./UsersTable-DgliDC3r.js";import{u as T}from"./vendor-i18n-C7hD56hb.js";import"./UserCreatePage-BLqaimbw.js";import"./vendor-socket-CdJ84v18.js";import"./vendor-phone-CDRp5aFf.js";import"./useTable-DdSczyP4.js";import"./card-CFUfimd1.js";import"./useForm-C-xi49lB.js";import"./date-picker-C_qz5VcR.js";const{clientsList:U}=J(),u=100,h="users_filters",D=()=>{var t;try{return JSON.parse((t=localStorage.getItem(h))!=null?t:"{}")}catch(r){return{}}},G=t=>localStorage.setItem(h,JSON.stringify(t)),Q=()=>localStorage.removeItem(h),W=t=>Object.values(t).some(r=>r),X=(t,r)=>{const c={offset:(r-1)*u,length:u};return t.search&&(c.search=t.search),c};function Y(){var v,y;const{t}=T("users"),r=O(),c=A({strict:!1}),o=W(c)?c:D(),a=Number((v=o.page)!=null?v:"1")||1,i=JSON.stringify(o),[m,d]=n.useState((y=o.search)!=null?y:""),x=n.useRef(i);n.useEffect(()=>{var e;x.current!==i&&(x.current=i,d((e=o.search)!=null?e:""))},[i]);const[P,w]=n.useState([]),[l,C]=n.useState(0),{isPending:I,mutateAsync:k}=B({mutationKey:["users-list"],mutationFn:e=>U(e),successFn:e=>{var S,b,j,N;w((b=(S=e==null?void 0:e.result)==null?void 0:S.items)!=null?b:[]),C((N=(j=e==null?void 0:e.result)==null?void 0:j.count)!=null?N:0)}});n.useEffect(()=>{k(X(o,a))},[i]);const f=e=>{G(e),r({to:"/users",search:e,replace:!0})},K=()=>{const e={};m.trim()&&(e.search=m.trim()),f(e)},_=()=>{d(""),Q(),r({to:"/users",search:{},replace:!0})},g=e=>f({...o,page:e>1?String(e):void 0}),p=Math.max(1,Math.ceil(l/u)),z=Math.min((a-1)*u+1,l),F=Math.min(a*u,l);return s.jsxs("div",{className:"flex flex-col gap-4 px-6 py-5",children:[s.jsxs("div",{className:"relative flex items-center",children:[s.jsx(L,{className:"absolute left-4 size-4 text-muted-foreground pointer-events-none"}),s.jsx("input",{type:"text",value:m,onChange:e=>d(e.target.value),onKeyDown:e=>e.key==="Enter"&&K(),placeholder:t("users.filter.search_placeholder"),className:"w-full rounded-xl border border-border bg-white pl-10 pr-10 py-3 text-sm outline-none focus:border-primary transition-colors"}),m&&s.jsx("button",{onClick:_,className:"absolute right-4 text-muted-foreground hover:text-primary-black",children:s.jsx(M,{className:"size-4"})})]}),l>0&&s.jsxs("p",{className:"text-xs text-muted-foreground -mt-1",children:[t("users.count_many",{count:l})," • ",t("users.shown",{start:z,end:F})]}),s.jsx("div",{className:"bg-white rounded-xl overflow-hidden",children:s.jsx(R,{items:P,isLoading:I})}),p>1&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(E,{variant:"outline",size:"sm",disabled:a===1,onClick:()=>g(a-1),children:"←"}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[a," / ",p]}),s.jsx(E,{variant:"outline",size:"sm",disabled:a===p,onClick:()=>g(a+1),children:"→"})]})]})}const ce=Y;export{ce 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.