diff --git a/mobile/package-lock.json b/mobile/package-lock.json index 8545c631..88fa910f 100644 --- a/mobile/package-lock.json +++ b/mobile/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "dependencies": { "@expo/metro-runtime": "~3.1.3", + "@react-native-async-storage/async-storage": "1.21.0", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "@react-navigation/stack": "^6.3.29", @@ -25,7 +26,6 @@ "react-native-screens": "~3.29.0", "react-native-web": "~0.19.6", "react-navigation": "^5.0.0", - "react-navigation-stack": "^2.10.4", "zod": "^3.23.5", "zustand": "^4.5.2" }, @@ -3979,6 +3979,17 @@ "url": "https://opencollective.com/unts" } }, + "node_modules/@react-native-async-storage/async-storage": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/@react-native-async-storage/async-storage/-/async-storage-1.21.0.tgz", + "integrity": "sha512-JL0w36KuFHFCvnbOXRekqVAUplmOyT/OuCQkogo6X98MtpSaJOKEAeZnYO8JB0U/RIEixZaGI5px73YbRm/oag==", + "dependencies": { + "merge-options": "^3.0.4" + }, + "peerDependencies": { + "react-native": "^0.0.0-0 || >=0.60 <1.0" + } + }, "node_modules/@react-native-community/cli": { "version": "12.3.6", "resolved": "https://registry.npmjs.org/@react-native-community/cli/-/cli-12.3.6.tgz", @@ -5739,17 +5750,6 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, - "node_modules/@react-native-community/masked-view": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/@react-native-community/masked-view/-/masked-view-0.1.11.tgz", - "integrity": "sha512-rQfMIGSR/1r/SyN87+VD8xHHzDYeHaJq6elOSCAD+0iLagXkSI2pfA0LmSXP21uw5i3em7GkkRjfJ8wpqWXZNw==", - "deprecated": "Repository was moved to @react-native-masked-view/masked-view", - "peer": true, - "peerDependencies": { - "react": ">=16.0", - "react-native": ">=0.57" - } - }, "node_modules/@react-native/assets-registry": { "version": "0.73.1", "resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.73.1.tgz", @@ -10910,6 +10910,14 @@ "node": ">=8" } }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -12315,6 +12323,17 @@ "resolved": "https://registry.npmjs.org/memory-cache/-/memory-cache-0.2.0.tgz", "integrity": "sha512-OcjA+jzjOYzKmKS6IQVALHLVz+rNTMPoJvCztFaZxwG14wtAW7VRZjwTQu06vKCYOxh4jVnik7ya0SXTB0W+xA==" }, + "node_modules/merge-options": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/merge-options/-/merge-options-3.0.4.tgz", + "integrity": "sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ==", + "dependencies": { + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -14442,14 +14461,6 @@ "react-native": "*" } }, - "node_modules/react-native-iphone-x-helper": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz", - "integrity": "sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==", - "peerDependencies": { - "react-native": ">=0.42.0" - } - }, "node_modules/react-native-safe-area-context": { "version": "4.8.2", "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-4.8.2.tgz", @@ -14592,34 +14603,6 @@ "integrity": "sha512-ACTzjc4L1ik7rJ092ZhIELBJ/pnoLgRIqWHSKcYcaBASxyjJCgBEDIV5s585HBj55tw25YwNdlj3+d4B4MYWDg==", "deprecated": "This package is no longer supported. Please use @react-navigation/native instead. See https://reactnavigation.org/docs/getting-started/ for usage guide" }, - "node_modules/react-navigation-stack": { - "version": "2.10.4", - "resolved": "https://registry.npmjs.org/react-navigation-stack/-/react-navigation-stack-2.10.4.tgz", - "integrity": "sha512-3LE1PFsFV9v4PUlZRATMotqs6H7MOOpIKtjyP+l8D1cyzYmsMQh3EFikeDfzGQUXIvy8VyLAMtcEssicQPYvFA==", - "deprecated": "This package is no longer supported. Please use @react-navigation/stack instead. See https://reactnavigation.org/docs/stack-navigator/ for usage guide", - "dependencies": { - "color": "^3.1.3", - "react-native-iphone-x-helper": "^1.3.0" - }, - "peerDependencies": { - "@react-native-community/masked-view": ">=0.1.0", - "react": "*", - "react-native": "*", - "react-native-gesture-handler": ">= 1.5.0", - "react-native-safe-area-context": ">= 0.6.0", - "react-native-screens": ">=1.0.0 || >= 2.0.0-alpha.0 || >= 2.0.0-beta.0 || >= 2.0.0", - "react-navigation": "^4.1.1" - } - }, - "node_modules/react-navigation-stack/node_modules/color": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", - "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", - "dependencies": { - "color-convert": "^1.9.3", - "color-string": "^1.6.0" - } - }, "node_modules/react-refresh": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.0.tgz", @@ -19672,6 +19655,14 @@ "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", "dev": true }, + "@react-native-async-storage/async-storage": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/@react-native-async-storage/async-storage/-/async-storage-1.21.0.tgz", + "integrity": "sha512-JL0w36KuFHFCvnbOXRekqVAUplmOyT/OuCQkogo6X98MtpSaJOKEAeZnYO8JB0U/RIEixZaGI5px73YbRm/oag==", + "requires": { + "merge-options": "^3.0.4" + } + }, "@react-native-community/cli": { "version": "12.3.6", "resolved": "https://registry.npmjs.org/@react-native-community/cli/-/cli-12.3.6.tgz", @@ -20901,13 +20892,6 @@ "joi": "^17.2.1" } }, - "@react-native-community/masked-view": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/@react-native-community/masked-view/-/masked-view-0.1.11.tgz", - "integrity": "sha512-rQfMIGSR/1r/SyN87+VD8xHHzDYeHaJq6elOSCAD+0iLagXkSI2pfA0LmSXP21uw5i3em7GkkRjfJ8wpqWXZNw==", - "peer": true, - "requires": {} - }, "@react-native/assets-registry": { "version": "0.73.1", "resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.73.1.tgz", @@ -24680,6 +24664,11 @@ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==" }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==" + }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -25673,6 +25662,14 @@ "resolved": "https://registry.npmjs.org/memory-cache/-/memory-cache-0.2.0.tgz", "integrity": "sha512-OcjA+jzjOYzKmKS6IQVALHLVz+rNTMPoJvCztFaZxwG14wtAW7VRZjwTQu06vKCYOxh4jVnik7ya0SXTB0W+xA==" }, + "merge-options": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/merge-options/-/merge-options-3.0.4.tgz", + "integrity": "sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ==", + "requires": { + "is-plain-obj": "^2.1.0" + } + }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -27267,12 +27264,6 @@ "prop-types": "^15.7.2" } }, - "react-native-iphone-x-helper": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz", - "integrity": "sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==", - "requires": {} - }, "react-native-safe-area-context": { "version": "4.8.2", "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-4.8.2.tgz", @@ -27320,26 +27311,6 @@ "resolved": "https://registry.npmjs.org/react-navigation/-/react-navigation-5.0.0.tgz", "integrity": "sha512-ACTzjc4L1ik7rJ092ZhIELBJ/pnoLgRIqWHSKcYcaBASxyjJCgBEDIV5s585HBj55tw25YwNdlj3+d4B4MYWDg==" }, - "react-navigation-stack": { - "version": "2.10.4", - "resolved": "https://registry.npmjs.org/react-navigation-stack/-/react-navigation-stack-2.10.4.tgz", - "integrity": "sha512-3LE1PFsFV9v4PUlZRATMotqs6H7MOOpIKtjyP+l8D1cyzYmsMQh3EFikeDfzGQUXIvy8VyLAMtcEssicQPYvFA==", - "requires": { - "color": "^3.1.3", - "react-native-iphone-x-helper": "^1.3.0" - }, - "dependencies": { - "color": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", - "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", - "requires": { - "color-convert": "^1.9.3", - "color-string": "^1.6.0" - } - } - } - }, "react-refresh": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.0.tgz", diff --git a/mobile/package.json b/mobile/package.json index 54135a6f..af5dd40a 100644 --- a/mobile/package.json +++ b/mobile/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "@expo/metro-runtime": "~3.1.3", + "@react-native-async-storage/async-storage": "1.21.0", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "@react-navigation/stack": "^6.3.29", @@ -23,13 +24,12 @@ "react-dom": "18.2.0", "react-native": "0.73.6", "react-native-gesture-handler": "~2.14.0", + "react-native-safe-area-context": "4.8.2", + "react-native-screens": "~3.29.0", "react-native-web": "~0.19.6", "react-navigation": "^5.0.0", - "react-navigation-stack": "^2.10.4", "zod": "^3.23.5", - "zustand": "^4.5.2", - "react-native-screens": "~3.29.0", - "react-native-safe-area-context": "4.8.2" + "zustand": "^4.5.2" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/mobile/src/screens/Home/Home.tsx b/mobile/src/screens/Home/Home.tsx index 7c961fae..04074235 100644 --- a/mobile/src/screens/Home/Home.tsx +++ b/mobile/src/screens/Home/Home.tsx @@ -16,9 +16,7 @@ import DishCard from "@/src/components/Dish"; export const Home = () => { const [searchInput, setSearchInput] = useState(""); - const [results, setResults] = useState([ - { name: "y", country: "y", image: "y" }, - ]); + const [results, setResults] = useState([]); const [searchFocused, setSearchFocused] = useState(false); return ( @@ -50,15 +48,15 @@ export const Home = () => { {/* */} {results.map((dish) => ( ))} - + {/* */} ); }; diff --git a/mobile/src/screens/Registeration/Registration.tsx b/mobile/src/screens/Registeration/Registration.tsx index ee78e89a..f453e970 100644 --- a/mobile/src/screens/Registeration/Registration.tsx +++ b/mobile/src/screens/Registeration/Registration.tsx @@ -22,16 +22,16 @@ export const Registration = () => { const [email, setEmail] = useState(""); // State variable to hold the password const [password, setPassword] = useState(""); - const [firstName, setName] = useState("") - const [lastName, setLastname] = useState("") - const [country, setCountry] = useState("") - const [username, setUsername] = useState("") + const [firstName, setName] = useState(""); + const [lastName, setLastname] = useState(""); + const [country, setCountry] = useState(""); + const [username, setUsername] = useState(""); // State variable to track password visibility const navigation = useNavigation(); const [showPassword, setShowPassword] = useState(false); - const [errors, setErrors] = useState({ email: [], password: [] }) + const [errors, setErrors] = useState({ email: [], password: [] }); // Function to toggle the password visibility state const handleSignup = async () => { try { @@ -43,8 +43,8 @@ export const Registration = () => { lastName, country, }); - // Alert.alert("Success", "You have been registered successfully!"); - navigation.navigate('Login'); // Assuming you have a login screen to navigate to + // Alert.alert("Success", "You have been registered successfully!"); + navigation.navigate("LoginScreen"); // Assuming you have a login screen to navigate to } catch (error) { //Alert.alert("Registration Failed", error.message); } @@ -53,8 +53,6 @@ export const Registration = () => { setShowPassword(!showPassword); }; - - return ( @@ -63,7 +61,7 @@ export const Registration = () => { Sign Up - + Name { /> - - Surname - - setLastname(surName)} - /> - - - - userName - - setUsername(username)} - /> - + + + Username + + setUsername(username)} + /> - - Email - - setEmail(email)} - /> - + + + Email + + setEmail(email)} + /> - - Password - - setPassword(password)} + + + Password + + setPassword(password)} + /> + + - - - - + - - Surname - - setCountry(country)} - /> - + + + Country + + setCountry(country)} + /> - - Sign Up - - - - - + + Sign Up + ); diff --git a/mobile/src/services/search.tsx b/mobile/src/services/search.tsx index abfefde9..14b49ee8 100644 --- a/mobile/src/services/search.tsx +++ b/mobile/src/services/search.tsx @@ -1,6 +1,7 @@ interface Dish { id: string; name: string; + description: string; country: string; image: string; } @@ -12,7 +13,7 @@ export const searchDishes = async (query: string): Promise => { const res = await fetch( BASE_URL + "/api/v1/search/dishes?q=" + encodeURIComponent(query), ); - return await res.json(); + return (await res.json()).data; } catch { throw new Error("Failed to fetch dishes"); }