mirror of
https://github.com/Zproger/Aurum.git
synced 2026-11-05 07:17:22 +07:00
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.
This commit is contained in:
37
frontend/src/pages/RoiPage.tsx
Normal file
37
frontend/src/pages/RoiPage.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user