PageSourceSearch

https://uniconnect-client.vercel.app/static/js/626.85f17c65.chunk.js

js uniconnect-client.vercel.app collected 2026-10-03 07:56:45 UTC 8,180 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[626],{2245:(e,s,t)=>{t.r(s),t.d(s,{default:()=>j});var a=t(5043),n=t(2409),l=t(3003),d=t(9958),r=t(1307),i=t(5089),o=t(7154),c=t(3216),u=t(1434),x=t(2127),m=t(9607),p=(t(8545),t(579));const v=i.eH,h=(0,d.Ay)(v,{transports:["websocket"]}),g=e=>{var s;let{data:t,index:n,setOpen:l,setCurrentChat:d,me:r,setUserData:u,userData:x,online:m,setActiveStatus:v}=e;const[h,g]=(0,a.useState)(0),[f,j]=(0,a.useState)([]),b=(0,c.Zp)();return(0,a.useEffect)((()=>{v(m);const e=t.members.find((e=>e!==r));(async()=>{try{const s=await o.A.get("".concat(i.E8,"/shop/get-shop-info/").concat(e));j(s.data.shop)}catch(s){console.log(s)}})()}),[r,t]),(0,p.jsxs)("div",{className:"w-full flex p-3 px-3 ".concat(h===n?"bg-[#00000010] rounded-md":"bg-transparent","  cursor-pointer"),onClick:e=>{return g(n)||(s=t._id,b("/inbox?".concat(s)),void l(!0))||d(t)||u(f)||v(m);var s},children:[(0,p.jsxs)("div",{className:"relative",children:[(0,p.jsx)("img",{src:"".concat(null===f||void 0===f?void 0:f.avatar),alt:"",className:"object-cover relative h-10 w-10 cursor-pointer overflow-hidden rounded-full border border-border-100 p-1"}),m?(0,p.jsx)("div",{className:"w-[10px] h-[10px] bg-green-400 rounded-full absolute top-[1px] right-[1px]"}):(0,p.jsx)("div",{className:"w-[10px] h-[10px] bg-[#c7b9b9] rounded-full absolute top-[1px] right-[1px]"})]}),(0,p.jsxs)("div",{className:"pl-3",children:[(0,p.jsx)("h1",{className:"text-[18px]",children:null===f||void 0===f?void 0:f.name}),(0,p.jsxs)("p",{className:"text-[14px] text-[#000]",children:[(null===t||void 0===t?void 0:t.lastMessageId)!==(null===x||void 0===x?void 0:x._id)?"You:":(null===x||void 0===x||null===(s=x.name)||void 0===s?void 0:s.split(" ")[0])+": "," ",null===t||void 0===t?void 0:t.lastMessage]})]})]})},f=e=>{let{setOpen:s,newMessage:t,setNewMessage:a,sendMessageHandler:n,messages:l,sellerId:d,userData:i,activeStatus:o,scrollRef:c,handleImageUpload:v}=e;return(0,p.jsxs)("div",{className:"w-full h-full  flex flex-col justify-between p-2 800px:p-5 rounded-lg",children:[(0,p.jsxs)("div",{className:"w-full flex p-3 items-center justify-between rounded-t-xl bg-slate-200",children:[(0,p.jsxs)("div",{className:"flex",children:[(0,p.jsx)("img",{src:"".concat(null===i||void 0===i?void 0:i.avatar),alt:"",className:"object-cover relative w-[35px] h-[35px] cursor-pointer overflow-hidden rounded-full border border-border-100 p-1"}),(0,p.jsxs)("div",{className:"pl-3 flex items-center justify-between",children:[(0,p.jsx)("h1",{className:"text-[16px] font-[500]",children:null===i||void 0===i?void 0:i.name}),(0,p.jsx)("h1",{children:o?"Active Now":""})]})]}),(0,p.jsx)(u.ifP,{size:20,className:"cursor-pointer",onClick:()=>s(!1)})]}),(0,p.jsx)("div",{className:"px-3 h-[75vh] bg-[#f3f3f3] p-8 overflow-y-scroll",children:l&&l.map(((e,s)=>(0,p.jsxs)("div",{className:"flex w-full my-2 ".concat(e.sender===d?"justify-end":"justify-start"),ref:c,children:[e.sender!==d&&(0,p.jsx)("img",{src:"".concat(null===i||void 0===i?void 0:i.avatar),className:"w-[30px] h-[30px] mr-3 object-cover relative cursor-pointer overflow-hidden rounded-full border border-border-100 p-1",alt:""}),e.images&&(0,p.jsx)("img",{src:"".concat(e.images),className:"w-[120px] h-[120px] 800px:w-[200px] 800px:h-[200px] object-cover rounded-lg ml-2 mb-2"}),""!==e.text&&(0,p.jsxs)("div",{children:[(0,p.jsx)("div",{className:"relative ml-3 text-sm py-2 px-4 shadow rounded-xl ".concat(e.sender===d?"bg-indigo-100":"bg-white"," text-gray-800 h-min"),children:(0,p.jsx)("p",{children:e.text})}),(0,p.jsx)("p",{className:"text-[12px] text-[#000000d3] pt-1",children:(0,r.GP)(e.createdAt)})]})]})))}),(0,p.jsxs)("form",{"aria-required":!0,className:"flex flex-row items-center h-16 rounded-b-xl bg-white w-full px-4",onSubmit:n,children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("input",{type:"file",name:"",id:"image",className:"hidden",onChange:v}),(0,p.jsx)("label",{htmlFor:"image",children:(0,p.jsx)(m.is9,{className:"flex items-center justify-center text-gray-400 hover:text-gray-600 cursor-pointer",size:20})})]}),(0,p.jsx)("div",{className:"flex-grow ml-4",children:(0,p.jsxs)("div",{className:"relative w-full",children:[(0,p.jsx)("input",{type:"text",required:!0,placeholder:"Enter your message...",value:t,onChange:e=>a(e.target.value),className:"flex w-full border rounded-xl focus:outline-none focus:border-indigo-300 pl-4 h-10"}),(0,p.jsx)("input",{type:"submit",value:"Send",className:"hidden",id:"send"})]})}),(0,p.jsx)("div",{className:"ml-4",children:(0,p.jsxs)("button",{class:"flex items-center justify-center bg-indigo-500 hover:bg-indigo-600 rounded-xl text-white px-4 py-1 flex-shrink-0",children:[(0,p.jsx)("span",{className:"hidden 800px:block",children:"Send"}),(0,p.jsx)("label",{htmlFor:"send",children:(0,p.jsx)(x.B07,{size:12,className:"cursor-pointer m-2 "})})]})})]})]})},j=()=>{const{user:e}=(0,l.d4)((e=>e.user)),[s,t]=(0,a.useState)([]),[d,r]=(0,a.useState)(null),[c,u]=(0,a.useState)(),[x,m]=(0,a.useState)([]),[v,j]=(0,a.useState)(""),[b,w]=(0,a.useState)(null),[N,y]=(0,a.useState)([]),[_,M]=(0,a.useState)(),[S,I]=(0,a.useState)(!1),[A,E]=(0,a.useState)(!1),C=(0,a.useRef)(null);(0,a.useEffect)((()=>{h.on("getMessage",(e=>{r({sender:e.senderId,text:e.text,createdAt:Date.now()})}))}),[]),(0,a.useEffect)((()=>{d&&(null===c||void 0===c?void 0:c.members.includes(d.sender))&&m((e=>[...e,d]))}),[d,c]),(0,a.useEffect)((()=>{(async()=>{try{const s=await o.A.get("".concat(i.E8,"/conversation/get-all-conversation-user/").concat(null===e||void 0===e?void 0:e._id),{withCredentials:!0});t(s.data.conversations)}catch(s){}})()}),[e,x]),(0,a.useEffect)((()=>
1{if(e){const s=null===e||void 0===e?void 0:e._id;h.emit("addUser",s),h.on("getUsers",(e=>{y(e)}))}}),[e]);const k=s=>{const t=s.members.find((s=>s!==(null===e||void 0===e?void 0:e._id))),a=N.find((e=>e.userId===t));return!!a};(0,a.useEffect)((()=>{(async()=>{try{const e=await o.A.get("".concat(i.E8,"/message/get-all-messages/").concat(null===c||void 0===c?void 0:c._id));m(e.data.messages)}catch(e){console.log(e)}})()}),[c]);const D=async()=>{h.emit("updateLastMessage",{lastMessage:v,lastMessageId:e._id}),await o.A.put("".concat(i.E8,"/conversation/update-last-message/").concat(c._id),{lastMessage:v,lastMessageId:e._id}).then((e=>{j("")})).catch((e=>{console.log(e)}))},U=async s=>{const t=new FormData;t.append("images",s),t.append("sender",e._id),t.append("text",v),t.append("conversationId",c._id);const a=c.members.find((s=>s!==e._id));h.emit("sendMessage",{senderId:e._id,receiverId:a,images:s});try{await o.A.post("".concat(i.E8,"/message/create-new-message"),t,{headers:{"Content-Type":"multipart/form-data"}}).then((e=>{M(),m([...x,e.data.message]),F()}))}catch(n){console.log(n)}},F=async()=>{await o.A.put("".concat(i.E8,"/conversation/update-last-message/").concat(c._id),{lastMessage:"Photo",lastMessageId:e._id})};return(0,a.useEffect)((()=>{var e;null===(e=C.current)||void 0===e||e.scrollIntoView({beahaviour:"smooth"})}),[x]),(0,p.jsxs)("div",{className:"w-full ",children:[!A&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.A,{}),(0,p.jsxs)("div",{className:"w-[auto] bg-white h-[auto] overflow-y-scroll rounded-lg p-2 m-2 mt-8 800px:p-5",children:[(0,p.jsx)("h1",{className:"text-center text-[25px] py-3 font-Poppins",children:"All Messages"}),s&&s.map(((s,t)=>(0,p.jsx)(g,{data:s,index:t,setOpen:E,setCurrentChat:u,me:null===e||void 0===e?void 0:e._id,setUserData:w,userData:b,online:k(s),setActiveStatus:I},t)))]})]}),A&&(0,p.jsx)(f,{setOpen:E,newMessage:v,setNewMessage:j,sendMessageHandler:async s=>{s.preventDefault();const t={sender:e._id,text:v,conversationId:c._id},a=c.members.find((s=>s!==(null===e||void 0===e?void 0:e._id)));h.emit("sendMessage",{senderId:null===e||void 0===e?void 0:e._id,receiverId:a,text:v});try{""!==v&&await o.A.post("".concat(i.E8,"/message/create-new-message"),t).then((e=>{m([...x,e.data.message]),D()})).catch((e=>{console.log(e)}))}catch(n){console.log(n)}},messages:x,sellerId:e._id,userData:b,activeStatus:S,scrollRef:C,handleImageUpload:async e=>{const s=e.target.files[0];M(s),U(s)}})]})}}}]);
2//# sourceMappingURL=626.85f17c65.chunk.js.map

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.