1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{16276:(e,s,t)=>{Promise.resolve().then(t.bind(t,50727))},50727:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>R});var a=t(95155),r=t(53904),l=t(88482),n=t(12115);function i(){let e=async()=>{let e=await fetch("/quotes.json"),s=await e.json();return s[Math.floor(Math.random()*s.length)]},[s,t]=(0,n.useState)(null);return(0,n.useEffect)(()=>{e().then(t)},[]),(0,a.jsx)(l.Zp,{className:"relative transition-transform duration-500 ease-in-out transform hover:scale-105",children:(0,a.jsxs)(l.Wu,{className:"p-6",children:[(0,a.jsxs)("blockquote",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-lg",children:s?s.quote:"Loading..."}),(0,a.jsx)("footer",{className:"text-sm text-gray-500",children:s?s.author:"Loading..."})]}),(0,a.jsx)("button",{className:"absolute bottom-4 right-4 p-1 hover:bg-gray-100 rounded-full",onClick:()=>{e().then(t)},children:(0,a.jsx)(r.A,{className:"w-4 h-4"})})]})})}var c=t(97168),o=t(69074),d=t(35695);function m(){let[e,s]=(0,n.useState)([]),[t,i]=(0,n.useState)(!0),[m,x]=(0,n.useState)(null);(0,d.useRouter)();let h=async()=>{i(!0);try{let e=await fetch("/api/calendars?refresh=true");if(!e.ok)throw Error("Failed to fetch events");let t=await e.json();console.log("Calendar Widget - Fetched calendars:",t);let a=new Date;a.setHours(0,0,0,0);let r=t.flatMap(e=>(e.events||[]).map(s=>({id:s.id,title:s.title,start:s.start,end:s.end,allDay:s.isAllDay,calendar:e.name,calendarColor:e.color}))).filter(e=>new Date(e.start)>=a).sort((e,s)=>new Date(e.start).getTime()-new Date(s.start).getTime()).slice(0,7);console.log("Calendar Widget - Processed events:",r),s(r),x(null)}catch(e){console.error("Error fetching events:",e),x("Failed to load events")}finally{i(!1)}};(0,n.useEffect)(()=>{h()},[]);let u=e=>{let s=new Date(e);return new Intl.DateTimeFormat("fr-FR",{day:"2-digit",month:"short"}).format(s)},f=e=>{let s=new Date(e);return new Intl.DateTimeFormat("fr-FR",{hour:"2-digit",minute:"2-digit"}).format(s)};return(0,a.jsxs)(l.Zp,{className:"transition-transform duration-500 ease-in-out transform hover:scale-105 bg-white/95 backdrop-blur-sm border-0 shadow-lg",children:[(0,a.jsxs)(l.aR,{className:"flex flex-row items-center justify-between pb-2 border-b border-gray-100",children:[(0,a.jsxs)(l.ZB,{className:"text-lg font-semibold text-gray-800 flex items-center gap-2",children:[(0,a.jsx)(o.A,{className:"h-5 w-5 text-gray-600"}),"Agenda"]}),(0,a.jsx)(c.$,{variant:"ghost",size:"icon",onClick:()=>h(),className:"h-7 w-7 p-0 hover:bg-gray-100/50 rounded-full",children:(0,a.jsx)(r.A,{className:"h-3.5 w-3.5 text-gray-600"})})]}),(0,a.jsx)(l.Wu,{className:"p-3",children:t?(0,a.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,a.jsx)("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-blue-500 border-t-transparent"})}):m?(0,a.jsx)("div",{className:"text-xs text-red-500 text-center py-3",children:m}):0===e.length?(0,a.jsx)("div",{className:"text-xs text-gray-500 text-center py-6",children:"No upcoming events"}):(0,a.jsx)("div",{className:"space-y-2 max-h-[400px] overflow-y-auto pr-1 scrollbar-thin scrollbar-thumb-gray-200 scrollbar-track-transparent",children:e.map(e=>(0,a.jsx)("div",{className:"p-2 rounded-lg bg-white shadow-sm hover:shadow-md transition-all duration-200 border border-gray-100",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("div",{className:"flex-shrink-0 w-14 h-14 rounded-lg flex flex-col items-center justify-center border",style:{backgroundColor:"".concat(e.calendarColor,"10"),borderColor:e.calendarColor},children:[(0,a.jsx)("span",{className:"text-[10px] font-medium",style:{color:e.calendarColor},children:u(e.start)}),(0,a.jsx)("span",{className:"text-[10px] font-bold mt-0.5",style:{color:e.calendarColor},children:f(e.start)})]}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-gray-800 line-clamp-2 flex-1",children:e.title}),!e.allDay&&(0,a.jsxs)("span",{className:"text-[10px] text-gray-500 whitespace-nowrap",children:[f(e.start)," - ",f(e.end)]})]}),(0,a.jsx)("div",{className:"flex items-center text-[10px] px-1.5 py-0.5 rounded-md",style:{backgroundColor:"".concat(e.calendarColor,"10"),color:e.calendarColor},children:(0,a.jsx)("span",{className:"truncate",children:e.calendar})})]})]})},e.id))})})]})}var x=t(93840),h=t(12108);function u(){let[e,s]=(0,n.useState)([]),[t,i]=(0,n.useState)(!0),[o,d]=(0,n.useState)(null),[m,u]=(0,n.useState)(!1),{status:f}=(0,h.useSession)(),p=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&u(!0),e||i(!0);try{let t=await fetch(e?"/api/news?refresh=true&limit=100":"/api/news?limit=100");if(!t.ok)throw Error("Failed to fetch news");let a=await t.json();console.log("News component received ".concat(a.length," articles")),s(a),d(null)}catch(e){d("Failed to fetch news"),console.error("Error fetching news:",e)}finally{i(!1),u(!1)}};return((0,n.useEffect)(()=>{"authenticated"===f&&p()},[f]),"loading"===f||t)?(0,a.jsxs)(l.Zp,{className:"transition-transform duration-500 ease-in-out transform hover:scale-105 bg-white/95 backdrop-blur-sm border-0 shadow-lg",children:[(0,a.jsx)(l.aR,{className:"flex flex-row items-center justify-between pb-2 border-b border-gray-100",children:(0,a.jsxs)(l.ZB,{className:"text-lg font-semibold text-gray-800 flex items-center gap-2",children:[(0,a.jsx)(x.A,{className:"h-5 w-5 text-gray-600"}),"Nouvelles"]})}),(0,a.jsx)(l.Wu,{className:"p-3",children:(0,a.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,a.jsx)(r.A,{className:"h-4 w-4 animate-spin text-gray-400"})})})]}):(0,a.jsxs)(l.Zp,{className:"transition-transform duration-500 ease-in-out transform hover:scale-105 bg-white/95 backdrop-blur-sm border-0 shadow-lg",children:[(0,a.jsxs)(l.aR,{className:"flex flex-row items-center justify-between pb-2 border-b border-gray-100",children:[(0,a.jsxs)(l.ZB,{className:"text-lg font-semibold text-gray-800 flex items-center gap-2",children:[(0,a.jsx)(x.A,{className:"h-5 w-5 text-gray-600"}),"Nouvelles",(0,a.jsxs)("span",{className:"text-sm font-normal ml-2 text-gray-500",children:["(",e.length,")"]})]}),(0,a.jsx)(c.$,{variant:"ghost",size:"icon",onClick:()=>p(!0),disabled:m,className:"h-7 w-7 p-0 hover:bg-gray-100/50 rounded-full",children:(0,a.jsx)(r.A,{className:"h-3.5 w-3.5 text-gray-600"})})]}),(0,a.jsx)(l.Wu,{className:"p-3",children:o?(0,a.jsx)("div",{className:"text-xs text-red-500 text-center py-3",children:o}):(0,a.jsx)("div",{className:"space-y-2 max-h-[400px] overflow-y-auto pr-1 scrollbar-thin scrollbar-thumb-gray-200 scrollbar-track-transparent",children:0===e.length?(0,a.jsx)("div",{className:"text-xs text-gray-500 text-center py-6",children:"No news available"}):e.map(e=>(0,a.jsx)("div",{className:"p-2 rounded-lg bg-white shadow-sm hover:shadow-md transition-all duration-200 border border-gray-100",onClick:()=>window.open(e.url,"_blank"),children:(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"flex items-center justify-between text-xs",children:(0,a.jsx)("span",{className:"text-gray-500",children:e.displayDate})}),(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-800 line-clamp-2",title:e.title,children:e.title}),(0,a.jsx)("p",{className:"text-xs text-gray-500 line-clamp-2",title:e.description||void 0,children:e.description})]})},e.id))})})]})}var f=t(66516),p=t(21380);function g(){let[e,s]=(0,n.useState)([]),[t,i]=(0,n.useState)(null),[o,d]=(0,n.useState)(!0),[m,x]=(0,n.useState)(!1),h=e=>{switch(e){case 1:return"New";case 2:return"Blocked";case 3:return"In Progress";case 4:return"Waiting for Approval";case 5:return"Done";default:return"Unknown"}},u=e=>e.dateToFinish&&"0000-00-00 00:00:00"!==e.dateToFinish?e.dateToFinish:null,g=async()=>{d(!0),i(null);try{let e=await fetch("/api/leantime/tasks?refresh=true");if(!e.ok)throw Error("Failed to fetch tasks");let t=await e.json();if(console.log("Raw API response:",t),!Array.isArray(t)){console.warn("No tasks found in response",t),s([]);return}let a=t.filter(e=>{let s=5!==e.status;return s?console.log("Keeping task ".concat(e.id,": status=").concat(e.status," (").concat(h(e.status),"), type=").concat(e.type||"main")):console.log("Filtering out Done task ".concat(e.id," (type: ").concat(e.type||"main",", status: ").concat(e.status,")")),s}).sort((e,s)=>{let t=u(e),a=u(s);if(t&&a){let e=new Date(t).getTime(),s=new Date(a).getTime();if(e!==s)return e-s}return t?-1:a?1:4===e.status&&4!==s.status?-1:+(4===s.status&&4!==e.status)});console.log("Sorted and filtered tasks:",a.map(e=>({id:e.id,date:e.dateToFinish,status:e.status,type:e.type||"main"}))),s(a.slice(0,7))}catch(e){console.error("Error fetching tasks:",e),i(e instanceof Error?e.message:"Failed to fetch tasks")}finally{d(!1)}};(0,n.useEffect)(()=>{g()},[]);let j=e=>{let{task:s}=e,t=s.dateToFinish;if(!t||"0000-00-00 00:00:00"===t)return(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)("span",{className:"text-[10px] text-gray-600 font-medium",children:"NO"}),(0,a.jsx)("span",{className:"text-sm text-gray-700 font-bold",children:"DATE"})]});try{let e=new Date(t);if(isNaN(e.getTime()))throw Error("Invalid date");let s=new Date;s.setHours(0,0,0,0);let r=e<s,l=e.toLocaleString("fr-FR",{month:"short"}).toUpperCase(),n=e.getDate(),i=e.getFullYear();return(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)("span",{className:"text-[10px] font-medium uppercase ".concat(r?"text-red-600":"text-blue-600"),children:l}),(0,a.jsx)("span",{className:"text-sm font-bold ".concat(r?"text-red-700":"text-blue-700"),children:n})]}),(0,a.jsx)("span",{className:"text-[8px] font-medium ".concat(r?"text-red-500":"text-blue-500"),children:i})]})}catch(e){return console.error("Error formatting date for task",s.id,e),(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)("span",{className:"text-[10px] text-gray-600 font-medium",children:"ERR"}),(0,a.jsx)("span",{className:"text-sm text-gray-700 font-bold",children:"DATE"})]})}};return(0,a.jsxs)(l.Zp,{className:"transition-transform duration-500 ease-in-out transform hover:scale-105 bg-white/95 backdrop-blur-sm border-0 shadow-lg",children:[(0,a.jsxs)(l.aR,{className:"flex flex-row items-center justify-between pb-2 border-b border-gray-100",children:[(0,a.jsxs)(l.ZB,{className:"text-lg font-semibold text-gray-800 flex items-center gap-2",children:[(0,a.jsx)(f.A,{className:"h-5 w-5 text-gray-600"}),"Devoirs"]}),(0,a.jsx)(c.$,{variant:"ghost",size:"icon",onClick:()=>g(),className:"h-7 w-7 p-0 hover:bg-gray-100/50 rounded-full",children:(0,a.jsx)(r.A,{className:"h-3.5 w-3.5 text-gray-600"})})]}),(0,a.jsx)(l.Wu,{className:"p-3",children:o?(0,a.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,a.jsx)("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-blue-500 border-t-transparent"})}):t?(0,a.jsx)("div",{className:"text-xs text-red-500 text-center py-3",children:t}):0===e.length?(0,a.jsx)("div",{className:"text-xs text-gray-500 text-center py-6",children:"No tasks with due dates found"}):(0,a.jsx)("div",{className:"space-y-2 max-h-[400px] overflow-y-auto pr-1 scrollbar-thin scrollbar-thumb-gray-200 scrollbar-track-transparent",children:e.map(e=>(0,a.jsx)("div",{className:"p-2 rounded-lg bg-white shadow-sm hover:shadow-md transition-all duration-200 border border-gray-100",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-blue-50 flex flex-col items-center justify-center border border-blue-100",children:(0,a.jsx)(j,{task:e})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 space-y-1",children:[(0,a.jsx)("a",{href:"https://agilite.slm-lab.net/tickets/showTicket/".concat(e.id),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 font-medium block text-sm line-clamp-2",children:e.headline}),(0,a.jsxs)("div",{className:"flex items-center text-gray-500 text-[10px] bg-gray-50 px-1.5 py-0.5 rounded-md",children:[(0,a.jsx)(p.A,{className:"h-2.5 w-2.5 mr-1 opacity-70"}),(0,a.jsx)("span",{className:"truncate",children:e.projectName})]})]})]})},e.id))})})]})}var j=t(28883),b=t(51154),N=t(97362),y=t(6874),v=t.n(y);function w(){let[e,s]=(0,n.useState)([]),[t,i]=(0,n.useState)(!1),[o,d]=(0,n.useState)(null),[m,x]=(0,n.useState)(null);(0,n.useEffect)(()=>{h()},[]);let h=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i(!0),d(null);try{let t=await fetch("/api/courrier?folder=INBOX&page=1&perPage=5"+(e?"&refresh=true":""));if(!t.ok)throw Error("Failed to fetch emails");let a=await t.json();if(a.error)d(a.error),s([]);else{let e=a.emails.map(e=>{var s,t;return{id:e.id,subject:e.subject,from:(null==(s=e.from[0])?void 0:s.address)||"",fromName:(null==(t=e.from[0])?void 0:t.name)||"",date:e.date,read:e.flags.seen,starred:e.flags.flagged,folder:e.folder}}).sort((e,s)=>new Date(s.date).getTime()-new Date(e.date).getTime()).slice(0,5);s(e),x("/courrier")}}catch(e){console.error("Error fetching emails:",e),d("Failed to load emails"),s([])}finally{i(!1)}},u=e=>{try{let s=new Date(e);return new Intl.DateTimeFormat("fr-FR",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(s)}catch(e){return""}};return(0,a.jsxs)(l.Zp,{className:"h-full",children:[(0,a.jsxs)(l.aR,{className:"flex flex-row items-center justify-between pb-2 border-b border-gray-100",children:[(0,a.jsxs)(l.ZB,{className:"text-lg font-semibold text-gray-800 flex items-center gap-2",children:[(0,a.jsx)(j.A,{className:"h-5 w-5 text-gray-600"}),"Courrier"]}),(0,a.jsx)(c.$,{variant:"ghost",size:"icon",onClick:()=>h(!0),disabled:t,children:t?(0,a.jsx)(b.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(r.A,{className:"h-4 w-4"})})]}),(0,a.jsx)(l.Wu,{className:"p-4",children:o?(0,a.jsx)("div",{className:"text-center py-4 text-gray-500",children:o}):t&&0===e.length?(0,a.jsxs)("div",{className:"text-center py-6 flex flex-col items-center",children:[(0,a.jsx)(b.A,{className:"h-6 w-6 animate-spin text-gray-400 mb-2"}),(0,a.jsx)("p",{className:"text-gray-500",children:"Chargement des emails..."})]}):0===e.length?(0,a.jsx)("div",{className:"text-center py-6",children:(0,a.jsx)("p",{className:"text-gray-500",children:"Aucun email non lu"})}):(0,a.jsxs)("div",{className:"space-y-3",children:[e.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-3 py-1 border-b border-gray-100 last:border-0",children:[(0,a.jsx)("div",{className:"pt-1",children:e.read?(0,a.jsx)(N.A,{className:"h-4 w-4 text-gray-400"}):(0,a.jsx)(j.A,{className:"h-4 w-4 text-blue-500"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("p",{className:"font-medium truncate",style:{maxWidth:"180px"},children:e.fromName||e.from.split("@")[0]}),(0,a.jsx)("p",{className:"text-xs text-gray-500",children:u(e.date)})]}),(0,a.jsx)("p",{className:"text-sm text-gray-700 truncate",children:e.subject})]})]},e.id)),m&&(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(v(),{href:m,className:"text-sm text-blue-600 hover:text-blue-800",children:"Voir tous les emails →"})})]})})]})}var k=t(81497),C=t(69663);function A(){let[e,s]=(0,n.useState)([]),[t,i]=(0,n.useState)(null),[o,m]=(0,n.useState)(!0),[x,u]=(0,n.useState)(!1),f=(0,d.useRouter)(),{data:p,status:g}=(0,h.useSession)(),j=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&u(!0);let t=await fetch("/api/rocket-chat/messages"+(e?"?refresh=true":""),{cache:"no-store",next:{revalidate:0}});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to fetch messages")}let a=await t.json();Array.isArray(a.messages)?s(a.messages):(console.warn("Unexpected data format:",a),s([])),i(null)}catch(e){console.error("Error fetching messages:",e),i(e instanceof Error?e.message:"Failed to fetch messages")}finally{m(!1),u(!1)}};return((0,n.useEffect)(()=>{if("authenticated"===g){j();let e=setInterval(()=>j(),3e4);return()=>clearInterval(e)}},[g]),"loading"===g)?(0,a.jsxs)(l.Zp,{className:"transition-transform duration-500 ease-in-out transform hover:scale-105 bg-white/95 backdrop-blur-sm border-0 shadow-lg h-full",children:[(0,a.jsx)(l.aR,{className:"flex flex-row items-center justify-between pb-2 border-b border-gray-100",children:(0,a.jsxs)(l.ZB,{className:"text-lg font-semibold text-gray-800 flex items-center gap-2",children:[(0,a.jsx)(k.A,{className:"h-5 w-5 text-gray-600"}),"Parole"]})}),(0,a.jsx)(l.Wu,{className:"p-6",children:(0,a.jsx)("p",{className:"text-center text-gray-500",children:"Loading..."})})]}):"unauthenticated"===g||t&&t.includes("Session expired")?(0,a.jsxs)(l.Zp,{className:"transition-transform duration-500 ease-in-out transform hover:scale-105 bg-white/95 backdrop-blur-sm border-0 shadow-lg h-full",children:[(0,a.jsx)(l.aR,{className:"flex flex-row items-center justify-between pb-2 border-b border-gray-100",children:(0,a.jsxs)(l.ZB,{className:"text-lg font-semibold text-gray-800 flex items-center gap-2",children:[(0,a.jsx)(k.A,{className:"h-5 w-5 text-gray-600"}),"Parole"]})}),(0,a.jsx)(l.Wu,{className:"p-6",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("p",{className:"text-gray-500 mb-4",children:"Please sign in to view messages"}),(0,a.jsx)(c.$,{onClick:e=>{e.stopPropagation(),(0,h.signIn)("keycloak")},variant:"default",className:"bg-blue-600 hover:bg-blue-700 text-white",children:"Sign In"})]})})]}):(0,a.jsxs)(l.Zp,{className:"transition-transform duration-500 ease-in-out transform hover:scale-105 bg-white/95 backdrop-blur-sm border-0 shadow-lg cursor-pointer w-full",onClick:()=>f.push("/parole"),children:[(0,a.jsxs)(l.aR,{className:"flex flex-row items-center justify-between pb-2 border-b border-gray-100",children:[(0,a.jsxs)(l.ZB,{className:"text-lg font-semibold text-gray-800 flex items-center gap-2",children:[(0,a.jsx)(k.A,{className:"h-5 w-5 text-gray-600"}),"Parole"]}),(0,a.jsx)(c.$,{variant:"ghost",size:"icon",onClick:e=>{e.stopPropagation(),j(!0)},disabled:x,className:"".concat(x?"animate-spin":""," text-gray-600 hover:text-gray-900"),children:(0,a.jsx)(r.A,{className:"h-4 w-4"})})]}),(0,a.jsxs)(l.Wu,{className:"p-4",children:[o&&(0,a.jsx)("p",{className:"text-center text-gray-500",children:"Loading messages..."}),t&&(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsxs)("p",{className:"text-red-500",children:["Error: ",t]}),(0,a.jsx)(c.$,{variant:"outline",onClick:e=>{e.stopPropagation(),j(!0)},className:"mt-2",children:"Try Again"})]}),!o&&!t&&(0,a.jsx)("div",{className:"space-y-4 max-h-[400px] overflow-y-auto pr-1 scrollbar-thin scrollbar-thumb-gray-200 scrollbar-track-transparent",children:0===e.length?(0,a.jsx)("p",{className:"text-center text-gray-500",children:"No messages found"}):e.map(e=>(0,a.jsxs)("div",{className:"flex items-start space-x-3 hover:bg-gray-50/50 p-3 rounded-lg transition-colors",children:[(0,a.jsxs)(C.eu,{className:"h-8 w-8",style:{backgroundColor:e.sender.color},children:[(0,a.jsx)(C.BK,{src:"https://ui-avatars.com/api/?name=".concat(encodeURIComponent(e.sender.name),"&background=random")}),(0,a.jsx)(C.q5,{children:e.sender.initials})]}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between space-x-2",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-800 truncate max-w-[70%]",children:e.sender.name}),(0,a.jsx)("span",{className:"text-xs font-medium text-gray-500 flex-shrink-0",children:e.timestamp})]}),(0,a.jsx)("p",{className:"text-sm text-gray-600 whitespace-pre-wrap line-clamp-2 mt-1",children:e.text}),e.roomName&&(0,a.jsx)("div",{className:"flex items-center mt-2",children:(0,a.jsxs)("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium ".concat(e.room.isChannel?"bg-blue-50 text-blue-700":e.room.isPrivateGroup?"bg-purple-50 text-purple-700":"bg-green-50 text-green-700"),children:[e.room.isChannel?"#":e.room.isPrivateGroup?"\uD83D\uDD12":"\uD83D\uDCAC"," ",e.roomName]})})]})]},e.id))})]})]})}function R(){let{data:e,status:s}=(0,h.useSession)(),[t,r]=(0,n.useState)(!0);return((0,n.useEffect)(()=>{"loading"!==s&&r(!1)},[s]),t)?(0,a.jsx)("main",{className:"h-screen flex items-center justify-center",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-32 w-32 border-t-2 border-b-2 border-gray-900"})}):(0,a.jsx)("main",{className:"h-screen overflow-auto",children:(0,a.jsxs)("div",{className:"container mx-auto p-4 mt-12",children:[(0,a.jsxs)("div",{className:"grid grid-cols-12 gap-4 mb-4",children:[(0,a.jsx)("div",{className:"col-span-3",children:(0,a.jsx)(i,{})}),(0,a.jsx)("div",{className:"col-span-3",children:(0,a.jsx)(m,{})}),(0,a.jsx)("div",{className:"col-span-3",children:(0,a.jsx)(u,{})}),(0,a.jsx)("div",{className:"col-span-3",children:(0,a.jsx)(g,{})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-12 gap-4",children:[(0,a.jsx)("div",{className:"col-span-6",children:(0,a.jsx)(w,{})}),(0,a.jsx)("div",{className:"col-span-6",children:(0,a.jsx)(A,{})})]})]})})}},53999:(e,s,t)=>{"use strict";t.d(s,{cn:()=>l});var a=t(52596),r=t(39688);function l(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return(0,r.QP)((0,a.$)(s))}},69663:(e,s,t)=>{"use strict";t.d(s,{BK:()=>c,eu:()=>i,q5:()=>o});var a=t(95155),r=t(12115),l=t(44362),n=t(53999);let i=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.bL,{ref:s,className:(0,n.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r})});i.displayName=l.bL.displayName;let c=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l._V,{ref:s,className:(0,n.cn)("aspect-square h-full w-full",t),...r})});c.displayName=l._V.displayName;let o=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.H4,{ref:s,className:(0,n.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r})});o.displayName=l.H4.displayName},88482:(e,s,t)=>{"use strict";t.d(s,{BT:()=>o,Wu:()=>d,ZB:()=>c,Zp:()=>n,aR:()=>i});var a=t(95155),r=t(12115),l=t(53999);let n=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...r})});n.displayName="Card";let i=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",t),...r})});i.displayName="CardHeader";let c=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",t),...r})});c.displayName="CardTitle";let o=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("text-sm text-muted-foreground",t),...r})});o.displayName="CardDescription";let d=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("p-6 pt-0",t),...r})});d.displayName="CardContent",r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("flex items-center p-6 pt-0",t),...r})}).displayName="CardFooter"},97168:(e,s,t)=>{"use strict";t.d(s,{$:()=>o,r:()=>c});var a=t(95155),r=t(12115),l=t(99708),n=t(74466),i=t(53999);let c=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),o=r.forwardRef((e,s)=>{let{className:t,variant:r,size:n,asChild:o=!1,...d}=e,m=o?l.DX:"button";return(0,a.jsx)(m,{className:(0,i.cn)(c({variant:r,size:n,className:t})),ref:s,...d})});o.displayName="Button"}},e=>{var s=s=>e(e.s=s);e.O(0,[4277,2108,6874,6794,8441,1684,7358],()=>s(16276)),_N_E=e.O()}]); |