PageSourceSearch

https://unicorniq.ai/assets/library-BVgaYbg7.js

js unicorniq.ai collected 2026-10-05 16:12:27 UTC 9,454 bytes, 1 lines download raw bytes

1import{r as n,j as e}from"./index-DP61GySm.js";import{L as A}from"./index-MuG4xkEZ.js";import{z as q,oe as E,nd as K,ne as V,E as w,of as P,ng as $,nh as B}from"./loader-circle-eo-mph3g.js";import{C as T,c as G}from"./use-toast-C6aFH3Eg.js";import{ar as F,bK as Q,cC as U,bI as O,e6 as J,B as l,eb as Y,D as H,s as W,e_ as X}from"./App-0t6TVAR4.js";import{S as p}from"./skeleton-DnZw-awJ.js";import{f as Z,g as ee,h as se,i as te,j as ae}from"./dialog-B9xd4dRw.js";import{L as re,P as ie,n as le,M as ne,E as oe}from"./section-chips-C68mRSIN.js";import{L as de}from"./library-B0ZuaO7X.js";import{R as ce}from"./route-CR77CuQd.js";import{L as ue}from"./waypoints-C6gFN1cM.js";import{M as me}from"./map-D7944tH_.js";import{L as he,U as xe}from"./toaster-BDyw2x6L.js";import"./vendor-shared-C5tCw9rW.js";import"./utils-hQAQiId-.js";import"./x-D235ZOFZ.js";import"./shield-check-BQHCFnRX.js";import"./triangle-alert-CaKCF_Nq.js";import"./trademark-screen-DYufZ-CB.js";import"./sparkles-B4yqwNG6.js";import"./privacy-I8Fotoxq.js";import"./chevron-right-qcpptIv2.js";import"./chevron-down-C8mjF8sg.js";import"./image-off-CpRV4JaY.js";import"./trial-copy-BQN_0jwW.js";import"./unicorniq-logo-B9mOeuD0.js";const L=[{id:"paths",label:"Paths",kinds:["path"],icon:ce},{id:"courses",label:"Courses",kinds:["course"],icon:F},{id:"modules",label:"Modules",kinds:["module"],icon:ue},{id:"lessons",label:"Lessons & media",kinds:["lesson","video","activity","article"],icon:Q},{id:"quizzes",label:"Quizzes, labs, sessions & surveys",kinds:["quiz","lab","live_session","mentor_session","pre_recorded_session","survey","external_link"],icon:U},{id:"overviews",label:"Journey overviews",kinds:["journey_overview"],icon:me},{id:"exams",label:"Exams",kinds:["exam"],icon:O},{id:"certifications",label:"Certifications",kinds:["certification"],icon:J}],y={path:"Path",course:"Course",module:"Module",lesson:"Lesson",video:"Video",activity:"Activity",article:"Article",quiz:"Quiz",lab:"Lab",live_session:"Live ILT session",mentor_session:"Live Mentor session",pre_recorded_session:"Pre-Recorded session",survey:"Survey",external_link:"External link",journey_overview:"Journey overview",exam:"Exam",certification:"Certification"};function k(r){return r==="published"?"default":"secondary"}function C(r){const o=new Date(r);return Number.isNaN(o.getTime())?"—":o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Be(){const{data:r}=q(),o=!!r&&(r.roles.includes("tenant_admin")||r.roles.includes("tenant_group_manager")),f=!!r&&(!r.tenantName||r.workspaceMode==="personal"||!o),{data:u,isLoading:b}=E({query:{enabled:!!r&&!f,queryKey:P()}}),g=u?.items.some(s=>s.kind==="live_session")??!1,{data:S}=K({query:{enabled:g,queryKey:$()}}),{data:v}=V({query:{enabled:g,queryKey:B()}}),[d,j]=n.useState(null),[m,_]=n.useState(""),[t,N]=n.useState(null),{pl:c,offered:R,shown:z}=re(de,{},{enabled:!!r}),h=u?.items??[],D=s=>h.filter(a=>s.kinds.includes(a.kind)).length,I=n.useMemo(()=>{const s=L.find(i=>i.id===d),a=m.trim().toLowerCase();return h.filter(i=>(!s||s.kinds.includes(i.kind))&&(!a||i.title.toLowerCase().includes(a)||(i.authorName??"").toLowerCase().includes(a)))},[h,d,m]),M=n.useMemo(()=>[{id:"title",header:"Title",alwaysVisible:!0,sortValue:s=>s.title,cellClassName:"max-w-72 truncate font-medium",cell:s=>s.title},{id:"kind",header:"Kind",sortValue:s=>y[s.kind],cell:s=>e.jsx(l,{variant:"outline",children:y[s.kind]})},{id:"status",header:"Status",sortValue:s=>s.status,cell:s=>e.jsx(l,{variant:k(s.status),children:s.status})},{id:"author",header:"Author",sortValue:s=>s.authorName??"",cellClassName:"max-w-40 truncate text-muted-foreground",cell:s=>s.authorName??"—"},{id:"updatedAt",header:"Last updated",align:"right",defaultDir:"desc",sortValue:s=>Date.parse(s.updatedAt),filterValue:()=>"",cellClassName:"text-muted-foreground",cell:s=>C(s.updatedAt)},{id:"enrolledCount",header:"Enrolled",align:"right",defaultDir:"desc",sortValue:s=>s.enrolledCount,filterValue:()=>"",cellClassName:"tabular-nums",cell:s=>s.enrolledCount}],[]);return r?f?e.jsx("div",{className:"flex flex-1 items-center justify-center bg-muted/20 p-6",children:e.jsxs("div",{className:"max-w-sm rounded-xl border border-dashed bg-card/50 px-6 py-12 text-center","data-testid":"library-restricted",children:[e.jsx("div",{className:"mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-muted text-muted-foreground",children:e.jsx(he,{className:"h-6 w-6"})}),e.jsx("h3",{className:"font-display text-lg font-semibold",children:"The library overview is restricted"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"This read-only overview of the learning library is available to group managers and workspace admins."})]})}):e.jsx("div",{className:"flex-1 overflow-y-auto bg-muted/20","data-testid":"page-library",children:e.jsxs("div",{className:"mx-auto max-w-6xl space-y-6 p-6 lg:p-10",children:[e.jsxs("header",{className:"flex items-start justify-between gap-3","data-feature-anchor":"library-header",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"flex items-center gap-2 font-display text-3xl font-bold tracking-tight",children:[e.jsx(Y,{className:"h-7 w-7 text-primary"})," Library"]}),e.jsx("p",{className:"mt-1 text-muted-foreground","data-testid":"text-library-scope",children:u?.scope==="groups"?"A read-only overview of the published learning content reachable by the groups you manage.":"A read-only overview of everything in this workspace’s learning library."})]}),e.jsx("span",{"data-feature-anchor":"library-personalize",className:"personalize-corner",children:e.jsx(ie,{pl
1:c,anchor:"library-personalize"})})]}),c.editing&&e.jsx(le,{title:"Library",offered:R,layout:c.layout,onEdit:c.update}),e.jsx(ne,{blocks:z,render:s=>{switch(s.id){case"library-overview":return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-7","data-tour":"library-kind-filters",children:L.map(a=>{const i=a.icon,x=d===a.id;return e.jsxs("button",{type:"button",onClick:()=>j(x?null:a.id),"data-testid":`card-library-${a.id}`,"aria-pressed":x,className:`rounded-xl border bg-card p-4 text-left transition-colors hover:border-primary/50 ${x?"border-primary ring-1 ring-primary":""}`,children:[e.jsx(i,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("div",{className:"mt-2 font-display text-2xl font-bold tabular-nums","data-testid":`count-library-${a.id}`,children:b?"…":D(a)}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a.label})]},a.id)})}),e.jsx(T,{"data-tour":"library-items",children:e.jsx(G,{className:"p-3","data-tour":"library-search",children:b?e.jsxs("div",{className:"space-y-2 p-4",children:[e.jsx(p,{className:"h-8 w-full"}),e.jsx(p,{className:"h-8 w-full"}),e.jsx(p,{className:"h-8 w-2/3"})]}):e.jsx(H,{tableId:"library",title:"Library items",columns:M,rows:I,rowKey:a=>`${a.kind}-${a.id}`,rowProps:a=>({className:"cursor-pointer",onClick:()=>N(a),"data-testid":`row-library-${a.id}`}),filter:{value:m,onChange:_,placeholder:"Filter by title or author…"},emptyMessage:e.jsx("span",{"data-testid":"text-library-empty",children:"Nothing here yet."}),toolbar:d?e.jsx(w,{variant:"ghost",size:"sm",onClick:()=>j(null),"data-testid":"button-library-clear-filter",children:"Show all"}):void 0})})})]});default:return null}}}),e.jsx(Z,{open:t!==null,onOpenChange:s=>{s||N(null)},children:e.jsx(ee,{className:"max-w-lg","data-testid":"dialog-library-item",children:t&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsx(te,{className:"flex items-center gap-2",children:t.title}),e.jsxs(ae,{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[e.jsx(l,{variant:"outline",children:y[t.kind]}),e.jsx(l,{variant:k(t.status),children:t.status}),t.level&&e.jsx(l,{variant:"secondary",children:t.level}),v?.some(s=>s.contentItemId===t.id&&s.status==="registered")&&e.jsx(l,{className:"bg-emerald-600","data-testid":"badge-library-live-session-registered",children:"Registered"}),!v?.some(s=>s.contentItemId===t.id&&s.status==="registered")&&S?.some(s=>s.contentItemId===t.id&&s.status==="requested")&&e.jsx(l,{variant:"secondary","data-testid":"badge-library-live-session-requested",children:"Seat requested"})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(xe,{className:"h-4 w-4"}),e.jsx("span",{"data-testid":"text-item-enrolled",children:t.kind==="certification"?`${t.enrolledCount} holder${t.enrolledCount===1?"":"s"}`:`${t.enrolledCount} enrolled`})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(W,{className:"h-4 w-4"}),e.jsxs("span",{children:["Updated ",C(t.updatedAt)]})]}),e.jsxs("div",{className:"col-span-2 flex items-center gap-2 text-muted-foreground",children:[e.jsx(oe,{className:"h-4 w-4"}),e.jsxs("span",{children:["Authored by ",t.authorName??"a former member"," · read-only view"]})]})]}),t.kind!=="certification"&&e.jsx(w,{asChild:!0,variant:"outline",size:"sm",className:"w-fit",children:e.jsxs(A,{href:`/learning-activity?activityId=${encodeURIComponent(t.id)}`,"data-testid":"link-library-learning-activity",children:[e.jsx(X,{className:"mr-1.5 h-4 w-4","aria-hidden":!0})," Learning activity for this item"]})})]})})})]})}):null}export{Be 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.