diff --git a/app/page.tsx b/app/page.tsx index d78d878..90532f7 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,4 +1,3 @@ - import { TbCoinRupee } from 'react-icons/tb'; import Container from './components/Container'; import EmptyState from './components/EmptyState'; @@ -6,39 +5,43 @@ import getListings, { IListingsParams } from './actions/getListings'; import ListingCard from './components/listings/ListingCard'; import getCurrentUser from './actions/getCurrentUser'; -interface HomeProps { - searchParams: IListingsParams +// types.ts + +export interface SafeListing { + id: string; + title: string; + description: string; + price: number; + locationValue: string; + // Add all other fields that 'listing' might contain + createdAt: string; // Make sure to convert dates to string as you're doing in getListings } +interface HomeProps { + searchParams: IListingsParams; +} -const Home = async ({searchParams}: HomeProps)=> { - const listings = await getListings(searchParams) ; +const Home = async ({ searchParams }: HomeProps) => { + const listings = await getListings(searchParams); const currentUser = await getCurrentUser(); - - if(listings.length === 0) { - return ( - - ) + if (listings.length === 0) { + return ; } - - return ( -
- {listings.map((listing) => ( - - ))} -
+ {listings.map((listing: Listing) => ( + + ))} +
- - ) -} + ); +}; -export default Home; \ No newline at end of file +export default Home;