From f26aae7d665e4f27d7def4f3c26fb9b6f9543100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Fri, 5 Jan 2024 14:30:44 +0100 Subject: [PATCH] refactoring: renamed actions tp billActions --- app/attachment/[id]/route.tsx | 2 +- app/bill/[id]/delete/page.tsx | 2 +- app/bill/[id]/edit/page.tsx | 2 +- app/lib/{actions.ts => billActions.ts} | 0 app/ui/BillEditForm.tsx | 2 +- app/ui/LocationCard.tsx | 20 +++++++++++--------- 6 files changed, 15 insertions(+), 13 deletions(-) rename app/lib/{actions.ts => billActions.ts} (100%) diff --git a/app/attachment/[id]/route.tsx b/app/attachment/[id]/route.tsx index 63bcb38..7485ecc 100644 --- a/app/attachment/[id]/route.tsx +++ b/app/attachment/[id]/route.tsx @@ -1,4 +1,4 @@ -import { fetchBillById } from '@/app/lib/actions'; +import { fetchBillById } from '@/app/lib/billActions'; import { notFound } from 'next/navigation'; export async function GET(request: Request, { params:{ id } }: { params: { id:string } }) { diff --git a/app/bill/[id]/delete/page.tsx b/app/bill/[id]/delete/page.tsx index f24081e..0063355 100644 --- a/app/bill/[id]/delete/page.tsx +++ b/app/bill/[id]/delete/page.tsx @@ -1,4 +1,4 @@ -import { deleteBillById } from '@/app/lib/actions'; +import { deleteBillById } from '@/app/lib/billActions'; import { notFound, redirect } from 'next/navigation'; export default async function Page({ params:{ id } }: { params: { id:string } }) { diff --git a/app/bill/[id]/edit/page.tsx b/app/bill/[id]/edit/page.tsx index da69571..ad2a4d3 100644 --- a/app/bill/[id]/edit/page.tsx +++ b/app/bill/[id]/edit/page.tsx @@ -1,5 +1,5 @@ import { BillingLocation, Bill } from '@/app/lib/db-types'; -import { fetchBillById } from '@/app/lib/actions'; +import { fetchBillById } from '@/app/lib/billActions'; import clientPromise from '@/app/lib/mongodb'; import { BillEditForm } from '@/app/ui/BillEditForm'; import { ObjectId } from 'mongodb'; diff --git a/app/lib/actions.ts b/app/lib/billActions.ts similarity index 100% rename from app/lib/actions.ts rename to app/lib/billActions.ts diff --git a/app/ui/BillEditForm.tsx b/app/ui/BillEditForm.tsx index d5f7bec..39a62f4 100644 --- a/app/ui/BillEditForm.tsx +++ b/app/ui/BillEditForm.tsx @@ -4,7 +4,7 @@ import { DocumentIcon, TrashIcon } from "@heroicons/react/24/outline"; import { Bill } from "../lib/db-types"; import { FC } from "react"; import { useFormState } from "react-dom"; -import { gotoHome, updateOrAddBill } from "../lib/actions"; +import { gotoHome, updateOrAddBill } from "../lib/billActions"; // Next.js does not encode an utf-8 file name correctly when sending a form with a file attachment // This is a workaround for that diff --git a/app/ui/LocationCard.tsx b/app/ui/LocationCard.tsx index 00bfa1a..e3c7155 100644 --- a/app/ui/LocationCard.tsx +++ b/app/ui/LocationCard.tsx @@ -13,15 +13,17 @@ export interface LocationCardProps { export const LocationCard:FC = ({location: { _id, name, yearMonth, bills }}) =>
- -

{formatYearMonth(yearMonth)} {name}

-
- { - bills.map(bill => ) - } - - + + -
+

{formatYearMonth(yearMonth)} {name}

+
+ { + bills.map(bill => ) + } + + + +
; \ No newline at end of file