diff --git a/README.md b/README.md index 074bd2c..c5a0b64 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,10 @@ If you want to contribute financially and help us keep the application free and ## Run locally 1. Clone the repository (or fork it if you intend to contribute) -2. `npm install` -3. Start a PostgreSQL server. You can run `./scripts/start-local-db.sh` if you don’t have a server already. -4. Copy the file `.env.example` as `.env` -5. `npm run dev` +2. Start a PostgreSQL server. You can run `./scripts/start-local-db.sh` if you don’t have a server already. +3. Copy the file `.env.example` as `.env` +4. Run `npm install` to install dependencies. This will also apply database migrations and update Prisma Client. +5. Run `npm run dev` to start the development server ## Run in a container diff --git a/src/app/groups/[groupId]/expenses/expense-list.tsx b/src/app/groups/[groupId]/expenses/expense-list.tsx index b083ab6..0dc7a7e 100644 --- a/src/app/groups/[groupId]/expenses/expense-list.tsx +++ b/src/app/groups/[groupId]/expenses/expense-list.tsx @@ -92,8 +92,15 @@ export function ExpenseList({ <> setSearchText(e.target.value)} /> {Object.values(EXPENSE_GROUPS).map((expenseGroup: string) => { - const groupExpenses = groupedExpensesByDate[expenseGroup] + let groupExpenses = groupedExpensesByDate[expenseGroup] if (!groupExpenses) return null + + groupExpenses = groupExpenses.filter(({ title }) => + title.toLowerCase().includes(searchText.toLowerCase()), + ) + + if (groupExpenses.length === 0) return null + return (
{expenseGroup}
- {groupExpenses - .filter( - (exp) => - exp.title.toLowerCase().match(searchText.toLowerCase()) !== - null, - ) - .map((expense: any) => ( -
{ - router.push( - `/groups/${groupId}/expenses/${expense.id}/edit`, - ) - }} - > - -
-
- {expense.title} -
-
- Paid by{' '} - {getParticipant(expense.paidById)?.name}{' '} - for{' '} - {expense.paidFor.map((paidFor: any, index: number) => ( - - {index !== 0 && <>, } - - { - participants.find( - (p) => p.id === paidFor.participantId, - )?.name - } - - - ))} -
-
-
-
- {currency} {(expense.amount / 100).toFixed(2)} -
-
- {formatDate(expense.expenseDate)} -
-
- + {expense.title} +
+
+ Paid by{' '} + {getParticipant(expense.paidById)?.name}{' '} + for{' '} + {expense.paidFor.map((paidFor: any, index: number) => ( + + {index !== 0 && <>, } + + { + participants.find( + (p) => p.id === paidFor.participantId, + )?.name + } + + + ))} +
- ))} +
+
+ {currency} {(expense.amount / 100).toFixed(2)} +
+
+ {formatDate(expense.expenseDate)} +
+
+ + + ))} ) })}