From dbeb57764463fa5a7f3f00a0da005e7d9371e42e Mon Sep 17 00:00:00 2001 From: fkvivid Date: Tue, 9 Dec 2025 21:22:38 -0600 Subject: [PATCH] home --- src/pages/ExplorePage.tsx | 4 +- src/pages/HomePage.tsx | 84 +++++++++++++++++++++++++++++-- src/pages/ProductFormPage.tsx | 11 +++- src/pages/ProfilePage.tsx | 94 +++++++++++++++++++++++++++-------- 4 files changed, 166 insertions(+), 27 deletions(-) diff --git a/src/pages/ExplorePage.tsx b/src/pages/ExplorePage.tsx index d3d1405..e011265 100644 --- a/src/pages/ExplorePage.tsx +++ b/src/pages/ExplorePage.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from "react"; import { MapContainer, TileLayer, Marker, Popup, Tooltip } from "react-leaflet"; import "leaflet/dist/leaflet.css"; -import { Input } from "antd"; +import { Input, Spin } from "antd"; export function ExplorePage() { const [position, setPosition] = useState<[number, number] | null>(null); @@ -23,7 +23,7 @@ export function ExplorePage() { ); }, []); - if (!position) return
Loading map...
; + if (!position) return
; return (
diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index 6751c55..c7dabe3 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -1,8 +1,86 @@ +import { NavLink } from "react-router"; export function HomePage() { return ( - <> - homepage - +
+
+
+
+

FairFree — Fair. Free. For Everyone.

+

+ A community-driven marketplace for sharing items and services with fairness and trust. Discover listings near you, give + away what you no longer need, and connect with neighbors. +

+
+ + Explore listings + + + Create account + +
+
+
+ +
+
+
+
+ + + +
+

Share items

+

Give away items you no longer need to people who can use them.

+
+ +
+
+ + + +
+

Discover near you

+

Browse free listings filtered by location and categories.

+
+ +
+
+ + + +
+

Connect safely

+

Message and coordinate pick-ups with clear, built-in controls.

+
+
+ +
+

How it works

+

+ Post an item with a short description and optional pickup details. Claimers send a request and you choose who to meet. We + encourage clear communication and local meetups in safe public places. +

+
+
+ +
Made with ❤️ by FairFree — share freely, share fairly.
+
+
); } diff --git a/src/pages/ProductFormPage.tsx b/src/pages/ProductFormPage.tsx index df95c22..8e532c7 100644 --- a/src/pages/ProductFormPage.tsx +++ b/src/pages/ProductFormPage.tsx @@ -7,6 +7,7 @@ import { useNavigate } from "react-router"; export function ProductFormPage() { const [form] = Form.useForm(); const [loading, setLoading] = useState(false); + const [locationLoading, setLocationLoading] = useState(false); const [imageFiles, setImageFiles] = useState>(new Map()); const navigate = useNavigate(); @@ -64,6 +65,8 @@ export function ProductFormPage() { return; } + setLocationLoading(true); + navigator.geolocation.getCurrentPosition( (position) => { const { latitude, longitude } = position.coords; @@ -101,9 +104,11 @@ export function ProductFormPage() { longitude, }); message.warning("Unable to auto-detect address components; coordinates were filled."); - }); + }) + .finally(() => setLocationLoading(false)); }, () => { + setLocationLoading(false); message.error("Permission denied. Cannot fill location automatically."); }, ); @@ -215,7 +220,9 @@ export function ProductFormPage() {
- +
diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index eb22d3f..e06f12c 100644 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -15,30 +15,84 @@ export function ProfilePage() { } }, [user, navigate]); + const handleSignOut = () => { + localStorage.removeItem("user"); + localStorage.removeItem("auth_token"); + window.location.reload(); + }; + return ( -
-
-

Profile

+
+
+

My Profile

+
+
+ + {user?.fullName?.charAt(0)} + +
+
+ {user?.fullName || "Anonymous"} +
+
+ {user?.email} +
+
- - {user?.fullName?.charAt(0)} - -
{user?.fullName}
-
{user?.email}
-
+
+
+
+ {/* placeholder */}0 +
+
+ Donations +
+
+
+
+ {/* placeholder */}0 +
+
+ Claims +
+
+
+
+ {/* placeholder */}0 +
+
+ Friends +
+
+
+ + - +
+ +
+
+
+ +
+ +
+
); }