diff --git a/src/App.css b/src/App.css index f34bf09..6bc035c 100644 --- a/src/App.css +++ b/src/App.css @@ -3,10 +3,6 @@ @tailwind utilities; -.map { - height: 60vh; -} - .loader-dots div { animation-timing-function: cubic-bezier(0, 1, 1, 0); } diff --git a/src/App.jsx b/src/App.jsx index f88af72..967e973 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,13 +1,15 @@ import { useState } from 'react' import MapComponent from './components/Map.jsx' +import Chat from './components/Chat.jsx'; const App = () => { let [places, setPlaces] = useState([]); return ( <> -
- +
+ +
); diff --git a/src/components/Chat.jsx b/src/components/Chat.jsx new file mode 100644 index 0000000..dd37f38 --- /dev/null +++ b/src/components/Chat.jsx @@ -0,0 +1,51 @@ +import { Textarea } from "@headlessui/react"; +import { useState } from "react"; +import generateAi from '../utils/modelConfig.js'; + +const Chat = ({ setPlaces }) => { + + const [prompt, setPrompt] = useState(""); + const [messageSent, setMessageSent] = useState(false); + + const handleChange = (e) => { + setPrompt(e.target.value); + setMessageSent(false); + }; + + const handleSubmit = async (e) => { + e.preventDefault(); + console.log(prompt); + setPrompt(""); + setMessageSent(true); + setPlaces(await generateAi(prompt)) + } + + const handleKeyPress = (e) => { + if (e.key === 'Enter' && !e.shiftKey) { + e.preventDefault(); + handleSubmit(e) + } + } + + return ( +
+
+
+ {/* {prompt} */} +
+
+