+
+
+
+ Log in
+
+
-
-
-
-
-
-
-
- Or continue with
-
-
+
+
-
-
+
+
+
+
+
+
+
-
- >
- )
+
+
+ );
}
diff --git a/client/src/components/Signup.jsx b/client/src/components/Signup.jsx
new file mode 100644
index 0000000..3bd678b
--- /dev/null
+++ b/client/src/components/Signup.jsx
@@ -0,0 +1,214 @@
+import { useState } from "react";
+import logoImage from "../images/brand-logo-light.svg";
+import { request } from "../tools/requestModule";
+
+export default function SignUp({ slideRun }) {
+ const [email, setEmail] = useState("alien@alianice.com");
+ const [fname, setFname] = useState("alien");
+ const [lname, setLname] = useState("Hikaro");
+ const [password, setPassword] = useState("123456789");
+ const [ConfPassword, setConfPassword] = useState("123456789");
+ const [errPassowrd, setErrPassword] = useState(false);
+ const [error, setError] = useState(null);
+
+ function hodnleSubmit(e) {
+ e.preventDefault();
+ if (password !== ConfPassword) {
+ setErrPassword(true);
+ return;
+ } else {
+ setErrPassword(false);
+ }
+ const requestHeader = {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ first_name: fname,
+ last_name: lname,
+ email,
+ password,
+ }),
+ };
+ request("/register", requestHeader).then((res) => {
+ if (res.status === 201) {
+ slideRun();
+ } else {
+ setError(res.data.error);
+ }
+ });
+ }
+
+ return (
+
+
+
+
+ Create you account
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/client/src/components/moods.jsx b/client/src/components/moods.jsx
index e151bee..b1061da 100644
--- a/client/src/components/moods.jsx
+++ b/client/src/components/moods.jsx
@@ -1,10 +1,14 @@
import React, { useState } from 'react';
import axios from 'axios';
import { useNavigate } from 'react-router-dom';
+import useLocation from "../tools/useLocation.js";
const Moods = () => {
+ const { latitude, longitude, error: locationError } = useLocation();
const [selectedMoods, setSelectedMoods] = useState([]);
const [searchTerm, setSearchTerm] = useState("");
+ const [loadingCombined, setLoadingCombined] = useState(false);
+ const [error, setError] = useState(null);
const navigate = useNavigate();
const moods = [
@@ -51,13 +55,37 @@ const Moods = () => {
const response = await axios.post(`${apiUrl}/movies_by_mood`, { mood: selectedMoods });
const suggestions = response.data.suggestions;
navigate('/AllMovies', {state: { suggestions }});
- console.log('Movie suggestions:', suggestions);
} catch (error) {
console.error('Error fetching movie suggestions:', error);
}
};
+ const handleWeatherAndMoodClick = async () => {
+ try {
+ setLoadingCombined(true);
+ if (latitude && longitude) {
+ const apiUrl = process.env.REACT_APP_API_URL;
+ const response = await axios.post(`${apiUrl}/movies_by_mood_and_weather`, {
+ mood: selectedMoods,
+ latitude,
+ longitude,
+ });
+
+ if (response.data && Array.isArray(response.data.suggestions)) {
+ const suggestions = response.data.suggestions;
+ navigate('/AllMovies', {state: { suggestions }});
+ } else {
+ throw new Error("Unexpected response structure");
+ }
+ }
+ } catch (err) {
+ setError("Error fetching movie data");
+ } finally {
+ setLoadingCombined(false);
+ }
+ };
+
const filteredMoods = moods.filter(mood => mood.name.toLowerCase().includes(searchTerm.toLowerCase()));
return (
@@ -70,7 +98,7 @@ const Moods = () => {
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
-
+
{filteredMoods.map((mood) => (
+
+
+