Files
aurum/frontend/src/pages/RoiPage.tsx
ZProger fe9b079c12 Initial public release
Aurum — a self-hosted personal finance operating system: cash flow,
net worth tracking, budgets, goals, recurring payments, reports,
proactive alerts, and a compound-interest returns calculator, all
bilingual (RU/EN) and mobile-first. Ships as a three-container Docker
Compose stack (Postgres + FastAPI + nginx-served React frontend).

See README.md for setup and CONTRIBUTING.md for development.
2026-08-16 18:39:52 +03:00

38 lines
1.3 KiB
TypeScript

import { useState } from "react";
import { RoiCalculatorCard } from "@/components/roi/RoiCalculatorCard";
import { RoiProjectionCard } from "@/components/roi/RoiProjectionCard";
export function RoiPage() {
const [investment, setInvestment] = useState("");
const [monthlyIncome, setMonthlyIncome] = useState("");
const investmentAmount = Number(investment);
const monthlyAmount = Number(monthlyIncome);
const hasInputs = investment !== "" && monthlyIncome !== "" && investmentAmount > 0;
const annualIncome = monthlyAmount * 12;
const annualRoiPercent = hasInputs ? (annualIncome / investmentAmount) * 100 : null;
const paybackYears = annualRoiPercent !== null && annualIncome > 0 ? investmentAmount / annualIncome : null;
return (
<div className="space-y-5">
<RoiCalculatorCard
investment={investment}
onInvestmentChange={setInvestment}
monthlyIncome={monthlyIncome}
onMonthlyIncomeChange={setMonthlyIncome}
annualRoiPercent={annualRoiPercent}
paybackYears={paybackYears}
/>
{annualRoiPercent !== null && (
<RoiProjectionCard
investmentAmount={investmentAmount}
annualIncome={annualIncome}
annualRoiPercent={annualRoiPercent}
/>
)}
</div>
);
}