-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature/df 80 getbudgetbyparams #19
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Little adjustments for titleizing the display on some hard-coded text.
@@ -51,7 +51,7 @@ const AddIncome = ({ totalIncome, setTotalIncome, setTransactions }) => { | |||
id: data.createIncome.id, | |||
vendor: source, | |||
date, | |||
amount: amountCents, | |||
amount: amountCents / 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has an issue with being displayed on Transactions as $5.00 if the user actually wrote $500.00.
Could you look into this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not able to address this today...whoever coded the original logic might be able to lend some advice but there is certainly a disconnect between prop passing and the mutation/queries. This referenced line of code ensures the proper value is sent back through the mutation. Not sure if the issue is closer to data manipulation on the query (for transactions) or just on how it's displayed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's my thought. @trpubz your branch still does not appear have the correct useCreateIncome
or useCreateExpense
mutation that is on main
and main
seems to be functioning correctly updating state just not posting since the mutation merge yesterday.
Here's how the FE app is handling floats for example with totalIncome
:
The getIncomes
hook fetches and returns the income
as a float
Then to avoid rounding errors, the useEffect
handling setting income
state coverts the float into a cents integer:
Then whenever any amount needs to be displayed in the App (income, expenses, transaction etc.) it's formatted into a USD currency string:
This means we need to adhere to how floats are handled on main
.
A few more thoughts:
- Pretty sure this is a bug, it's a matter of this branch not having parts of
main
like theuseMutation
fixes from Friday. - We are allowed to fix bugs, but this is a feature branch.
- Lets leave this alone, I'm at a loss of words to be honest at this point..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one hopefully minor change. The AddIncome displays incorrectly in transactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file seems to just contain the tests @josephlee702 wrote, any particular reason they've been copied from his branch and not left on the Cypress branch?
If you're going to add Cypress tests, make sure they test the component you built.
const userName = "Powdered Toast Man"; | ||
const email = "[email protected]" | ||
|
||
localStorage.setItem('email', email); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can be removed since the localStorage object is not being retrieved anywhere and email
is set in the line above.
const { totalIncomeData } = useGetIncomes(email); | ||
const { totalExpensesData } = useGetExpenses(email); | ||
const { transactionsData } = useGetTransactions(email); | ||
const { cashFlowData } = useGetCashFlow(email); | ||
// const { budgetsData } = useGetBudgetsByParams(month, category, email); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like all other useQuery hooks that retrieve data when the App mounts, the useGetBudgetByParams should follow the DDAU design convention.
export default function PieActiveArc() { | ||
export default function BasicPie({ data }) { | ||
// Validate incoming data - simple example | ||
const isValidData = data && Array.isArray(data) && data.length > 0 && data.every(d => d.hasOwnProperty('value') && typeof d.value === 'number'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the budgetData is properly drilled to this component, the chained conditionals can likely be reduced to something similar in the BarChart MUI component.
@@ -1,48 +1,148 @@ | |||
import React from 'react' | |||
import React, { useState, useRef, useEffect, useMemo } from 'react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused hook.
|
||
const Budget = () => { | ||
return ( | ||
const email = "[email protected]"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire blocked dedicated to fetching budgets and budgetCategories should be be properly drilled through from App. Those states should not be set inside this child component.
setIsDropdownVisible(false); // Hide the modal | ||
}; | ||
// Handler to toggle dropdown visibility | ||
const toggleDropdownVisibility = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider refactoring this to utilize a BasicSelect MUI component, there is no need to make these kinds of functions.
document.addEventListener('mousedown', handleClickOutside); | ||
return () => { | ||
document.removeEventListener('mousedown', handleClickOutside); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BasicSelect component will remove the need for EventListeners like this. VanillaJS in React is not maintainable/conventional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add anything new to this file, it's deprecated.
@@ -51,7 +51,7 @@ const AddIncome = ({ totalIncome, setTotalIncome, setTransactions }) => { | |||
id: data.createIncome.id, | |||
vendor: source, | |||
date, | |||
amount: amountCents, | |||
amount: amountCents / 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's my thought. @trpubz your branch still does not appear have the correct useCreateIncome
or useCreateExpense
mutation that is on main
and main
seems to be functioning correctly updating state just not posting since the mutation merge yesterday.
Here's how the FE app is handling floats for example with totalIncome
:
The getIncomes
hook fetches and returns the income
as a float
Then to avoid rounding errors, the useEffect
handling setting income
state coverts the float into a cents integer:
Then whenever any amount needs to be displayed in the App (income, expenses, transaction etc.) it's formatted into a USD currency string:
This means we need to adhere to how floats are handled on main
.
A few more thoughts:
- Pretty sure this is a bug, it's a matter of this branch not having parts of
main
like theuseMutation
fixes from Friday. - We are allowed to fix bugs, but this is a feature branch.
- Lets leave this alone, I'm at a loss of words to be honest at this point..
Was part of capstone pt.1 - closing. |
Keypoints
Related Issue(s)
closes DF-80
Checklist:
Additional Notes:
Please enusre you pull to local, test localhost rails server and live server