diff --git a/.gitignore b/.gitignore index dad57bbc..6355419a 100644 --- a/.gitignore +++ b/.gitignore @@ -398,4 +398,4 @@ FodyWeavers.xsd *.sln.iml .env -/src/server/CookingApp/appsettings.json +appsettings.json diff --git a/src/client/CookingAppFE/.gitignore b/src/client/CookingAppFE/.gitignore index 05647d55..85978291 100644 --- a/src/client/CookingAppFE/.gitignore +++ b/src/client/CookingAppFE/.gitignore @@ -33,3 +33,7 @@ yarn-error.* # typescript *.tsbuildinfo + +# Prettier +.prettierignore +.prettierrc diff --git a/src/client/CookingAppFE/App.js b/src/client/CookingAppFE/App.js index eeeada86..f433fba7 100644 --- a/src/client/CookingAppFE/App.js +++ b/src/client/CookingAppFE/App.js @@ -1,20 +1,226 @@ -import { StatusBar } from "expo-status-bar"; -import React from "react"; -import { StyleSheet, View } from "react-native"; -import LandingPage from "./components/LandingPage"; +import * as React from 'react'; +import { NavigationContainer } from '@react-navigation/native'; +import { createStackNavigator } from '@react-navigation/stack'; +import Home from './components/Home'; +import LandingPage from './components/LandingPage'; +import Favourite from './components/Favourite'; +import Navigation from './components/Navigation'; +import Sidebar from './components/Sidebar'; +import UserMenu from './components/UserMenu'; +import About from './components/About'; +import Contact from './components/Contacts'; +import Previous from './components/Previous'; +import ArchivedRecipes from './components/ArchivedRecipes'; +import ProfileSettings from './components/ProfileSettings'; +import RecentRecipes from './components/RecentRecipes'; +import Subscription from './components/Subscription'; +import AlergensAndFoodPreferences from './components/AlergensAndFoodPreferences'; +import LanguageAndTheme from './components/LanguageAndTheme'; +import RulesAndPolicies from './components/RulesAndPolicies'; +import { NavigationProvider, useNavigationContext } from './components/NavigationContext'; +import { View } from 'react-native'; +import tw from 'twrnc'; +import { useEffect } from 'react'; + +const Stack = createStackNavigator(); + +const MainStack = () => { + const { setCurrentRoute } = useNavigationContext(); + + return ( + + ({ + focus: () => setCurrentRoute('LandingPage'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('Home'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('Favourite'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('UserMenu'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('About'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('Contact'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('Previous'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('ArchivedRecipes'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('ProfileSettings'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('RecentRecipes'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('Subscription'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('AlergensAndFoodPreferences'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('LanguageAndTheme'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + ({ + focus: () => setCurrentRoute('RulesAndPolicies'), + state: e => { + const route = e.data.state.routes[e.data.state.index].name; + setCurrentRoute(route); + } + })} + /> + + ); +}; export default function App() { return ( - - - - + + + ); } -const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: "#f39c12", - }, -}); +const AppInner = () => { + const { currentRoute } = useNavigationContext(); + + return ( + + + {currentRoute !== 'LandingPage' && } + + {currentRoute !== 'LandingPage' && } + + + + + ); +}; diff --git a/src/client/CookingAppFE/app.json b/src/client/CookingAppFE/app.json index 689ca8a4..af90af3d 100644 --- a/src/client/CookingAppFE/app.json +++ b/src/client/CookingAppFE/app.json @@ -7,7 +7,7 @@ "icon": "./assets/icon.png", "userInterfaceStyle": "light", "splash": { - "image": "./assets/splash.png", + "image": "./assets/Main/splash.png", "resizeMode": "contain", "backgroundColor": "#ffffff" }, @@ -16,7 +16,7 @@ }, "android": { "adaptiveIcon": { - "foregroundImage": "./assets/adaptive-icon.png", + "foregroundImage": "./assets/Main/adaptive-icon.png", "backgroundColor": "#ffffff" } }, diff --git a/src/client/CookingAppFE/assets/HomeMessageBar/arrowUpCircle.png b/src/client/CookingAppFE/assets/HomeMessageBar/arrowUpCircle.png new file mode 100644 index 00000000..7c234fb0 Binary files /dev/null and b/src/client/CookingAppFE/assets/HomeMessageBar/arrowUpCircle.png differ diff --git a/src/client/CookingAppFE/assets/HomeMessageBar/paperClip.png b/src/client/CookingAppFE/assets/HomeMessageBar/paperClip.png new file mode 100644 index 00000000..5bd4dda5 Binary files /dev/null and b/src/client/CookingAppFE/assets/HomeMessageBar/paperClip.png differ diff --git a/src/client/CookingAppFE/assets/Main/adaptive-icon.png b/src/client/CookingAppFE/assets/Main/adaptive-icon.png new file mode 100644 index 00000000..f3e76086 Binary files /dev/null and b/src/client/CookingAppFE/assets/Main/adaptive-icon.png differ diff --git a/src/client/CookingAppFE/assets/Main/icon.png b/src/client/CookingAppFE/assets/Main/icon.png new file mode 100644 index 00000000..63997020 Binary files /dev/null and b/src/client/CookingAppFE/assets/Main/icon.png differ diff --git a/src/client/CookingAppFE/assets/Main/icon2.png b/src/client/CookingAppFE/assets/Main/icon2.png new file mode 100644 index 00000000..c5ec79af Binary files /dev/null and b/src/client/CookingAppFE/assets/Main/icon2.png differ diff --git a/src/client/CookingAppFE/assets/Main/splash.png b/src/client/CookingAppFE/assets/Main/splash.png new file mode 100644 index 00000000..d92559f8 Binary files /dev/null and b/src/client/CookingAppFE/assets/Main/splash.png differ diff --git a/src/client/CookingAppFE/assets/NavigationBar/chat.png b/src/client/CookingAppFE/assets/NavigationBar/chat.png new file mode 100644 index 00000000..71e3da47 Binary files /dev/null and b/src/client/CookingAppFE/assets/NavigationBar/chat.png differ diff --git a/src/client/CookingAppFE/assets/NavigationBar/favorite.png b/src/client/CookingAppFE/assets/NavigationBar/favorite.png new file mode 100644 index 00000000..b62edcb8 Binary files /dev/null and b/src/client/CookingAppFE/assets/NavigationBar/favorite.png differ diff --git a/src/client/CookingAppFE/assets/NavigationBar/previous2.png b/src/client/CookingAppFE/assets/NavigationBar/previous2.png new file mode 100644 index 00000000..d38cd99e Binary files /dev/null and b/src/client/CookingAppFE/assets/NavigationBar/previous2.png differ diff --git a/src/client/CookingAppFE/assets/NavigationBar/user.png b/src/client/CookingAppFE/assets/NavigationBar/user.png new file mode 100644 index 00000000..c4756348 Binary files /dev/null and b/src/client/CookingAppFE/assets/NavigationBar/user.png differ diff --git a/src/client/CookingAppFE/assets/NotUsed/chat.webp b/src/client/CookingAppFE/assets/NotUsed/chat.webp new file mode 100644 index 00000000..e9ae726f Binary files /dev/null and b/src/client/CookingAppFE/assets/NotUsed/chat.webp differ diff --git a/src/client/CookingAppFE/assets/NotUsed/settings.webp b/src/client/CookingAppFE/assets/NotUsed/settings.webp new file mode 100644 index 00000000..29f0780d Binary files /dev/null and b/src/client/CookingAppFE/assets/NotUsed/settings.webp differ diff --git a/src/client/CookingAppFE/assets/NotUsed/settings3.webp b/src/client/CookingAppFE/assets/NotUsed/settings3.webp new file mode 100644 index 00000000..b96d5c79 Binary files /dev/null and b/src/client/CookingAppFE/assets/NotUsed/settings3.webp differ diff --git a/src/client/CookingAppFE/assets/PrintRecipeCard/heart.png b/src/client/CookingAppFE/assets/PrintRecipeCard/heart.png new file mode 100644 index 00000000..552ed9ec Binary files /dev/null and b/src/client/CookingAppFE/assets/PrintRecipeCard/heart.png differ diff --git a/src/client/CookingAppFE/assets/PrintRecipeCard/printer.png b/src/client/CookingAppFE/assets/PrintRecipeCard/printer.png new file mode 100644 index 00000000..01c70c81 Binary files /dev/null and b/src/client/CookingAppFE/assets/PrintRecipeCard/printer.png differ diff --git a/src/client/CookingAppFE/assets/adaptive-icon.png b/src/client/CookingAppFE/assets/adaptive-icon.png deleted file mode 100644 index 49e90e02..00000000 Binary files a/src/client/CookingAppFE/assets/adaptive-icon.png and /dev/null differ diff --git a/src/client/CookingAppFE/assets/cake/lava_cake1.jpg b/src/client/CookingAppFE/assets/cake/lava_cake1.jpg new file mode 100644 index 00000000..10cc9b59 Binary files /dev/null and b/src/client/CookingAppFE/assets/cake/lava_cake1.jpg differ diff --git a/src/client/CookingAppFE/assets/cake/lava_cake2.jpg b/src/client/CookingAppFE/assets/cake/lava_cake2.jpg new file mode 100644 index 00000000..e0c77497 Binary files /dev/null and b/src/client/CookingAppFE/assets/cake/lava_cake2.jpg differ diff --git a/src/client/CookingAppFE/assets/icon.png b/src/client/CookingAppFE/assets/icon.png deleted file mode 100644 index 2bf9bb9b..00000000 Binary files a/src/client/CookingAppFE/assets/icon.png and /dev/null differ diff --git a/src/client/CookingAppFE/assets/previous.png b/src/client/CookingAppFE/assets/previous.png new file mode 100644 index 00000000..50ad8996 Binary files /dev/null and b/src/client/CookingAppFE/assets/previous.png differ diff --git a/src/client/CookingAppFE/assets/splash.png b/src/client/CookingAppFE/assets/splash.png deleted file mode 100644 index 705a99de..00000000 Binary files a/src/client/CookingAppFE/assets/splash.png and /dev/null differ diff --git a/src/client/CookingAppFE/babel.config.js b/src/client/CookingAppFE/babel.config.js index 2900afe9..1e554eaf 100644 --- a/src/client/CookingAppFE/babel.config.js +++ b/src/client/CookingAppFE/babel.config.js @@ -1,6 +1,7 @@ -module.exports = function(api) { +module.exports = function (api) { api.cache(true); return { - presets: ['babel-preset-expo'], + presets: ['babel-preset-expo'] + // plugins: ['tailwindcss-react-native/babel'] }; }; diff --git a/src/client/CookingAppFE/components/About.js b/src/client/CookingAppFE/components/About.js new file mode 100644 index 00000000..a9620b3d --- /dev/null +++ b/src/client/CookingAppFE/components/About.js @@ -0,0 +1,17 @@ +import React from 'react'; +import { View, Text, ScrollView } from 'react-native'; +import tw from 'twrnc'; + +const About = () => { + return ( + + About + This is a sample text. Welcome to [Your Restaurant Name], where culinary passion meets exceptional service. Established in [Year], we are dedicated to bringing you a dining experience like no other. Our menu features a delightful blend of traditional and contemporary dishes, crafted from the freshest ingredients sourced locally and globally. + At [Your Restaurant Name], we believe that food is more than just sustenance; it's a way to connect, celebrate, and create memories. Whether you're here for a casual meal, a special occasion, or just a cup of our signature coffee, we strive to make every visit unforgettable. + Our team of talented chefs and friendly staff are committed to providing you with top-notch service and a warm, inviting atmosphere. We are passionate about what we do, and it shows in every plate we serve. + Thank you for choosing [Your Restaurant Name]. We look forward to welcoming you and sharing our love for food with you. + + ); +}; + +export default About; diff --git a/src/client/CookingAppFE/components/AlergensAndFoodPreferences.js b/src/client/CookingAppFE/components/AlergensAndFoodPreferences.js new file mode 100644 index 00000000..dd33f173 --- /dev/null +++ b/src/client/CookingAppFE/components/AlergensAndFoodPreferences.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { View, Text } from 'react-native'; +import tw from 'twrnc'; + +const ProfileSettings = () => { + return ( + + Alergens And Food Preferences + + ); +}; + +export default ProfileSettings; diff --git a/src/client/CookingAppFE/components/ArchivedRecipes.js b/src/client/CookingAppFE/components/ArchivedRecipes.js new file mode 100644 index 00000000..ebeecb03 --- /dev/null +++ b/src/client/CookingAppFE/components/ArchivedRecipes.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { View, Text } from 'react-native'; +import tw from 'twrnc'; + +const ProfileSettings = () => { + return ( + + Archived Recipes + + ); +}; + +export default ProfileSettings; diff --git a/src/client/CookingAppFE/components/Contacts.js b/src/client/CookingAppFE/components/Contacts.js new file mode 100644 index 00000000..1413d776 --- /dev/null +++ b/src/client/CookingAppFE/components/Contacts.js @@ -0,0 +1,19 @@ +import React from 'react'; +import { View, Text, TextInput, TouchableOpacity } from 'react-native'; +import tw from 'twrnc'; + +const Contacts = () => { + return ( + + Subject + + Message + + + Send + + + ); +}; + +export default Contacts; diff --git a/src/client/CookingAppFE/components/Favourite.js b/src/client/CookingAppFE/components/Favourite.js new file mode 100644 index 00000000..0fef1a36 --- /dev/null +++ b/src/client/CookingAppFE/components/Favourite.js @@ -0,0 +1,16 @@ +import React from 'react'; +import { View, Text } from 'react-native'; +import tw from 'twrnc'; + +const Favourite = () => { + return ( + + Favorite Recipes + + Lava Cake + + + ); +}; + +export default Favourite; diff --git a/src/client/CookingAppFE/components/Home.js b/src/client/CookingAppFE/components/Home.js new file mode 100644 index 00000000..9c1ad626 --- /dev/null +++ b/src/client/CookingAppFE/components/Home.js @@ -0,0 +1,100 @@ +import React, { useEffect } from 'react'; +import { View, Text, Image, FlatList, TextInput, TouchableOpacity, SafeAreaView, ScrollView } from 'react-native'; +import { useNavigation } from '@react-navigation/native'; +import tw from 'twrnc'; +import AsyncStorage from '@react-native-async-storage/async-storage'; + +const Home = () => { + const navigation = useNavigation(); + + useEffect(() => { + const checkToken = async () => { + const token = await AsyncStorage.getItem('token'); + if (!token) { + navigation.navigate('LandingPage'); + } + }; + checkToken(); + }, []); + + const renderPost = () => ( + //if user has not generated a recipe yet + + // + // + // Let's figure out a recipe + // Begin by typing a message + // + + //if user has generated a recipe + + + + To make a delicious lava cake, follow these steps: + 1. Prepare Ingredients: + + • 4 ounces of semi-sweet chocolate{'\n'}• 1/2 cup of unsalted butter{'\n'}• 1 cup of powdered sugar{'\n'}• 2 large eggs{'\n'}• 2 large egg yolks{'\n'}• 1 teaspoon of vanilla extract{'\n'}• 1/4 cup of all-purpose flour + + + 2. Melt Chocolate and Butter: + • In a microwave-safe bowl, melt the chocolate and butter together in 30-second intervals, stirring each time until smooth. + + 3. Combine Ingredients: + + • Whisk in powdered sugar until fully incorporated.{'\n'}• Add eggs and egg yolks, then vanilla, and mix until smooth.{'\n'}• Gently stir in flour until just combined. + + + 4. Prepare Ramekins: + • Grease four 6-ounce ramekins and dust them with cocoa powder.{'\n'}• Divide the batter evenly among the ramekins. + + 5. Bake: + • Preheat your oven to 425°F (220°C).{'\n'}• Place the ramekins on a baking sheet and bake for 12-14 minutes until the edges are firm but the center is still soft. + + + + + Jane Doe + Generate me a picture of this recipe + + + + + + + MasterBot + + + + + + + + Here are some example pictures of Lava Cakes. + + + + Print as a Recipe Card + + + + ); + + return ( + + item.key} contentContainerStyle={tw`flex-grow`} /> + + + + + + + + + + + + + ); +}; + +export default Home; diff --git a/src/client/CookingAppFE/components/LandingPage.js b/src/client/CookingAppFE/components/LandingPage.js index 5d4118f7..cbaf0fc0 100644 --- a/src/client/CookingAppFE/components/LandingPage.js +++ b/src/client/CookingAppFE/components/LandingPage.js @@ -1,66 +1,44 @@ -import Constants from 'expo-constants'; +import React, { useEffect } from 'react'; +import { StyleSheet, Text, View, TouchableOpacity, Image } from 'react-native'; +import { useNavigation } from '@react-navigation/native'; import useAuth from '../hooks/useAuth'; import * as WebBrowser from 'expo-web-browser'; -import { StyleSheet, Text, View, TouchableOpacity, Image, Button, SafeAreaView } from "react-native"; +import tw from 'twrnc'; const tenantId = process.env.EXPO_PUBLIC_TENANT_ID; const clientId = process.env.EXPO_PUBLIC_CLIENT_ID; +const instance = process.env.EXPO_PUBLIC_INSTANCE; +const scopes = process.env.EXPO_PUBLIC_SCOPES.split(' '); WebBrowser.maybeCompleteAuthSession(); const LandingPage = () => { - console.log(clientId, tenantId) + const navigation = useNavigation(); + const { login, token, request, loadToken } = useAuth(clientId, instance, scopes); - const { login, token, request } = useAuth(clientId, tenantId); + useEffect(() => { + loadToken(); + }, []); + + useEffect(() => { + if (token) { + navigation.navigate('Home'); + } + }, [token]); return ( - - - + + + - Let's Get Started - - Easy way to manage all your cooking tasks as easy as tapping your finger - -