diff --git a/src/app/[locale]/owner/[ownerId]/toys/page.tsx b/src/app/[locale]/owner/[ownerId]/toys/page.tsx index 49b23ff..872a4ea 100644 --- a/src/app/[locale]/owner/[ownerId]/toys/page.tsx +++ b/src/app/[locale]/owner/[ownerId]/toys/page.tsx @@ -92,7 +92,7 @@ export default async function OwnerToysPage({ params }: OwnerToysPageProps) { )} {ownerToys.length > 0 ? ( - ({...toy, dataAiHint: toy.category.toLowerCase()}))} /> + ({...toy, dataAiHint: toy.category.toLowerCase()}))} t={t} /> ) : ( diff --git a/src/app/[locale]/page.tsx b/src/app/[locale]/page.tsx index 2b474a4..67db1b9 100644 --- a/src/app/[locale]/page.tsx +++ b/src/app/[locale]/page.tsx @@ -1,3 +1,4 @@ + import ToyList from '@/components/toys/ToyList'; import { mockToys } from '@/lib/mockData'; import { Button } from '@/components/ui/button'; @@ -36,7 +37,7 @@ export default async function HomePage() {

{t('home.available_toys')}

- ({...toy, dataAiHint: toy.category.toLowerCase()}))} /> + ({...toy, dataAiHint: toy.category.toLowerCase()}))} t={t} /> ); diff --git a/src/components/toys/ToyCard.tsx b/src/components/toys/ToyCard.tsx index 094ac89..1134524 100644 --- a/src/components/toys/ToyCard.tsx +++ b/src/components/toys/ToyCard.tsx @@ -1,3 +1,4 @@ + import Image from 'next/image'; import Link from 'next/link'; import type { Toy } from '@/types'; @@ -6,10 +7,11 @@ import { Button } from '@/components/ui/button'; import { DollarSign, MapPin, Tag } from 'lucide-react'; interface ToyCardProps { - toy: Toy & { dataAiHint?: string }; // dataAiHint is for placeholder, not part of core Toy type + toy: Toy & { dataAiHint?: string }; + t: (key: string) => string; // Add t function prop } -export default function ToyCard({ toy }: ToyCardProps) { +export default function ToyCard({ toy, t }: ToyCardProps) { const primaryImage = toy.images && toy.images.length > 0 ? toy.images[0] : 'https://placehold.co/300x200.png'; const placeholderHint = toy.dataAiHint || toy.category.toLowerCase() || "toy"; @@ -43,7 +45,7 @@ export default function ToyCard({ toy }: ToyCardProps) { {toy.pricePerDay !== undefined && (
- {toy.pricePerDay > 0 ? `${toy.pricePerDay}/day` : 'Free'} + {toy.pricePerDay > 0 ? `$${toy.pricePerDay}${t('toy_details.price_per_day')}` : t('toy_details.price_free')}
)} @@ -51,7 +53,7 @@ export default function ToyCard({ toy }: ToyCardProps) { diff --git a/src/components/toys/ToyList.tsx b/src/components/toys/ToyList.tsx index 06732a6..7c0ecab 100644 --- a/src/components/toys/ToyList.tsx +++ b/src/components/toys/ToyList.tsx @@ -1,19 +1,21 @@ + import type { Toy } from '@/types'; import ToyCard from './ToyCard'; interface ToyListProps { toys: (Toy & { dataAiHint?: string })[]; + t: (key: string) => string; // Add t function prop } -export default function ToyList({ toys }: ToyListProps) { +export default function ToyList({ toys, t }: ToyListProps) { if (!toys || toys.length === 0) { - return

No toys available at the moment. Check back soon!

; + return

{t('home.no_toys_available')}

; // Assuming a key like this or create a new one } return (
{toys.map((toy) => ( - + ))}
); diff --git a/src/locales/en.ts b/src/locales/en.ts index 7f4a374..50c05e6 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -15,6 +15,7 @@ export default { 'home.explore_toys': 'Explore Toys', 'home.share_your_toy': 'Share Your Toy', 'home.available_toys': 'Available Toys', + 'home.no_toys_available': 'No toys available at the moment. Check back soon!', 'login.welcome_back': 'Welcome Back!', 'login.description': 'Log in to your ToyShare account to continue.', 'login.email_label': 'Email Address', diff --git a/src/locales/zh-TW.ts b/src/locales/zh-TW.ts index 4e3cb08..0bab20f 100644 --- a/src/locales/zh-TW.ts +++ b/src/locales/zh-TW.ts @@ -15,6 +15,7 @@ export default { 'home.explore_toys': '探索玩具', 'home.share_your_toy': '分享您的玩具', 'home.available_toys': '現有玩具', + 'home.no_toys_available': '目前沒有可用的玩具。請稍後再回來查看!', 'login.welcome_back': '歡迎回來!', 'login.description': '登入您的 ToyShare 帳戶以繼續。', 'login.email_label': '電子郵件地址',