PageSourceSearch

https://muslimskstudent.no/assets/LibraryStatsPage-MaRK3HYP.js

js muslimskstudent.no collected 2026-10-03 02:57:27 UTC 9,848 bytes, 1 lines download raw bytes

1import{r as l,j as t}from"./react-Cs8zWWH2.js";import{u as D}from"./usePageMeta-BvB62zv-.js";import{C as g}from"./ConsoleShell-B6JGGUOW.js";import{L as I,E as M,b as z,S as f,P as d,c as j}from"./ui-C7YLVuxw.js";import{b1 as Y,b2 as G,b3 as L,b4 as Q,B as Z}from"./console-Y2mJoOjr.js";import{l as J}from"./refusals-CunMpQfQ.js";import{b as T}from"./bookLabel-C1Unc1w0.js";import"./auth-DM2PqoGT.js";import"./supabase-e9Wsjn9L.js";import"./supabase-CSIM0fnT.js";import"./auth-hint-D8tyCaun.js";import"./motion-ok-BZHsZT9U.js";import"./description-Bi7ryekb.js";import"./index-DqTbYVu9.js";import"./useInstallPrompt-DXvMojZG.js";import"./errors-S2tcHEbl.js";import"./dates-DEOFUjH6.js";function K(e,o){const n=Number(e??0),r=Number(o??0);return!Number.isFinite(r)||r<=0?null:Math.max(0,Math.min(1,n/r))}const w=(e,o)=>{const n=K(e,o);return n===null?null:Math.round(n*100)};function U(e,o){const n=Number(e??0),r=Number(o??0);if(!Number.isFinite(r)||r<=0)return{change:null,direction:"none",words:"the first year with figures"};const s=Math.round((n-r)/r*100);return s===0?{change:0,direction:"level",words:"level with last year"}:{change:s,direction:s>0?"up":"down",words:`${Math.abs(s)}% ${s>0?"up on":"down on"} last year`}}function V(e,o){if(e==null||!Number.isFinite(Number(e)))return{figure:null,note:"No loan has been collected and returned yet."};const n=Number(e),r=Number(o??0),s=`${n} ${n===1?"day":"days"}`;if(!Number.isFinite(r)||r<=0)return{figure:s,note:null};const u=Math.round(r-n);return u>7?{figure:s,note:`Well inside the ${r} days allowed.`}:u>=0?{figure:s,note:`Close to the ${r} days allowed.`}:{figure:s,note:`Longer than the ${r} days allowed.`}}function X(e){const o=Number((e==null?void 0:e.titles)??0),n=Number((e==null?void 0:e.never_borrowed)??0),r=Math.max(0,o-n);return{titles:o,borrowed:r,never:n,quiet:w(n,o),reached:w(r,o)}}function ee(e){const o=Number((e==null?void 0:e.waiting_pickup)??0),n=Number((e==null?void 0:e.never_collected)??0);return{waiting:o,stuck:n,fine:Math.max(0,o-n),words:n===0?"Nothing has been left in the box.":`${n} ${n===1?"book has":"books have"} sat in the box over three weeks.`}}function te(e){const o=Number((e==null?void 0:e.returned_all)??0),n=o+Number((e==null?void 0:e.lost_or_damaged)??0)+Number((e==null?void 0:e.overdue)??0);return n===0?{pct:null,words:"No loan has ended yet."}:{pct:w(o,n),words:n===1?`${o} of the 1 loan that has ended or is past due. Loans still running are not counted.`:`${o} of the ${n} loans that have ended or are past due. Loans still running are not counted.`}}const ne=e=>(e||[]).reduce((o,n)=>Math.max(o,Number((n==null?void 0:n.loans)??0)),0),v={to:"/console/bibliotek",label:"Library"},oe={timeZone:"Europe/Oslo"},ae=e=>new Date(e).toLocaleDateString("en-GB",{month:"short",...oe});function i({label:e,value:o,note:n,tone:r="text"}){return t.jsxs(d,{className:"p-4",children:[t.jsx("p",{className:"font-display font-medium",style:{fontSize:"var(--c-label)",color:"var(--c-muted)"},children:e}),t.jsx("p",{className:"font-display font-semibold tnum",style:{fontSize:"var(--c-figure)",lineHeight:1.1,marginTop:4,color:`var(--c-${r})`},children:o??"—"}),n&&t.jsx("p",{className:"font-serif",style:{fontSize:"var(--c-fine)",color:"var(--c-muted)",marginTop:4,lineHeight:1.5},children:n})]})}function re({row:e,most:o}){const n=o>0?Math.round(e.loans/o*100):0;return t.jsxs("div",{className:"flex items-center",style:{gap:10,padding:"7px 0"},children:[t.jsx("span",{className:"font-display font-semibold",style:{width:108,fontSize:"var(--c-label)",flexShrink:0},children:e.category}),t.jsx("span",{className:"flex-1 rounded-[3px]",style:{height:10,background:"var(--c-line)",overflow:"hidden"},children:t.jsx("span",{className:"block h-full rounded-[3px]",style:{width:`${n}%`,background:e.loans>0?"var(--c-accent)":"transparent"}})}),t.jsx("span",{className:"font-display tnum text-right",style:{width:30,fontSize:"var(--c-label)",color:"var(--c-muted)"},children:e.loans}),t.jsxs("span",{className:"text-right",style:{width:74,fontSize:"var(--c-label)",color:"var(--c-faint)"},children:[e.titles," ",e.titles===1?"title":"titles"]})]})}function Ne(){D("The library’s numbers","What Al-Maktabah is doing.",{noindex:!0});const[e,o]=l.useState(null),[n,r]=l.useState([]),[s,u]=l.useState([]),[C,W]=l.useState([]),[N,q]=l.useState([]),[b,B]=l.useState(null),[R,S]=l.useState(!0),[h,k]=l.useState(null),m=l.useCallback(async()=>{S(!0),k(null);try{const[a,y,P,A,F,H]=await Promise.all([Y(),G(),L(!1,8),L(!0,8),Q(12),Z()]);o(a),r(y??[]),u(P??[]),W(A??[]),q(F??[]),B(H??null)}catch(a){k(J(a,{fallback:"We could not count the library just now. Try again?"}))}finally{S(!1)}},[]);if(l.useEffect(()=>{m()},[m]),R)return t.jsx(g,{title:"The library’s numbers",back:v,children:t.jsx(I,{label:"Counting…"})});if(!e)return t.jsx(g,{title:"The library’s numbers",back:v,children:h?t.jsx(M,{onRetry:m,children:h}):t.jsx(z,{children:"Nothing to count yet. This fills in as books go out."})});
1const E=U(e.loans_year,e.loans_last_year),c=X(e),p=ee(e),_=V(e.median_days,b==null?void 0:b.loan_days),x=te(e),O=n.reduce((a,y)=>Math.max(a,Number(y.loans??0)),0),$=ne(N);return t.jsxs(g,{maxWidth:1e3,back:v,title:"The library’s numbers",subtitle:"Al-Maktabah, counted",children:[h&&t.jsx(M,{onRetry:m,children:h}),t.jsx(f,{children:"How much it is used"}),t.jsxs("div",{className:"grid gap-2.5 mb-5",style:{gridTemplateColumns:"repeat(auto-fit,minmax(190px,1fr))"},children:[t.jsx(i,{label:"Loans this year",value:e.loans_year,note:E.words,tone:"accent"}),t.jsx(i,{label:"People who borrowed",value:e.borrowers_year,note:`${e.borrowers_all} different people, all time.`}),t.jsx(i,{label:"Out right now",value:e.out_now,note:e.overdue>0?`${e.overdue} overdue.`:"None overdue."}),t.jsx(i,{label:"Loans, all time",value:e.loans_all})]}),t.jsx(f,{children:"What to buy next"}),t.jsxs("p",{className:"font-serif mb-3",style:{fontSize:"var(--c-body)",color:"var(--c-muted)",lineHeight:1.6,maxWidth:"64ch"},children:["The bar is share of ",t.jsx("b",{children:"loans"}),", not share of the shelf. A subject with many titles and few loans is over-bought; one with few titles and many loans is where the next order goes."]}),t.jsx(d,{className:"p-4",style:{marginBottom:14},children:n.length===0?t.jsx(z,{children:"No subjects yet."}):n.map(a=>t.jsx(re,{row:a,most:O},a.category))}),t.jsxs("div",{className:"grid gap-2.5 mb-5",style:{gridTemplateColumns:"repeat(auto-fit,minmax(280px,1fr))"},children:[t.jsxs(d,{className:"p-4",children:[t.jsx("p",{className:"font-display font-semibold mb-2",style:{fontSize:"var(--c-body)"},children:"Most borrowed"}),s.length===0?t.jsx("p",{className:"font-serif",style:{fontSize:"var(--c-fine)",color:"var(--c-faint)"},children:"Nothing yet."}):s.map(a=>t.jsxs("div",{className:"flex items-baseline justify-between gap-3",style:{padding:"4px 0"},children:[t.jsx("span",{className:"font-serif min-w-0 [overflow-wrap:anywhere]",style:{fontSize:"var(--c-body)"},children:T(a)}),t.jsx("span",{className:"font-display tnum flex-shrink-0",style:{fontSize:"var(--c-label)",color:"var(--c-muted)"},children:a.loans})]},a.id))]}),t.jsxs(d,{className:"p-4",children:[t.jsx("p",{className:"font-display font-semibold",style:{fontSize:"var(--c-body)"},children:"Never borrowed"}),t.jsx("p",{className:"font-serif mb-2",style:{fontSize:"var(--c-fine)",color:"var(--c-muted)",marginTop:2},children:c.quiet===null?"No books on the shelf yet.":`${c.never} of ${c.titles} titles, ${c.quiet}% of the shelf. ${c.quiet>=50?"Worth a poster before another order.":""}`}),C.map(a=>t.jsxs("div",{className:"flex items-baseline justify-between gap-3",style:{padding:"4px 0"},children:[t.jsx("span",{className:"font-serif min-w-0 [overflow-wrap:anywhere]",style:{fontSize:"var(--c-body)",color:"var(--c-muted)"},children:T(a)}),t.jsx("span",{style:{fontSize:"var(--c-label)",color:"var(--c-faint)",flexShrink:0},children:a.category})]},a.id))]})]}),t.jsx(f,{children:"Does the borrowing work"}),t.jsxs("div",{className:"grid gap-2.5 mb-5",style:{gridTemplateColumns:"repeat(auto-fit,minmax(190px,1fr))"},children:[t.jsx(i,{label:"A loan lasts",value:_.figure,note:_.note}),t.jsx(i,{label:"Came back",value:x.pct===null?null:`${x.pct}%`,note:x.words}),t.jsx(i,{label:"In the box, as far as we know",value:p.waiting,note:p.words,tone:p.stuck>0?"warn":"text"}),t.jsx(i,{label:"Lost or damaged",value:e.lost_or_damaged,note:e.lost_or_damaged===1?"One copy written off.":`${e.lost_or_damaged} copies written off.`}),t.jsx(i,{label:"Waiting for a copy",value:e.queue_waiting,note:e.queue_waiting>0?"People in a queue for a book that is out.":"Nobody is queueing."})]}),t.jsx(f,{children:"Month by month"}),t.jsx("p",{className:"font-serif mb-3",style:{fontSize:"var(--c-body)",color:"var(--c-muted)",lineHeight:1.6,maxWidth:"64ch"},children:"A student library has two humps: the start of term, and the run-up to exams. Worth stocking before them rather than during."}),t.jsx(d,{className:"p-4",style:{marginBottom:20},children:t.jsx("div",{className:"flex items-end",style:{gap:6,height:120},children:N.map(a=>t.jsxs("div",{className:"flex-1 flex flex-col items-center",style:{gap:5},children:[t.jsx("span",{className:"font-display tnum",style:{fontSize:"var(--c-micro)",color:"var(--c-faint)"},children:a.loans||""}),t.jsx("span",{className:"w-full rounded-t-[3px]",style:{height:$>0?`${Math.max(a.loans>0?2:0,a.loans/$*92)}px`:0,background:"var(--c-accent)",opacity:a.loans>0?1:.25}}),t.jsx("span",{style:{fontSize:"var(--c-micro)",color:"var(--c-faint)"},children:ae(a.month)})]},a.month))})}),t.jsxs("div",{className:"grid gap-2.5",style:{gridTemplateColumns:"repeat(auto-fit,minmax(190px,1fr))"},children:[t.jsx(j,{n:e.titles,label:"Titles"}),t.jsx(j,{n:e.copies,label:"Copies owned"}),t.jsx(j,{n:e.extended,label:"Extended once"})]})]})}export{Ne 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.