PageSourceSearch

https://remoteio-ops-admin.replit.app/assets/all-jobs-page-BpM2-qq-.js

js remoteio-ops-admin.replit.app collected 2026-10-03 03:58:20 UTC 13,776 bytes, 1 lines download raw bytes

1import{x as se,r,v as ae,j as e,J as K,aD as ie,X as re,ci as le,bq as O,b8 as ne,b7 as de}from"./vendor-CBNU5eW7.js";import{C as g,a as f,d as j,c as b,b as ce}from"./card-B8i-ebZf.js";import{T as oe,a as ue,b as q,c as P,d as xe,e as n}from"./table-C8Nqwj-F.js";import{e as D,T as L,a as R,b as E,I as he,h as me,i as pe}from"./index-Byt2ATbS.js";import{S as ge}from"./semantic-status-badge-BcgMxa72.js";import{S as fe,a as je,b as be,c as we,d as H}from"./select-CFv24LBT.js";import{S as w}from"./skeleton-D_rmFTy1.js";import{C as B}from"./checkbox-CxFgMIBq.js";import{S as ye,a as ve,b as Se,c as Ne,d as Ce}from"./job-constants-BQam0wT4.js";import{P as Te}from"./pagination-controls-c7HZD62-.js";import{B as ke}from"./bulk-actions-bar-C2cbZgwz.js";import{E as Ae}from"./empty-state-B2mSQxla.js";import{u as $e}from"./use-bulk-selection-UAUL00ek.js";import"./utils-st4fSXDB.js";import"./alert-dialog-D4pUOmdi.js";function Pe(a){switch(a){case"remote":return"Remote";case"hybrid":return"Hybrid";case"onsite":return"On-site";default:return"Unknown"}}function De(a){return a.status==="active"&&a.publishAt&&new Date(a.publishAt)>new Date?"queued":a.status}function Le(a){switch(a){case"active":return"success";case"enriched":return"purple";case"imported":return"info";case"review":return"warning";case"expired":case"deleted":return"danger";case"unpublished":return"danger";case"queued":return"info";default:return"neutral"}}function Re(a){switch(a){case"remote":return"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20";case"hybrid":return"bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20";case"onsite":return"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20";default:return"bg-muted text-muted-foreground"}}function Ee(a){return a.isPaid?"bg-amber-50 dark:bg-amber-950/20":a.autoPublished?"bg-emerald-50 dark:bg-emerald-950/20":""}const V=["imported","review","pending","complete","enriched","ready","active","active-visible","active-scheduled","unpublished","expired","deleted"],F=new Set(V);function Ge(){const[,a]=se(),[h,I]=r.useState(""),[C,z]=r.useState(""),[T,J]=r.useState("scrapedAt"),[k,U]=r.useState("desc"),[y,d]=r.useState(1),[v,M]=r.useState(25),[l,S]=r.useState(()=>{if(typeof window>"u")return"";const t=new URLSearchParams(window.location.search).get("status")??"";return F.has(t)?t:""}),{selectedIds:m,selectedCount:Q,toggleOne:X,toggleAll:Y,clearSelection:_,isAllSelected:G,isSomeSelected:W}=$e();r.useEffect(()=>{_()},[y,v,l]),r.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),s=t.get("status")??"";if(l&&s!==l)t.set("status",l),window.history.replaceState(null,"",`${window.location.pathname}?${t.toString()}`);else if(!l&&s){t.delete("status");const i=t.toString();window.history.replaceState(null,"",i?`${window.location.pathname}?${i}`:window.location.pathname)}},[l]),r.useEffect(()=>{if(typeof window>"u")return;const t=()=>{const s=new URLSearchParams(window.location.search).get("status")??"";S(F.has(s)?s:"")};return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[]),r.useEffect(()=>{const t=setTimeout(()=>{z(h),d(1)},300);return()=>clearTimeout(t)},[h]);const{data:A,isLoading:o,isFetching:Ie}=ae({staleTime:12e4,placeholderData:de,queryKey:["/api/jobs",y,v,T,k,C,l],queryFn:async()=>{const t=new URLSearchParams({page:String(y),pageSize:String(v),sortKey:T,sortDir:k});C&&t.set("search",C),l&&t.set("status",l);const s=await pe(),i=await fetch(`/api/jobs?${t.toString()}`,{credentials:"include",headers:s});if(!i.ok)throw new Error(`Failed to fetch jobs: ${i.status}`);return i.json()}}),p=A?.jobs??[],N=A?.total??0,u=A?.stats??{total:0,active:0,activeVisible:0,activeScheduled:0,remote:0,queued:0},$=p.map(t=>t.id),{enhanceableCount:Z,publishableCount:ee}=r.useMemo(()=>{const t=p.filter(s=>m.has(s.id));return{enhanceableCount:t.filter(s=>!s.aiEnhancedAt&&["imported","review","enriched"].includes(s.status)).length,publishableCount:t.filter(s=>["enriched","ready"].includes(s.status)).length}},[p,m]),te=t=>{T===t?U(k==="asc"?"desc":"asc"):(J(t),U("asc")),d(1)},c=({label:t,colKey:s})=>e.jsx(P,{children:e.jsxs("button",{className:"flex items-center gap-1 hover:text-foreground transition-colors",onClick:()=>te(s),"data-testid":`sort-${s}`,children:[t,e.jsx(ne,{className:"h-3 w-3"})]})});return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold","data-testid":"text-page-title",children:"All listings"}),e.jsx("p",{className:"text-muted-foreground",children:"Overview of every job listing on the platform."})]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs(g,{children:[e.jsxs(f,{className:"flex flex-row items-center justify-between gap-1 space-y-0 pb-2",children:[e.jsx(j,{children:"Total jobs"}),e.jsx(K,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(b,{children:e.jsx("div",{className:"text-2xl font-bold","data-testid":"stat-total-jobs",children:o?e.jsx(w,{className:"h-7 w-16"}):u.total})})]}),e.jsxs(g,{children:[e.jsxs(f,{className:"flex flex-row items-center justify-between gap-1 space-y-0 pb-2",children:[e.jsx(j,{children:"Active"}),e.jsx(D,{children:e.jsxs(L,{children:[e.jsx(R,{asChild:!0,children:e.jsx("button",{type:"button",className:"text-[10px] text-muted-foreground hover:text-foreground","data-testid":"tooltip-active-split",children:"?"})}),e.jsx(E,{className:"max-w-xs",children:e.jsxs("p",{className:"text-xs",children:['"Active" includes everything with status=active. Only the ',e.jsx("strong",{children:"visible"})," subset is on the public board right now — the rest are ",e.jsx("strong",{children:"scheduled"})," with a future drip timestamp and will appear automatically."]})})]})})]}),e.jsxs(b,{children:[e.jsx("div",{className:"text-2xl font-bold","data-testid":"stat-active-jobs",children:o?e.jsx(w,{className:"h-7 w-16"}):u.active}),!o&&e.jsxs("div",{className:"text-[11px] text-muted-foreground mt-1 flex items-center gap-2","data-testid":"text-active-split",children:[e.jsxs("button",{type:"button",onClick:()=>{S("active-visible"),d(1)},className:"hover:underline underline-offset-2","data-testid":"button-filter-active-visible",title:"Filter table to active jobs visible on the public board now",children:[e.jsx("span",{className:"font-medium text-emerald-600 dark:text-emerald-400",children:u.activeVisible})," visible"]}
1),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsxs("button",{type:"button",onClick:()=>{S("active-scheduled"),d(1)},className:"hover:underline underline-offset-2","data-testid":"button-filter-active-scheduled",title:"Filter table to active jobs with a future publish_at (scheduled to drip)",children:[e.jsx("span",{className:"font-medium text-blue-600 dark:text-blue-400",children:u.activeScheduled})," scheduled"]})]})]})]}),e.jsxs(g,{children:[e.jsx(f,{className:"flex flex-row items-center justify-between gap-1 space-y-0 pb-2",children:e.jsx(j,{children:"Remote"})}),e.jsx(b,{children:e.jsx("div",{className:"text-2xl font-bold","data-testid":"stat-remote-jobs",children:o?e.jsx(w,{className:"h-7 w-16"}):u.remote})})]}),e.jsxs(g,{children:[e.jsx(f,{className:"flex flex-row items-center justify-between gap-1 space-y-0 pb-2",children:e.jsx(j,{children:"Queued"})}),e.jsx(b,{children:e.jsx("div",{className:"text-2xl font-bold","data-testid":"stat-queued-jobs",children:o?e.jsx(w,{className:"h-7 w-16"}):u.queued})})]})]}),e.jsxs(g,{children:[e.jsxs(f,{children:[e.jsx(ce,{children:"Job listings"}),e.jsxs(j,{children:[N," ",N===1?"job":"jobs"," found"]})]}),e.jsxs(b,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ie,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(he,{placeholder:"Search by title or company...",value:h,onChange:t=>I(t.target.value),className:"pl-9 pr-9","data-testid":"input-search"}),h&&e.jsx("button",{onClick:()=>{I(""),d(1)},className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","data-testid":"button-clear-search",children:e.jsx(re,{className:"h-4 w-4"})})]}),e.jsxs(fe,{value:l,onValueChange:t=>{S(t==="all"?"":t),d(1)},children:[e.jsx(je,{className:"w-[200px]","data-testid":"select-status-filter",children:e.jsx(be,{placeholder:"All statuses"})}),e.jsxs(we,{children:[e.jsx(H,{value:"all",children:"All statuses"}),V.map(t=>e.jsx(H,{value:t,children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"capitalize",children:t.replace("-"," — ")}),e.jsx("span",{className:"text-[11px] text-muted-foreground leading-tight",children:ye[t]})]})},t))]})]})]}),e.jsx(ke,{selectedCount:Q,selectedIds:m,onClear:_,invalidateKeys:["/api/jobs","/api/jobs/live"],enhanceableCount:Z,publishableCount:ee,statusFilter:l}),o?e.jsx("div",{className:"space-y-3",children:Array.from({length:10}).map((t,s)=>e.jsx(w,{className:"h-12 w-full"},s))}):p.length===0?e.jsx(Ae,{className:"py-8",icon:e.jsx(K,{className:"mx-auto mb-3 h-12 w-12 text-muted-foreground"}),title:"No jobs found",description:h?"Try adjusting your search query.":void 0}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(oe,{className:"[&_td]:py-2 [&_td]:px-2 [&_th]:py-2 [&_th]:px-2 [&_th]:text-xs",children:[e.jsx(ue,{children:e.jsxs(q,{children:[e.jsx(P,{className:"w-10",children:e.jsx(B,{checked:G($)?!0:W($)?"indeterminate":!1,onCheckedChange:()=>Y($),"data-testid":"checkbox-select-all"})}),e.jsx(c,{label:"Company",colKey:"companyName"}),e.jsx(c,{label:"Job title",colKey:"jobTitle"}),e.jsx(c,{label:"Category",colKey:"category"}),e.jsx(c,{label:"Location",colKey:"locationType"}),e.jsx(c,{label:"Status",colKey:"status"}),e.jsx(P,{children:"Publish"}),e.jsx(c,{label:"Views",colKey:"views"}),e.jsx(c,{label:"Applies",colKey:"clicks"}),e.jsx(c,{label:"Created",colKey:"scrapedAt"})]})}),e.jsx(xe,{children:p.map(t=>{const s=De(t);return e.jsxs(q,{className:`cursor-pointer hover-elevate ${m.has(t.id)?"bg-primary/5":Ee(t)}`,onClick:()=>a(`/tools/jobs/${t.id}?from=all-jobs`),"data-testid":`row-job-${t.id}`,children:[e.jsx(n,{onClick:i=>i.stopPropagation(),children:e.jsx(B,{checked:m.has(t.id),onCheckedChange:()=>X(t.id),"data-testid":`checkbox-job-${t.id}`})}),e.jsx(n,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.companyLogoUrl?e.jsx("img",{src:t.companyLogoUrl,alt:t.companyName,className:"h-6 w-6 rounded-sm object-contain shrink-0","data-testid":`img-logo-${t.id}`}):e.jsx("div",{className:"h-6 w-6 rounded-sm bg-muted flex items-center justify-center shrink-0",children:e.jsx(le,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{className:"text-xs font-medium","data-testid":`text-job-company-${t.id}`,children:t.companyName})]})}),e.jsx(n,{className:"max-w-[300px]",children:e.jsx("span",{className:"text-xs text-muted-foreground","data-testid":`text-job-title-${t.id}`,children:t.jobTitle})}),e.jsx(n,{children:e.jsx("span",{className:"text-xs text-muted-foreground","data-testid":`text-job-category-${t.id}`,children:t.normalizedCategory||t.category||"Uncategorized"})}),e.jsx(n,{children:e.jsx(me,{className:Re(t.locationType),"data-testid":`badge-job-location-${t.id}`,children:Pe(t.locationType)})}),e.jsx(n,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(D,{delayDuration:200,children:e.jsxs(L,{children:[e.jsx(R,{asChild:!0,children:e.jsx("span",{className:"inline-flex cursor-help",children:e.jsx(ge,{tone:Le(s),className:"text-xs","data-testid":`badge-job-status-${t.id}`,children:ve(s)})})}),e.jsx(E,{side:"top",collisionPadding:8,className:"max-w-sm text-xs leading-relaxed",children:e.jsx("p",{children:Se[s]||"Unknown status"})})]})}),t.autoPublished&&e.jsx(D,{delayDuration:200,children:e.jsxs(L,{children:[e.jsx(R,{asChild:!0,children:e.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 cursor-help text-[10px] font-medium","data-testid":`badge-auto-published-${t.id}`,children:"Auto"})}),e.jsx(E,{side:"top",className:"text-xs",children:"Auto-published — this job went live automatically because the company is configured for auto-publishing"})]})})]}),s==="review"&&(()=>{const i=Ne(t),x=Ce(i);return x?e.jsx("span",{className:"text-[10px] text-amber-600 dar
1k:text-amber-400 leading-tight truncate max-w-[140px]","data-testid":`text-review-reason-${t.id}`,children:x}):null})()]})}),e.jsx(n,{children:t.publishAt?(()=>{const i=new Date(t.publishAt),x=i.getTime()>Date.now();return e.jsxs("span",{className:`text-xs whitespace-nowrap ${x?"text-blue-600 dark:text-blue-400 font-medium":"text-muted-foreground"}`,title:x?`Scheduled to appear on the public board at ${i.toISOString()}`:`Published at ${i.toISOString()}`,"data-testid":`text-job-publish-${t.id}`,children:[x?"→ ":"",O(i,"yyyy-MM-dd HH:mm")]})})():e.jsx("span",{className:"text-xs text-muted-foreground","data-testid":`text-job-publish-${t.id}`,children:"—"})}),e.jsx(n,{children:e.jsx("span",{className:"text-xs text-muted-foreground","data-testid":`text-job-views-${t.id}`,children:t.views})}),e.jsx(n,{children:e.jsx("span",{className:"text-xs text-muted-foreground","data-testid":`text-job-clicks-${t.id}`,children:t.clicks})}),e.jsx(n,{children:e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap","data-testid":`text-job-created-${t.id}`,children:t.scrapedAt?O(new Date(t.scrapedAt),"yyyy-MM-dd"):"—"})})]},t.id)})})]})}),!o&&N>0&&e.jsx(Te,{totalItems:N,pageSize:v,currentPage:y,onPageChange:d,onPageSizeChange:t=>{M(t),d(1)}})]})]})]})}export{Ge 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.