feat(i18n): add locale dictionaries and pilot surfaces
This commit is contained in:
@@ -3,11 +3,13 @@ import Link from "next/link"
|
||||
export default function Card({
|
||||
title,
|
||||
total,
|
||||
countLabel,
|
||||
icon,
|
||||
href,
|
||||
}: {
|
||||
title: string
|
||||
total: number
|
||||
countLabel: string
|
||||
icon: React.ReactNode
|
||||
href: string
|
||||
}) {
|
||||
@@ -18,7 +20,9 @@ export default function Card({
|
||||
<div className="mr-4">{icon}</div>
|
||||
<div>
|
||||
<h3 className="text-lg font-medium">{title}</h3>
|
||||
<p className="text-muted-foreground mt-2 text-sm">Total: {total}</p>
|
||||
<p className="text-muted-foreground mt-2 text-sm">
|
||||
{countLabel}: {total}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { getI18n } from "@/i18n/server"
|
||||
import { AssetService } from "@/services/asset.service"
|
||||
import { ItemService } from "@/services/item.service"
|
||||
import { RecipientService } from "@/services/recipient.service"
|
||||
@@ -5,17 +6,20 @@ import { RecipientService } from "@/services/recipient.service"
|
||||
import Card from "./_components/card"
|
||||
|
||||
export default async function Home() {
|
||||
const { dictionary } = await getI18n()
|
||||
const copy = dictionary.dashboardHome
|
||||
const totalItems = await ItemService.findAllItemsCount()
|
||||
const totalAssets = await AssetService.findAllAssetsCount()
|
||||
const totalRecipients = await RecipientService.findAllRecipientsCount()
|
||||
|
||||
return (
|
||||
<div className="container mx-auto p-4">
|
||||
<h1 className="mb-4 text-2xl font-bold">Dashboard</h1>
|
||||
<h1 className="mb-4 text-2xl font-bold">{copy.heading}</h1>
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
<Card
|
||||
title="Total Items"
|
||||
title={copy.cards.items.title}
|
||||
total={totalItems}
|
||||
countLabel={copy.cards.items.countLabel}
|
||||
href="/inventory/items"
|
||||
icon={
|
||||
<svg
|
||||
@@ -37,8 +41,9 @@ export default async function Home() {
|
||||
}
|
||||
/>
|
||||
<Card
|
||||
title="Total Assets"
|
||||
title={copy.cards.assets.title}
|
||||
total={totalAssets}
|
||||
countLabel={copy.cards.assets.countLabel}
|
||||
href="/inventory/assets"
|
||||
icon={
|
||||
<svg
|
||||
@@ -60,8 +65,9 @@ export default async function Home() {
|
||||
}
|
||||
/>
|
||||
<Card
|
||||
title="Total Recipients"
|
||||
title={copy.cards.recipients.title}
|
||||
total={totalRecipients}
|
||||
countLabel={copy.cards.recipients.countLabel}
|
||||
href="/recipients"
|
||||
icon={
|
||||
<svg
|
||||
|
||||
Reference in New Issue
Block a user