SophiaLinetti / capstone-project_budget-buddy

https://capstone-project-budget-buddy.vercel.app
2 stars 0 forks source link

#1 Add Incomes and Expenses #2

Open SophiaLinetti opened 7 months ago

SophiaLinetti commented 7 months ago

Value proposition

As a User I want to insert my income and expenses so that I can track my finances in a list

Description

Bildschirmfoto 2024-02-02 um 09 51 52

Acceptance criteria

Tasks

function Form() {
  const [transactions, setTransactions] = useState(data.json);

  // ...
}

Here’s an example of how to create a new component called List in the components folder:

function List() {
  return (
    <ul>
      {transactions.map((transaction) => (
        <li key={transaction.id}>
          {transaction.date} - {transaction.amount} - {transaction.category} - {transaction.incomeOrExpense} - 
            {transaction.description}
        </li>
      ))}
    </ul>

  );
}

Heres an example of data.js initial entries:

export const transactions = [
    {
      id: "1",
      typ: "income",
      amount: 2500,
      date: "2024-01-15",
      description: "McDonalds with my Grandmother"
      category: "food",

    },
    {
      id: "2",
      typ: "expense",
      amount: 50,
      date: "2024-01-16",
      description : "Yoga Session"
      category: "sports",
    },
   ...
]
ahohnsen commented 7 months ago

Your title is somewhat too generic. There could be several types of forms and lists in your app. Please be more specific so you can easily and quickly assign this user story, for example: Add Incomes and Expenses

Just a small hint: You don't need to implement a calendar. If you choose "date" as the type for your input field, a calendar will automatically be displayed to the user when they click on the input field.

💡 Also, you don't need the example code in your tasks. If it helps you, you can of course keep it, but it's not a must.

Additionally, your data model is not correctly written down. As we discussed yesterday, you will either use a JSON/js file or save the data in a constant directly in the component where your useState is. This constant will then simply contain an array of objects.

Example for data.js file:

export const transactions = [
    {
      id: "1",
      typ: "income",
      amount: 2500,
      date: "2024-01-15",
      description: "McDonalds with my Grandmother"
      category: "food",

    },
    {
      id: "2",
      typ: "expense",
      amount: 50,
      date: "2024-01-16",
      description : "Yoga Session"
      category: "sports",
    },
   ...
]