diff --git a/package.json b/package.json index 5b95dd0..ddd5164 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "@radix-ui/react-toast": "^1.2.4", "@radix-ui/react-tooltip": "^1.1.6", "@shadcn/ui": "^0.0.4", + "@types/recharts": "^1.8.29", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "i18next": "^24.2.2", @@ -37,6 +38,7 @@ "react-dom": "^19.0.0", "react-hook-form": "^7.54.2", "react-i18next": "^15.4.1", + "recharts": "^2.15.1", "tailwind-merge": "^2.6.0", "tailwindcss-animate": "^1.0.7", "zod": "^3.24.1", diff --git a/src/app/page.tsx b/src/app/page.tsx index 6b43603..f90ef48 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -44,19 +44,19 @@ export default function HomePage() { root.classList.add(theme); }, [theme]); - - useEffect(() => { - if (address) { + useEffect(() => { + if (address) { const role = localStorage.getItem("userRole"); if (role) { setStoredRole(role); registerUserBeforeRedirect(address, role); } else if (!role) { - //fetchUserRole(address); // API Request - setRole("lender"); // for test - console.log("No role found, setting default role: lender"); + // Temporarily using default role. Will use fetchUserRole when API is ready + setRole("lender"); // for test + console.log("No role found, setting default role: lender"); + } } - }, [role, setRole]); + }, [address, setRole]); console.log("ROL EN HOMEPAGE:", role); @@ -71,6 +71,7 @@ export default function HomePage() { } }, [address, role, router]); + // fetchUserRole is temporarily disabled but will be used for API integration const fetchUserRole = async (walletAddress: string) => { try { const response = await fetch(`/users/role?wallet_address=${walletAddress}`); @@ -164,6 +165,7 @@ export default function HomePage() { {/* Test button*/}
diff --git a/src/hooks/use-settings.ts b/src/hooks/use-settings.ts index 0c4bff2..3c645c6 100644 --- a/src/hooks/use-settings.ts +++ b/src/hooks/use-settings.ts @@ -40,6 +40,9 @@ const accountFormSchema = z.object({ language: z.string({ required_error: "Please select a language.", }), + monthlyIncome: z.number().optional().refine((val) => !val || val >= 0, { + message: "Monthly income must be a positive number", + }), }); const notificationsFormSchema = z.object({ @@ -86,6 +89,7 @@ export function useSettingsForm() { name: "", dob: "", language: "", + monthlyIncome: undefined, }, mode: "onChange", }); diff --git a/src/locales/en.json b/src/locales/en.json index 6967a7b..aa38b2e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -138,6 +138,11 @@ "es": "Spanish" } }, + "monthlyIncome": { + "label": "Monthly Income", + "placeholder": "Enter your monthly income", + "description": "Your average monthly income in USD" + }, "submit": "Update Account" } }, @@ -166,7 +171,7 @@ }, "searchBar": { "placeholder": "Search by Borrower or Loan ID" - } + }, "auth": { "common": { "emailLabel": "Email Address", @@ -199,30 +204,30 @@ "successMessage": "Reset instructions have been sent to your email address." } }, - "loanRequests": { - "title": "Loan Requests", - "subtitle": "All Loan Requests", - "description": "A list of all loan requests from borrowers. Review and take action.", - "table": { - "requestId": "Request ID", - "borrower": "Borrower", - "amount": "Amount ($)", - "purpose": "Purpose", - "creditScore": "Credit Score", - "status": "Status", - "actions": "Actions" - } - }, - "status": { - "allStatuses": "All Statuses", - "pending": "Pending", - "under_review": "Under Review", - "approved": "Approved" - }, - "actions": { - "viewDetails": "View details", - "approveRequest": "Approve request", - "rejectRequest": "Reject request", - "contactBorrower": "Contact borrower" + "loanRequests": { + "title": "Loan Requests", + "subtitle": "All Loan Requests", + "description": "A list of all loan requests from borrowers. Review and take action.", + "table": { + "requestId": "Request ID", + "borrower": "Borrower", + "amount": "Amount ($)", + "purpose": "Purpose", + "creditScore": "Credit Score", + "status": "Status", + "actions": "Actions" } + }, + "status": { + "allStatuses": "All Statuses", + "pending": "Pending", + "under_review": "Under Review", + "approved": "Approved" + }, + "actions": { + "viewDetails": "View details", + "approveRequest": "Approve request", + "rejectRequest": "Reject request", + "contactBorrower": "Contact borrower" + } }