diff --git a/frontend/app/(sidebar)/maps/page.tsx b/frontend/app/(sidebar)/maps/page.tsx index 1968213..ceae4d9 100644 --- a/frontend/app/(sidebar)/maps/page.tsx +++ b/frontend/app/(sidebar)/maps/page.tsx @@ -1,13 +1,12 @@ "use client"; import { AnalyticsPanel } from "@/components/map/analytics-panel"; +import { ChatPanel } from "@/components/map/chat-panel"; +import { FiltersPanel } from "@/components/map/filters-panel"; import MapWithSearch from "@/components/map/map-with-search"; import { TopNavigation } from "@/components/navigation/top-navigation"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; -import { Slider } from "@/components/ui/slider"; -import { Switch } from "@/components/ui/switch"; -import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { BarChart2, Bath, @@ -18,7 +17,6 @@ import { Home, MapPin, MessageCircle, - Send, Star, Sun, Wind, @@ -33,32 +31,9 @@ export default function MapsPage() { const [showAnalytics, setShowAnalytics] = useState(false); const [showChat, setShowChat] = useState(false); const [showPropertyInfo, setShowPropertyInfo] = useState(false); - const [activeTab, setActiveTab] = useState("basic"); - const [priceRange, setPriceRange] = useState([5000000, 20000000]); - const [radius, setRadius] = useState(30); - const [message, setMessage] = useState(""); - const [messages, setMessages] = useState([ - { role: "assistant", content: "Hi! How can I help you today?" }, - ]); - const nodeRef = useRef(null); - - const handleSendMessage = () => { - if (message.trim()) { - setMessages([...messages, { role: "user", content: message }]); - // Simulate AI response - setTimeout(() => { - setMessages((prev) => [ - ...prev, - { - role: "assistant", - content: - "I can provide information about properties in this area. Would you like to know about flood risks, air quality, or nearby amenities?", - }, - ]); - }, 1000); - setMessage(""); - } - }; + const analyticsRef = useRef(null); + const filtersRef = useRef(null); + const chatRef = useRef(null); const handlePropertyClick = () => { setShowPropertyInfo(true); @@ -286,241 +261,28 @@ export default function MapsPage() { )} {/* Analytics Panel */} - {showAnalytics && ( - }> -
+ }> +
)} - {/* Filters Panel */} {showFilters && ( -
-
-
- - Property Filters -
-
- -
+ }> +
+
- - - - Basic - Advanced - - - -
-
- -
- setRadius(value[0])} - className="flex-1" - /> - {radius} km -
-
- -
- - -
- -
- - -
- - -
-
- - -
-
- -
- ฿{priceRange[0].toLocaleString()} - ฿{priceRange[1].toLocaleString()} -
- setPriceRange(value)} - /> -
- -
- - -
- Low Flood Risk - -
- -
- Good Air Quality - -
- -
- Low Noise Pollution - -
-
- -
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
- - -
-
-
-
+ )} - {/* Chat Panel */} {showChat && ( -
-
-
- - Chat Assistant -
-
- -
+ }> +
+
- -
- {messages.map((msg, index) => ( -
-
- {msg.content} -
-
- ))} -
- -
-
- setMessage(e.target.value)} - onKeyDown={(e) => { - if (e.key === "Enter") handleSendMessage(); - }} - /> - -
-
-
+ )} {/* Map Legend */} diff --git a/frontend/components/map/chat-panel.tsx b/frontend/components/map/chat-panel.tsx new file mode 100644 index 0000000..01fccf5 --- /dev/null +++ b/frontend/components/map/chat-panel.tsx @@ -0,0 +1,97 @@ +import { MessageCircle, Send, X } from "lucide-react"; +import { useState } from "react"; +import { Button } from "../ui/button"; + +export function ChatPanel({ + setShowChat, +}: { + setShowChat: (show: boolean) => void; +}) { + const [message, setMessage] = useState(""); + const [messages, setMessages] = useState([ + { role: "assistant", content: "Hi! How can I help you today?" }, + ]); + const handleSendMessage = () => { + if (message.trim()) { + setMessages([...messages, { role: "user", content: message }]); + // Simulate AI response + setTimeout(() => { + setMessages((prev) => [ + ...prev, + { + role: "assistant", + content: + "I can provide information about properties in this area. Would you like to know about flood risks, air quality, or nearby amenities?", + }, + ]); + }, 1000); + setMessage(""); + } + }; + return ( +
+
+
+
+ + Chat Assistant +
+
+ +
+
+
+ +
+ {messages.map((msg, index) => ( +
+
+ {msg.content} +
+
+ ))} +
+ +
+
+ setMessage(e.target.value)} + onKeyDown={(e) => { + if (e.key === "Enter") handleSendMessage(); + }} + /> + +
+
+
+ ); +} diff --git a/frontend/components/map/filters-panel.tsx b/frontend/components/map/filters-panel.tsx new file mode 100644 index 0000000..63de04d --- /dev/null +++ b/frontend/components/map/filters-panel.tsx @@ -0,0 +1,175 @@ +import { Filter, X } from "lucide-react"; +import { useState } from "react"; +import { Button } from "../ui/button"; +import { Slider } from "../ui/slider"; +import { Switch } from "../ui/switch"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs"; + +export function FiltersPanel({ + setShowFilters, +}: { + setShowFilters: (show: boolean) => void; +}) { + const [activeTab, setActiveTab] = useState("basic"); + const [priceRange, setPriceRange] = useState([5000000, 20000000]); + const [radius, setRadius] = useState(30); + return ( +
+
+
+
+ + Property Filters +
+
+ +
+
+
+ + + + Basic + Advanced + + + +
+
+ +
+ setRadius(value[0])} + className="flex-1" + /> + {radius} km +
+
+ +
+ + +
+ +
+ + +
+ + +
+
+ + +
+
+ +
+ ฿{priceRange[0].toLocaleString()} + ฿{priceRange[1].toLocaleString()} +
+ setPriceRange(value)} + /> +
+ +
+ + +
+ Low Flood Risk + +
+ +
+ Good Air Quality + +
+ +
+ Low Noise Pollution + +
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
+ ); +}