mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
added notes to better understand state management and marked where the functions for updating the DB need to be created
This commit is contained in:
parent
cb89ab2358
commit
dba36b850c
1 changed files with 18 additions and 16 deletions
|
|
@ -64,43 +64,45 @@ export default function PortfolioSettings({
|
|||
const [portfolioName, setPortfolioName] = useState(
|
||||
portfolioSettingsData.name
|
||||
);
|
||||
|
||||
const [portfolioBudget, setPortfolioBudget] = useState<
|
||||
number | string | null
|
||||
>(portfolioSettingsData.budget);
|
||||
|
||||
const [portfolioGoal, setPortfolioGoal] = useState(
|
||||
portfolioSettingsData.goal
|
||||
);
|
||||
|
||||
const [portfolioStatus, setPortfolioStatus] = useState(
|
||||
portfolioSettingsData.status
|
||||
);
|
||||
|
||||
function handleRename() {
|
||||
// API call to rename the portfolio
|
||||
// apiFunction(portfolioName)
|
||||
// Update portfolio function with name is equal to portfolioName
|
||||
router.refresh();
|
||||
}
|
||||
// Renaming functionality
|
||||
|
||||
function handlePortfolioNameChange(e: React.ChangeEvent<HTMLInputElement>) {
|
||||
setPortfolioName(e.target.value);
|
||||
}
|
||||
|
||||
// Last thing we'd need to do is make that update in the db
|
||||
function handleRename() {
|
||||
// API call to rename the portfolio
|
||||
// apiFunction(portfolioName)
|
||||
// Update portfolioName
|
||||
router.refresh();
|
||||
}
|
||||
|
||||
//Change budget functionality
|
||||
const [portfolioBudget, setPortfolioBudget] = useState<
|
||||
number | string | null
|
||||
>(portfolioSettingsData.budget);
|
||||
|
||||
function handlePortfolioBudgetUpdate(e: React.ChangeEvent<HTMLInputElement>) {
|
||||
setPortfolioBudget(Number(e.target.value));
|
||||
}
|
||||
|
||||
function handleBudgetUpdate() {
|
||||
// API call to change the budget
|
||||
// apiFunction(portfolioBudget)
|
||||
// Update portfolio function with budget is equal to portfolioBudget
|
||||
console.log(portfolioBudget);
|
||||
// Update portfolioBudget
|
||||
router.refresh();
|
||||
}
|
||||
|
||||
function handlePortfolioBudgetUpdate(e: React.ChangeEvent<HTMLInputElement>) {
|
||||
setPortfolioBudget(Number(e.target.value));
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="p-4 mt-5 flex justify-center max-w-8xl w-8xl pt-5 bg-gray-50 rounded-lg text-brandblue">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue