1"use strict";(globalThis.webpackChunkacademicJobs=globalThis.webpackChunkacademicJobs||[]).push([[6183],{6183(e,a,t){t.r(a),t.d(a,{default:()=>i});var s=t(9950),l=t(2952),r=t(4414);function n(e){let{img:a,onSaved:t}=e;const[n,i]=(0,s.useState)(!1),[d,c]=(0,s.useState)(a.caption||""),[o,{isLoading:x}]=(0,l.iJ)();return n?(0,r.jsxs)("div",{className:"flex flex-col gap-2 min-w-[16rem]",children:[(0,r.jsx)("textarea",{value:d,onChange:e=>c(e.target.value),rows:2,placeholder:"Caption",className:"w-full border border-gray-300 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-amber-500"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:async()=>{try{await o({imageId:a.id,caption:d}).unwrap(),i(!1),null===t||void 0===t||t()}catch(s){var e;console.error("Failed to update caption:",s),alert((null===s||void 0===s||null===(e=s.data)||void 0===e?void 0:e.message)||"Failed to update caption.")}},disabled:x,className:"btn btn-sm bg-amber-500 hover:bg-amber-600 disabled:bg-gray-400 text-white border-none",children:x?"Saving...":"Save"}),(0,r.jsx)("button",{type:"button",onClick:()=>{c(a.caption||""),i(!1)},className:"btn btn-sm bg-gray-200 hover:bg-gray-300 text-gray-700 border-none",children:"Cancel"})]})]}):(0,r.jsx)("button",{type:"button",onClick:()=>i(!0),className:"btn btn-sm bg-amber-500 hover:bg-amber-600 text-white border-none",children:"Edit"})}const i=function(){var e,a,t;const[i,d]=(0,s.useState)(1),{data:c,isLoading:o,isError:x,refetch:m}=(0,l.Zr)({page:i,limit:20}),h=null!==(e=null===c||void 0===c?void 0:c.data)&&void 0!==e?e:[],g=null!==(a=null===c||void 0===c?void 0:c.total)&&void 0!==a?a:0,p=null!==(t=null===c||void 0===c?void 0:c.totalPages)&&void 0!==t?t:Math.max(1,Math.ceil(g/20));return(0,r.jsxs)("div",{className:"flex flex-col px-6 gap-6 mt-4 w-full",children:[(0,r.jsx)("h1",{className:"text-3xl font-bold text-black",children:"Images Without a Caption"}),o&&(0,r.jsx)("div",{className:"text-center p-10 text-gray-600 font-semibold",children:"Loading images..."}),x&&(0,r.jsx)("div",{className:"text-center p-10 text-red-600",children:"Failed to load images."}),!o&&!x&&0===h.length&&(0,r.jsx)("div",{className:"text-center p-10 bg-gray-100 rounded-md text-gray-700",children:"No images without captions found."}),!o&&!x&&h.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-sm text-gray-500",children:["Page ",i," of ",p," \u2014 ",g," total"]}),(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg shadow border border-gray-200",children:(0,r.jsxs)("table",{className:"min-w-full bg-white text-sm",children:[(0,r.jsx)("thead",{className:"bg-gray-50 text-left text-gray-600 uppercase text-xs tracking-wider",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-4 py-3",children:"ID"}),(0,r.jsx)("th",{className:"px-4 py-3",children:"Preview"}),(0,r.jsx)("th",{className:"px-4 py-3",children:"Employer"}),(0,r.jsx)("th",{className:"px-4 py-3",children:"URL"}),(0,r.jsx)("th",{className:"px-4 py-3",children:"Created"}),(0,r.jsx)("th",{className:"px-4 py-3",children:"Actions"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-gray-100",children:h.map(e=>{var a,t;return(0,r.jsxs)("tr",{className:"hover:bg-gray-50 transition-colors",children:[(0,r.jsx)("td",{className:"px-4 py-3 font-medium text-gray-900",children:e.id}),(0,r.jsx)("td",{className:"px-4 py-3",children:e.url?(0,r.jsx)("img",{src:e.url,alt:"",className:"h-16 w-16 object-cover rounded"}):(0,r.jsx)("span",{className:"text-gray-400",children:"\u2014"})}),(0,r.jsx)("td",{className:"px-4 py-3 text-gray-700",children:null!==(a=null===(t=e.employer)||void 0===t?void 0:t.company_name)&&void 0!==a?a:(0,r.jsx)("span",{className:"text-gray-400",children:"\u2014"})}),(0,r.jsx)("td",{className:"px-4 py-3 text-gray-700 break-all max-w-md",children:e.url?(0,r.jsx)("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",children:e.url}):(0,r.jsx)("span",{className:"text-gray-400",children:"\u2014"})}),(0,r.jsx)("td",{className:"px-4 py-3 text-gray-500",children:e.createdAt?new Date(e.createdAt).toLocaleStr
1ing():"\u2014"}),(0,r.jsx)("td",{className:"px-4 py-3",children:(0,r.jsx)(n,{img:e,onSaved:m})})]},e.id)})})]})}),(0,r.jsxs)("div",{className:"flex gap-3 items-center",children:[(0,r.jsx)("button",{onClick:()=>d(e=>Math.max(1,e-1)),disabled:1===i,className:"btn btn-sm",children:"\u2190 Prev"}),(0,r.jsxs)("span",{className:"text-sm text-gray-600",children:["Page ",i," of ",p]}),(0,r.jsx)("button",{onClick:()=>d(e=>e+1),disabled:i>=p,className:"btn btn-sm",children:"Next \u2192"})]})]})]})}}}]);
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.