PageSourceSearch

https://careerdiary.io/assets/JobHuntingWidgets-cnBaxjLB.js

js careerdiary.io collected 2026-09-24 15:05:10 UTC 9,536 bytes, 6 lines download raw bytes

1import{r as o,j as e}from"./animation-CddyXVCz.js";import{u as y,D as g,s as u,B as b,w as A}from"./index-CGKNpi9E.js";import{W as n,a as k,b as R,c as w,d as f}from"./DashboardDemo-q_u31AWG.js";import"./react-vendor-CbN3pvl2.js";import"./supabase-iKSPld20.js";import"./docgen-Bp8WKBAE.js";import"./query-DPqpbKNH.js";const J=()=>{var r;const{state:l}=y(),t=(r=l.session)==null?void 0:r.user,i=g(),[a,d]=o.useState(null),[h,c]=o.useState(!0),[m,x]=o.useState(null);o.useEffect(()=>{s()},[t==null?void 0:t.id]);const s=async()=>{if(!(t!=null&&t.id)||!u){c(!1);return}try{c(!0);const[p,j,v]=await Promise.all([u.from("applied_jobs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("status","applied"),u.from("applied_jobs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("status","interviewing"),u.from("applied_jobs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("status","offer")]),_=p.count||0,S=j.count||0,q=v.count||0;d({active:_,interviews:S,offers:q})}catch(p){x(p instanceof Error?p.message:"Failed to load stats")}finally{c(!1)}};return h?e.jsx(n,{children:e.jsx(k,{})}):m?e.jsx(n,{children:e.jsx(R,{message:m,onRetry:s})}):!a||a.active===0&&a.interviews===0&&a.offers===0?e.jsx(n,{children:e.jsx(w,{icon:"📋",title:"No applications yet",description:"Start applying to jobs and track them here",action:e.jsx(b,{onClick:()=>i("/app/search"),variant:"primary",size:"md",children:"Search Jobs"})})}):e.jsxs(n,{onClick:()=>i("/app/applications"),children:[e.jsx(f,{title:"Applications",icon:"📊"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(N,{label:"Active",value:a.active,color:"blue"}),e.jsx(N,{label:"Interviews",value:a.interviews,color:"green"}),e.jsx(N,{label:"Offers",value:a.offers,color:"purple"})]})]})},M=()=>{var x;const{state:l}=y(),t=(x=l.session)==null?void 0:x.user,i=g(),[a,d]=o.useState(null),[h,c]=o.useState(!0);o.useEffect(()=>{m()},[t==null?void 0:t.id]);const m=async()=>{if(!(t!=null&&t.id)||!u){c(!1);return}try{const{count:s}=await u.from("saved_jobs").select("id",{count:"exact",head:!0}).eq("user_id",t.id),r=new Date;r.setDate(r.getDate()-1);const{count:p}=await u.from("saved_jobs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).gte("created_at",r.toISOString());d({total:s||0,newMatches:p||0})}catch(s){console.error("Error loading saved jobs:",s)}finally{c(!1)}};return h?e.jsx(n,{children:e.jsx(k,{})}):!a||a.total===0?e.jsx(n,{children:e.jsx(w,{icon:"💾",title:"No saved jobs",description:"Save jobs you're interested in to review later",action:e.jsx(b,{onClick:()=>i("/app/search"),variant:"primary",size:"md",children:"Browse Jobs"})})}):e.jsxs(n,{onClick:()=>i("/app/saved-jobs"),children:[e.jsx(f,{title:"Saved Jobs",icon:"💾"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:a.total}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"to review"})]}),a.newMatches>0&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-full bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 font-medium",children:["+",a.newMatches," new"]}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"today"})]})]})]})},$=()=>{var x;const{state:l}=y(),t=(x=l.session)==null?void 0:x.user,i=g(),[a,d]=o.useState([]),[h,c]=o.useState(!0);o.useEffect(()=>{m()},[t==null?void 0:t.id]);const m=async()=>{if(!(t!=null&&t.id)||!u){c(!1);return}try{const{data:s}=await u.from("job_search_cache").select("query_params, result_count, created_at").eq("user_id",t.id).order("created_at",{ascending:!1}).limit(3),r=(s==null?void 0:s.map(p=>{var j,v;return{query:((j=p.query_params)==null?void 0:j.query)||"All Jobs",location:((v=p.query_params)==null?void 0:v.location)||"Anywhere",count:p.result_count||0,created_at:p.created_at}}))||[];d(r)}catch(s){console.error("Error loading searches:",s)}finally{c(!1)}};return h?e.jsx(n,{children:e.jsx(k,{})}):a.length===0?e.jsx(n,{children:e.jsx(w,{icon:"🔍",title:"No recent searches",description:"Your job search history will appear here",action:e.jsx(b,{onClick:()=>i("/app/search"),variant:"primary",size:"md",children:"Start Searching"})})}):e.jsxs(n,{children:[e.jsx(f,{title:"Recent Searches",icon:"🔍"}),e.jsx("div",{className:"space-y-2",children:a.map((s,r)=>e.jsx(b,{onClick:()=>i(`/app/search?q=${encodeURIComponent(s.query)}&location=${encodeURIComponent(s.location)}`),variant:"ghost",size:"md",className:"w-full justify-start p-3 h-auto hover:bg-gray-50 dark:hover:bg-slate-700 transition-colors",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"text-left",children:[e.jsxs("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:['"',s.query,'" in ',s.location]}),e.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:[s.count," results"]})]}),e.jsx("svg",{className:"w-4 h-4 text-gray-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})},r))})]})},B=()=>{const l=g(),t={blue:{bg:"bg-blue-50 dark:bg-blue-900/20",hover:"hover:bg-blue-100 dar
1k:hover:bg-blue-900/30",border:"border-blue-200 dark:border-blue-800"},green:{bg:"bg-green-50 dark:bg-green-900/20",hover:"hover:bg-green-100 dark:hover:bg-green-900/30",border:"border-green-200 dark:border-green-800"}},i=[{icon:"🎯",label:"Tailor Resume",path:"/app/tailor",color:"blue"},{icon:"🔍",label:"Search Jobs",path:"/app/search",color:"blue"},{icon:"📊",label:"Track Applications",path:"/app/applications",color:"green"}];return e.jsxs(n,{children:[e.jsx(f,{title:"Quick Actions",icon:"✨"}),e.jsx("div",{className:"grid grid-cols-1 gap-2",children:i.map(a=>{const d=t[a.color]||t.blue;return e.jsxs(b,{onClick:()=>l(a.path),variant:"secondary",size:"md",className:`
2                                justify-start gap-4 p-4 h-auto
3                                ${d.bg}
4                                ${d.hover}
5                                border ${d.border}
6                            `,children:[e.jsx("span",{className:"text-2xl",children:a.icon}),e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:a.label})]},a.path)})})]})},F=()=>{var x;const{state:l}=y(),t=(x=l.session)==null?void 0:x.user,i=g(),[a,d]=o.useState([]),[h,c]=o.useState(!0);o.useEffect(()=>{m()},[t==null?void 0:t.id]);const m=async()=>{if(!(t!=null&&t.id)||!u){c(!1);return}try{const{data:s}=await u.from("applied_jobs").select("id, job_title, company_name, status, applied_date").eq("user_id",t.id).order("applied_date",{ascending:!1}).limit(3);d((s||[]).map(r=>({...r,application_status:r.status||"applied"})))}catch(s){console.error("Error loading recent applications:",s)}finally{c(!1)}};return h?e.jsx(n,{children:e.jsx(k,{})}):a.length===0?e.jsx(n,{children:e.jsx(w,{icon:"🚀",title:"No applications yet",description:"Your recent activity will appear here once you apply to jobs.",action:e.jsx(b,{onClick:()=>i("/app/search"),variant:"primary",size:"md",children:"Find Jobs"})})}):e.jsxs(n,{onClick:()=>i("/app/applications"),children:[e.jsx(f,{title:"Recent Activity",icon:"⚡"}),e.jsx("div",{className:"space-y-3",children:a.map(s=>{var r;return e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl border border-[var(--border-default)]/50 bg-white/50 dark:bg-slate-800/50 backdrop-blur-sm hover:border-blue-500/30 transition-all group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-500/10 flex items-center justify-center text-blue-600 dark:text-blue-400 group-hover:scale-110 transition-transform",children:e.jsx(A,{className:"w-5 h-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-[var(--text-primary)] truncate",children:s.job_title}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]/70 truncate",children:s.company_name})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1",children:[e.jsx("span",{className:"text-[10px] font-medium px-2 py-1 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20 capitalize",children:((r=s.application_status)==null?void 0:r.replace("_"," "))||"Applied"}),e.jsx("span",{className:"text-[10px] text-[var(--text-secondary)]/50",children:s.applied_date?new Date(s.applied_date).toLocaleDateString(void 0,{month:"short",day:"numeric"}):"Recently"})]})]},s.id)})})]})},N=({label:l,value:t,color:i})=>{const a={blue:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",green:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",purple:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border border-indigo-500/20"};return e.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors",children:[e.jsx("span",{className:"text-sm font-medium text-[var(--text-secondary)]",children:l}),e.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-bold ${a[i]}`,children:t})]})};export{J as ApplicationsStatsWidget,B as QuickActionsWidget,F as RecentApplicationsWidget,$ as RecentSearchesWidget,M as SavedJobsWidget};

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.