+
Rentall
@@ -30,82 +30,88 @@ const Navbar: React.FC = () => {
-
- -
-
- Browse Items
+
+
+
+
+ Start Earning
-
- {user && (
-
-
-
- List an Item
-
-
- )}
-
-
- {user ? (
- <>
- -
-
-
- {user.firstName}
-
-
- -
-
- Profile
+
+ {user ? (
+ <>
+ -
+
+
+ {user.firstName}
+
+
+ -
+
+ Profile
+
+
+ -
+
+ My Rentals
+
+
+ -
+
+ My Listings
+
+
+ -
+
+ Messages
+
+
+ -
+
+
+ -
+
+
+
+
+ >
+ ) : (
+ <>
+ -
+
+ Login
- -
-
- My Rentals
+
-
+
+ Sign Up
- -
-
- My Listings
-
-
- -
-
- Messages
-
-
- -
-
-
- -
-
-
-
-
- >
- ) : (
- <>
- -
-
- Login
-
-
- -
-
- Sign Up
-
-
- >
- )}
-
+ >
+ )}
+
+
+
diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx
index c05f762..b8220e0 100644
--- a/frontend/src/pages/Home.tsx
+++ b/frontend/src/pages/Home.tsx
@@ -1,49 +1,141 @@
-import React from 'react';
+import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { useAuth } from '../contexts/AuthContext';
+import { itemAPI } from '../services/api';
+import { Item } from '../types';
const Home: React.FC = () => {
const { user } = useAuth();
+ const [featuredItems, setFeaturedItems] = useState
- ([]);
+ const [loading, setLoading] = useState(true);
+
+ useEffect(() => {
+ const fetchFeaturedItems = async () => {
+ try {
+ const response = await itemAPI.getItems({ limit: 8 });
+ setFeaturedItems(response.data.items);
+ } catch (error) {
+ console.error('Error fetching items:', error);
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ fetchFeaturedItems();
+ }, []);
return (
{/* Hero Section */}
-
-
-
+
+
+
-
+
Rent Anything, From Anyone, Anywhere
-
+
Join the sharing economy. Rent items you need for a fraction of the cost,
or earn money from things you already own.
-
+
Start Renting
{user ? (
-
+
List Your Items
) : (
-
+
Start Earning
)}
-
+ {/* Featured Items Section */}
+
+
+
+
Items for Rent
+
+ View All
+
+
+
+ {loading ? (
+
+ ) : (
+
+ {featuredItems.map((item) => (
+
+
+
+ {item.images && item.images.length > 0 ? (
+

+ ) : (
+
+
+
+ )}
+
+
{item.name}
+
+ {item.location}
+
+
+
+ {item.pricePerDay && (
+
+ ${item.pricePerDay}/day
+
+ )}
+
+
+ {item.owner?.firstName || 'Unknown'}
+
+
+
+
+
+
+ ))}
+
+ )}
+
+ {!loading && featuredItems.length === 0 && (
+
+
No items available for rent yet.
+
+ Be the first to list an item!
+
+
+ )}
+
+
+
{/* How It Works - For Renters */}
-
+
For Renters: Get What You Need, When You Need It
@@ -82,7 +174,7 @@ const Home: React.FC = () => {
{/* How It Works - For Owners */}
-
+
For Owners: Turn Your Idle Items Into Income
@@ -121,7 +213,7 @@ const Home: React.FC = () => {
{/* Popular Categories */}
-
+
Popular Rental Categories
@@ -178,7 +270,7 @@ const Home: React.FC = () => {
{/* Benefits Section */}
-
+
Why Choose Rentall?
@@ -241,30 +333,6 @@ const Home: React.FC = () => {
-
- {/* Stats Section */}
-
-
-
-
-
-
-
$50k+
-
Earned by Owners
-
-
-
4.8★
-
Average Rating
-
-
-
-
);
};