-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
10,592 additions
and
824 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { Metadata } from "next"; | ||
|
||
import Header from "~/components/Header"; | ||
|
||
export default function DashboardLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<div className="flex flex-col"> | ||
<Header /> | ||
{children} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import Link from "next/link"; | ||
import { ArrowLeft, ArrowRight } from "lucide-react"; | ||
|
||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardFooter, | ||
CardHeader, | ||
CardTitle, | ||
} from "~/components/ui/card"; | ||
import { Skeleton } from "~/components/ui/skeleton"; | ||
|
||
export default async function TransactionsPage() { | ||
return ( | ||
<div className="mx-auto w-1/4"> | ||
<Link href="/dashboard"> | ||
<div className="flex items-center"> | ||
<ArrowLeft className="my-4 h-10 w-10" /> | ||
Back | ||
</div> | ||
</Link> | ||
|
||
<Card className="text-center"> | ||
<CardHeader> | ||
<CardTitle> | ||
<Skeleton className="mx-auto mt-3 h-[14px] w-full rounded-full" /> | ||
</CardTitle> | ||
<CardDescription> | ||
<Skeleton className="mx-auto h-[10px] w-1/2 rounded-full" /> | ||
</CardDescription> | ||
</CardHeader> | ||
<CardContent> | ||
<div className="my-4 flex items-center justify-between"> | ||
<Skeleton className=" mx-auto h-[150px] w-[150px] rounded-full" /> | ||
<ArrowRight /> | ||
<Skeleton className=" mx-auto h-[150px] w-[150px] rounded-full" /> | ||
</div> | ||
|
||
<div className="grid gap-2"> | ||
<Skeleton className="mx-auto h-[20px] w-1/4 rounded-full" /> | ||
<Skeleton className="mx-auto h-[20px] w-1/2 rounded-full" /> | ||
<Skeleton className="mx-auto h-[20px] w-1/4 rounded-full" /> | ||
<Skeleton className="mx-auto h-[20px] w-1/3 rounded-full" />{" "} | ||
</div> | ||
</CardContent> | ||
<CardFooter> | ||
<Skeleton className="h-[20px] w-1/2 rounded-full" /> | ||
</CardFooter> | ||
</Card> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import type { Metadata } from "next"; | ||
import Link from "next/link"; | ||
import { formatTransactionValue, formatValue } from "@the-bank/core"; | ||
import dayjs from "dayjs"; | ||
import { ArrowLeft, ArrowRight } from "lucide-react"; | ||
|
||
import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar"; | ||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardFooter, | ||
CardHeader, | ||
CardTitle, | ||
} from "~/components/ui/card"; | ||
import { serverAPIClient } from "~/utils/serverAPIClient"; | ||
|
||
export const metadata: Metadata = { | ||
title: "Transactions", | ||
description: "Example transactions app built using the components.", | ||
}; | ||
|
||
type TransactionsPageProps = { | ||
params: { | ||
id: string; | ||
}; | ||
}; | ||
|
||
export default async function TransactionsPage({ | ||
params, | ||
}: TransactionsPageProps) { | ||
const transaction = await serverAPIClient().admin.getTransaction({ | ||
id: Number(params.id), | ||
}); | ||
|
||
if (!transaction) { | ||
return ( | ||
<div className="mx-auto mt-10 w-1/4"> | ||
<p>Transaction not found</p> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="mx-auto w-1/4"> | ||
<Link href="/dashboard"> | ||
<div className="flex items-center"> | ||
<ArrowLeft className="my-4 h-10 w-10" /> | ||
Back | ||
</div> | ||
</Link> | ||
|
||
<Card className="text-center"> | ||
<CardHeader> | ||
<CardTitle>{transaction.transaction.title}</CardTitle> | ||
<CardDescription>{transaction.transaction.uuid}</CardDescription> | ||
</CardHeader> | ||
<CardContent> | ||
<div className="my-4 flex items-center justify-between"> | ||
<div> | ||
<Avatar className="mx-auto h-[150px] w-[150px]"> | ||
<AvatarImage src={transaction.sender?.imageUrl} alt="Avatar" /> | ||
<AvatarFallback> | ||
{transaction.sender?.firstName?.at(0)} | ||
</AvatarFallback> | ||
</Avatar> | ||
</div> | ||
<ArrowRight /> | ||
<div> | ||
<Avatar className="mx-auto h-[150px] w-[150px]"> | ||
<AvatarImage src={transaction.sender?.imageUrl} alt="Avatar" /> | ||
<AvatarFallback> | ||
{transaction.sender?.firstName?.at(0)} | ||
</AvatarFallback> | ||
</Avatar> | ||
</div> | ||
</div> | ||
<p>TYPE: {transaction.transaction.type}</p> | ||
<p> | ||
BALANCE: {formatValue({ value: transaction.transaction.balance })} | ||
</p> | ||
<p> | ||
Value:{" "} | ||
{formatTransactionValue( | ||
transaction.transaction.value, | ||
transaction.transaction.type, | ||
)} | ||
</p> | ||
<p>TITLE: {transaction.transaction.title}</p> | ||
</CardContent> | ||
<CardFooter> | ||
<p> | ||
Created at{" "} | ||
{dayjs(transaction.transaction?.createdAt).format("DD-MM-YYYY")} | ||
</p> | ||
</CardFooter> | ||
</Card> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.