1import{u,r as x,j as e,L as l,A as d,B as m,i as f,C as p}from"./index-C5HFcgnI.js";import{g}from"./goal-ivuQYUff.js";import{E as y}from"./EmptyState-CLlhAwBd.js";import{P as v}from"./ProgressBar-5eOSHtbw.js";import{b as N,a as h}from"./formatters-C4ZO0S5q.js";import"./client-Cfb1KgHR.js";const b=({goal:s})=>e.jsx(l,{to:d.VIEW_GOAL.replace(":goalId",s.id),children:e.jsxs(p,{className:"hover:shadow-xl hover:border-primary-light border transition-all duration-200 h-full flex flex-col",children:[e.jsxs("div",{className:"flex-grow",children:[e.jsx("h3",{className:"text-lg font-semibold text-primary",children:s.goalName}),e.jsx("p",{className:"text-sm text-textSecondary mb-2 h-10 overflow-hidden",children:s.description}),e.jsx("div",{className:"text-xs text-textSecondary mb-1",children:s.deadline?`Deadline: ${N(s.deadline)}`:"No deadline set"})]}),e.jsxs("div",{className:"mt-auto",children:[e.jsxs("div",{className:"flex justify-between items-end text-sm mb-1",children:[e.jsx("span",{className:"font-medium text-textPrimary",children:h(s.currentAmount)}),e.jsxs("span",{className:"text-xs text-textSecondary",children:[" of ",h(s.targetAmount)]})]}),e.jsx(v,{value:s.currentAmount,max:s.targetAmount})]})]})}),w=()=>{const{currentUser:s,getText:t,setIsLoading:i,isLoading:n,setError:c,error:r}=u(),[o,j]=x.useState([]);return x.useEffect(()=>{s&&(i(!0),g.getGoalsForUser(s.id).then(j).catch(a=>c(a.message||"Failed to load goals")).finally(()=>i(!1)))},[s,i,c]),e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-primary",children:t("mySavingsGoals")}),e.jsx(l,{to:d.CREATE_GOAL,children:e.jsx(m,{variant:"primary",children:t("createSavingGoal")})})]}),n&&e.jsx("div",{className:"text-center py-10",children:e.jsx(f,{})}),r&&e.jsx(p,{className:"bg-red-50 border-red-400 text-red-700",children:r}),!n&&!r&&o.length===0&&e.jsx(y,{title:t("noGoalsTitle"),description:t("noGoalsDescription"),action:e.jsx(l,{to:d.CREATE_GOAL,children:e.jsx(m,{variant:"secondary",children:t("createFirstGoal")})})}),!n&&!r&&o.length>0&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:o.map(a=>e.jsx(b,{goal:a},a.id))})]})};export{w as MyGoalsPage};
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.