PageSourceSearch

https://xterns.ai/assets/TechLeadCalendar-CpMjfAtX.js

js xterns.ai collected 2026-10-05 13:24:48 UTC 9,549 bytes, 1 lines download raw bytes

1import{w as a,s as x,g as m,j as t,aK as Z,bK as J,bu as Q,h as X,i as ee,H as te,k as se,l as ae,m as ne,B as l,x as re}from"./index-DLd_kDlx.js";import{T as oe}from"./TechLeadHeader-eLOg3V3h.js";import{T as ie,a as le,b as w}from"./tabs-DKw2ItQa.js";import{b as de,e as ce,S as E,M as me,B as he,g as ge,D as xe,c as ue,d as pe}from"./useGooglePostAuthResume-D2LXR_8h.js";import{S as fe}from"./Seo-Diny__Ix.js";import{M as we,a as je}from"./MeetingDetailsDialog-BvSFQFXX.js";import{C as be}from"./chevron-left-Wewsh5d7.js";import{C as Se}from"./chevron-right-CD1gvy-q.js";import{P as Ce}from"./plus-0WhrdjYO.js";import{F as De}from"./filter-BMeMiGQo.js";import{e as Ne}from"./endOfMonth-CYn6pTOm.js";import{s as ye,e as ve}from"./endOfWeek-6cC00CtY.js";import{s as Me,a as ke,f as j}from"./format-BTXglRCX.js";import{e as Ee}from"./endOfDay-DkR3ZXc8.js";import"./dropdown-menu-DSd1c3Vk.js";import"./index-Deh-4PO1.js";import"./index-lTaZyIGy.js";import"./NotificationIcon-C1wwYnH5.js";import"./popover-BMD5FOmU.js";import"./scroll-area-BXTuUF24.js";import"./index-BdQq_4o_.js";import"./NotificationItem-Dc2WXW-y.js";import"./formatDistanceToNow-57P64IbE.js";import"./en-US-9SRVm7yB.js";import"./differenceInCalendarMonths-BA0TPVs2.js";import"./message-square-CtxeCfRz.js";import"./trophy-DBX-jNOC.js";import"./triangle-alert-Chqk_WK7.js";import"./rotate-ccw-Bx1C64Ur.js";import"./findIndex-Cos7Fxsp.js";import"./warning-vNLIDCnk.js";import"./getDay-qh2J2e9D.js";import"./textarea-C6X-I43k.js";import"./label-D4-ENrYn.js";import"./useMutation-CotV56Sa.js";import"./chevron-down-DpJJsCer.js";import"./loader-circle-D2miE2xB.js";import"./link-_ZZxygmy.js";import"./external-link-D0CFvOTk.js";import"./square-pen-Ce4P3TUP.js";function pt(){de();const[r,b]=a.useState("month"),[n,h]=a.useState(new Date),[S,O]=a.useState([]),[T,C]=a.useState(!1),[d,u]=a.useState(null),[L,D]=a.useState(!1),[o,N]=a.useState(null),[F,p]=a.useState(!1),[I,y]=a.useState(null),[z,v]=a.useState(!1),[R,P]=a.useState(null),[c]=a.useState(Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"),[G,M]=a.useState(!1);a.useEffect(()=>{(async()=>{try{const{data:s}=await x.from("google_credentials").select("id").maybeSingle();M(!!s)}catch{}const e=new URLSearchParams(window.location.search);if(e.get("google")==="connected"){m.success("Google account connected"),e.delete("google");const s=new URL(window.location.href);s.search=e.toString(),window.history.replaceState({},"",s.toString())}})()},[]);const _=async()=>{try{const e=`${window.location.origin}/tech-lead/calendar?google=connected`,{data:s,error:i}=await x.functions.invoke("google-oauth-start",{body:{postAuthRedirect:e}});if(i)throw i;if(s!=null&&s.url)window.location.href=s.url;else throw new Error("Missing Google auth URL")}catch(e){console.error(e),m.error("Failed to start Google OAuth")}},U=async()=>{try{const{data:{user:e}}=await x.auth.getUser();if(!e){m.error("You need to be logged in");return}const{error:s}=await x.from("google_credentials").delete().eq("user_id",e.id);if(s)throw s;M(!1),m.success("Disconnected Google account")}catch(e){console.error(e),m.error("Failed to disconnect")}},{rangeStart:V,rangeEnd:A}=a.useMemo(()=>r==="month"?{rangeStart:ye(n),rangeEnd:Ne(n)}:r==="week"?{rangeStart:Me(n),rangeEnd:ve(n)}:{rangeStart:ke(n),rangeEnd:Ee(n)},[n,r]),{events:g}=ce(V,A,S),k=a.useMemo(()=>(g||[]).map(e=>({id:e.id,seriesId:e.seriesId,title:e.title,type:e.type,timezone:e.timezone||c,start:new Date(e.start).toISOString(),end:new Date(e.end).toISOString(),meetingLink:e.meetingLink||void 0,agenda:e.agenda||void 0,isRecurring:e.isRecurring||!1,rrule:e.rrule||null})),[g,c]),B=a.useMemo(()=>(g||[]).map(e=>({id:e.id,seriesId:e.seriesId,title:e.title,type:e.type,timezone:e.timezone||c,start:new Date(e.start),end:new Date(e.end),meetingLink:e.meetingLink||void 0,agenda:e.agenda||void 0})),[g,c]),W=()=>{const e=new Date(n);r==="month"?e.setMonth(e.getMonth()-1):r==="week"?e.setDate(e.getDate()-7):e.setDate(e.getDate()-1),h(e)},H=()=>{const e=new Date(n);r==="month"?e.setMonth(e.getMonth()+1):r==="week"?e.setDate(e.getDate()+7):e.setDate(e.getDate()+1),h(e)},K=e=>{O(s=>s.includes(e)?s.filter(i=>i!==e):[...s,e])},f=e=>{y(e),p(!0)},Y=e=>{p(!1),y(null),u(e)},$=e=>{P(e),v(!0)};return t.jsxs(Z,{children:[t.jsx(fe,{title:"Calendar & Meetings — Tech Lead",description:"Plan and manage team sessions with month, week, and day views. Tech Lead calendar and meetings.",canonical:"/tech-lead/calendar"}),t.jsxs("div",{className:"flex min-h-screen w-full bg-[#F8FAFC]",children:[t.jsx(J,{}),t.jsxs(Q,{className:"flex-1",children:[t.jsx(oe,{title:"Calendar & Meetings"}),t.jsx("main",{className:"mx-auto w-full max-w-[1500px] px-4 py-5 sm:px-6 lg:px-8",children:t.jsxs(X,{className:"overflow-hidden rounded-[20px] border-slate-200/70 bg-white shadow-[0_18px_45px_rgba(15,23,42,0.06)]",children:[t.jsx(ee,{className:"border-b border-slate-100 p-5 sm:p-6",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-blue-50 text-blue-700",children:t.jsx(te,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx(se,{className:"text-xl font-semibold tracking-tight text-slate-950",children:"Calendar & Meetings"}),t.jsxs(ae,{className:"mt-1 text-sm text-slate-500",children:["Organize and manage team sessions. Current timezone: ",c]})]})]})}),t.jsxs(ne,{className:"p-4 sm:p-6",children:[t.jsxs("div",{className:"mb-5 space-y-3 rounded-2xl border border-slate-200/70 bg-slate-50/70 p-3 sm:p-4",children:[t.jsxs("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-center xl:justify-between",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(l,{variant:"outline",size:"icon",onClick:W,className:"h-9 w-9 rounded-xl border-slate-200 bg-white",children:t.jsx(be,{className:"h-4 w-4"})}),t.jsx(l,{variant:"outline",size:"icon",onClick:H,className:"h-9 w-9 rounded-xl border-slate-200 bg-white",children:t.jsx(Se,{className:"h-4 w-4"})}),t.jsx("div",{className:"rounded-xl bg-white px-3 py-2 shadow-sm ring-1 ring-slate-200/70",children:t.jsxs("span",{className:"text-sm font-semibold text-slate-800",children:[r==="month"&&j(n,"MMMM yyyy"),r==="week"&&j(n,"'Week of' MMM d, yyyy"),r==="day"&&j(n,"MMMM d, yyyy")]})}),t.jsx(l,{variant:"ghost",onClick:()=>h(new Date),className:"rounded-xl text-slate-600",children:"Today"})]}),t.jsx(ie,{value:r,onValueChange:e=>b(e),children:t.jsxs(le,{className:"h-10 rounded-xl bg-white p-1 shadow-sm ring-1 ring-slate-200/70",children:[t.jsx(w,{value:"month",className:"rounded-lg px-4 data-[state=active]:shadow-sm",children:"Month"}),t.jsx(w,{value:"week",className:"rounded-lg px-4 data-[state=active]:shadow-sm",children:"Week"}),t.jsx(w,{value:"day",className:"rounded-lg px-4 data-[state=active]:shadow-sm",children:"Day"})]})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(l,{onClick:()=>C(!0),className:"rounded-xl bg-slate-950 hover:bg-slate-800",children:[t.jsx(Ce,{className:"mr-1.5 h-4 w-4"})," New Meeting"]}),G?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-emerald-50 px-3 py-2 text-xs font-semibold text-emerald-700",children:[t.jsx(re,{className:"h-3.5 w-3.5"}),"Google Connected"]}),t.jsx(l,{variant:"outline",onClick:U,className:"rounded-xl border-slate-200 bg-white",children:"Disconnect"})]}):t.jsx(l,{onClick:_,variant:"outline",className:"rounded-xl border-slate-200 bg-white",children:"Connect Google Calendar"})]})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-slate-200/70 pt-3",children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-slate-500",children:[t.jsx(De,{className:"h-3.5 w-3.5"}),"Filter sessions"]}),E.map(e=>t.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-2 rounded-full bg-white px-3 py-1.5 text-xs font-medium text-slate-600 shadow-sm ring-1 ring-slate-200/70 transition-colors hover:text-slate-950",children:[t.jsx("input",{type:"checkbox",className:"h-3.5 w-3.5 accent-blue-600",checked:S.includes(e.value),onChange:()=>K(e.value)}),t.jsx("span",{children:e.label})]},e.value))]})]}),t.jsx("div",{className:"overflow-x-auto rounded-2xl",children:r==="month"?t.jsx(me,{currentDate:n,events:k,onEventClick:f,onShowMoreClick:$}):t.jsx(he,{date:n,view:r,onView:e=>b(e),onNavigate:e=>h(e),events:B,onSelectEvent:f})}),t.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 rounded-2xl bg-slate-50 px-4 py-3 text-xs text-slate-600",children:[t.jsx("span",{className:"font-semibold text-slate-700",children:"Session key"}),t.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-2",children:E.map(e=>t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:`${ge(e.value)} inline-block w-2.5 h-2.5 rounded-full`,"aria-hidden":"true"}),t.jsx("span",{children:e.label})]},e.value))})]})]})]})})]})]}),t.jsx(we,{open:T,onOpenChange:C}),t.jsx(je,{open:F,onOpenChange:p,event:I,onEdit:Y}),t.jsx(xe,{open:z,onOpenChange:v,date:R,events:k,onEventClick:f}),t.jsx(ue,{open:!!d,onOpenChange:e=>{e||u(null)},event:d,onEditSeries:(e,s,i,q)=>{u(null),N({seriesId:e,anchorStart:s,durationMinutes:i,timezone:q,rrule:(d==null?void 0:d.rrule)||null}),D(!0)}}),o&&t.jsx(pe,{open:L,onOpenChange:e=>{D(e),e||N(null)},seriesId:o.seriesId,anchorStart:o.anchorStart,durationMinutes:o.durationMinutes,timezone:o.timezone,rrule:o.rrule})]})}
1export{pt 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.