diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 35eb1ddf..2a1f459e 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/App.js b/App.js index b4eb124c..ad16acf6 100644 --- a/App.js +++ b/App.js @@ -1,10 +1,10 @@ import React from 'react'; import 'react-native-gesture-handler'; -import {NavigationContainer} from '@react-navigation/native'; -import {createStackNavigator} from '@react-navigation/stack'; -import {enableScreens} from 'react-native-screens'; +import { NavigationContainer } from '@react-navigation/native'; +import { createStackNavigator } from '@react-navigation/stack'; +import { enableScreens } from 'react-native-screens'; import SigninPage from './src/screens/SigninPage'; -import SignupPage from './src/screens/SignupPage'; +import SignupPage from './EVAT-Web-Application/src/screens/SignupPage'; import MapPage from './src/pages/MapPage'; enableScreens(); @@ -14,10 +14,22 @@ const Stack = createStackNavigator(); const App = () => { return ( - - - - + + + + ); diff --git a/EVAT-Web-Application b/EVAT-Web-Application new file mode 160000 index 00000000..6ae30972 --- /dev/null +++ b/EVAT-Web-Application @@ -0,0 +1 @@ +Subproject commit 6ae30972aa1d20c30433d889d5118416e82742a2 diff --git a/README.md b/README.md index 66055273..b7931a06 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - +cd front_ # EVAT Mobile Application ## Table of Contents diff --git a/package-lock.json b/package-lock.json index c6aaf942..6d39ca37 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,9 @@ "@react-native/eslint-config": "0.74.87", "@react-native/metro-config": "0.74.87", "@react-native/typescript-config": "0.74.87", + "@types/jest": "^29.5.14", "@types/react": "^18.2.6", + "@types/react-native": "^0.72.8", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "eslint": "^8.19.0", @@ -4235,6 +4237,17 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/jest": { + "version": "29.5.14", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.14.tgz", + "integrity": "sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, "node_modules/@types/json-schema": { "version": "7.0.15", "dev": true, @@ -4269,6 +4282,31 @@ "csstype": "^3.0.2" } }, + "node_modules/@types/react-native": { + "version": "0.72.8", + "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.72.8.tgz", + "integrity": "sha512-St6xA7+EoHN5mEYfdWnfYt0e8u6k2FR0P9s2arYgakQGFgU1f9FlPrIEcj0X24pLCF5c5i3WVuLCUdiCYHmOoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@react-native/virtualized-lists": "^0.72.4", + "@types/react": "*" + } + }, + "node_modules/@types/react-native/node_modules/@react-native/virtualized-lists": { + "version": "0.72.8", + "resolved": "https://registry.npmjs.org/@react-native/virtualized-lists/-/virtualized-lists-0.72.8.tgz", + "integrity": "sha512-J3Q4Bkuo99k7mu+jPS9gSUSgq+lLRSI/+ahXNwV92XgJ/8UgOTxu2LPwhJnBk/sQKxq7E8WkZBnBiozukQMqrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "invariant": "^2.2.4", + "nullthrows": "^1.1.1" + }, + "peerDependencies": { + "react-native": "*" + } + }, "node_modules/@types/react-test-renderer": { "version": "18.3.0", "dev": true, @@ -11778,6 +11816,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/react-native-get-location/-/react-native-get-location-5.0.0.tgz", "integrity": "sha512-IzedYG98V45Z4suLl7GTLZGH+ujn0uvSGP6E5wpJbW/oySHPNJXJUCIFgK2RLhKOClPn/uWBJMvNd7h4ttz3QA==", + "license": "MIT", "peerDependencies": { "react-native": ">=0.60" } diff --git a/package.json b/package.json index 2a520214..1e331ea3 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,9 @@ "@react-native/eslint-config": "0.74.87", "@react-native/metro-config": "0.74.87", "@react-native/typescript-config": "0.74.87", + "@types/jest": "^29.5.14", "@types/react": "^18.2.6", + "@types/react-native": "^0.72.8", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "eslint": "^8.19.0", diff --git a/src/screens/SignupPage.js b/src/screens/SignupPage.js deleted file mode 100644 index 1fc727f4..00000000 --- a/src/screens/SignupPage.js +++ /dev/null @@ -1,247 +0,0 @@ -import React, {useState} from 'react'; -import { ConfigData } from '../data/config'; -import { - View, - Text, - TextInput, - Button, - StyleSheet, - Image, - Switch, - TouchableOpacity, -} from 'react-native'; - -const config = ConfigData(); -const url = `${config.backend.ipAddress}:${config.backend.port}/api/auth/register` - -const SignupPage = ({navigation}) => { - const [fullName, setName] = useState(''); - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); - const [isSubscribed, setIsSubscribed] = useState(false); - - const handleEmailSignup = async () => { - try { - const response = await fetch(url, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({fullName, password, email}), - }); - - const data = await response.json(); - if (response.ok) { - // Handle successful sign-up - console.log('Sign-up successful', data); - navigation.navigate('SignIn') - } else { - // Handle sign-up error - console.log('Sign-up failed', data.message); - } - } catch (error) { - console.error('Error signing up:', error); - } - }; - - const handleGoogleSignup = () => { - // Implement Google sign up logic - }; - - const handleAppleSignup = () => { - // Implement Apple sign up logic - }; - - const toggleSubscription = () => { - setIsSubscribed(previousState => !previousState); - }; - - const clearName = () => setName(''); - const clearEmail = () => setEmail(''); - const clearPassword = () => setPassword(''); - - return ( - - - Create Account - - - - {fullName !== '' && ( - - × - - )} - - - - - {email !== '' && ( - - × - - )} - - - - - {password !== '' && ( - - × - - )} - - - - - I’d like to hear from PlugShare for research, news, and marketing - offers. - - - - - - { - /* Implement Privacy Policy logic */ - }}> - Privacy Policy - - { - /* Implement Terms & Conditions logic */ - }}> - Terms & Conditions - - - - - Next - - - - Sign Up with Google - - - - Sign Up with Apple - - - navigation.navigate('Signin')}> - - Already have an account? Sign In - - - - ); -}; - -const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - paddingHorizontal: 16, - alignItems: 'center', - backgroundColor: '#ffffff', - }, - title: { - fontSize: 24, - marginBottom: 16, - fontWeight: 'bold', - color: '#000', - textAlign: 'center', - fontFamily: 'Inknut Antiqua', - }, - logo: { - width: 100, - height: 100, - marginBottom: 20, - }, - inputContainer: { - flexDirection: 'row', - alignItems: 'center', - marginBottom: 12, - width: '100%', - }, - input: { - flex: 1, - height: 40, - borderColor: 'gray', - borderWidth: 1, - paddingHorizontal: 8, - }, - clearButton: { - borderWidth: 1, - borderColor: 'gray', - borderRadius: 15, - width: 19, - height: 23, - justifyContent: 'center', - alignItems: 'center', - marginLeft: 8, - }, - clearButtonText: { - fontSize: 18, - color: 'gray', - }, - subscriptionContainer: { - flexDirection: 'row', - alignItems: 'center', - marginBottom: 20, - }, - subscriptionText: { - flex: 1, - fontSize: 14, - color: '#000', - }, - legalContainer: { - flexDirection: 'column', - alignItems: 'center', - marginTop: 20, - }, - legalText: { - fontSize: 14, - color: 'blue', - textDecorationLine: 'underline', - marginTop: 10, - }, - appleButton: { - backgroundColor: '#4285F4', - padding: 16, - borderRadius: 8, - marginBottom: 12, - alignItems: 'center', - width: '100%', - }, - termsButton: { - padding: 16, - marginBottom: 12, - alignItems: 'center', - width: '100%', - }, - emailButtonText: { - color: '#ffffff', - fontSize: 14, - }, -}); - -export default SignupPage; diff --git a/src/types/react-native-get-location.d.ts b/src/types/react-native-get-location.d.ts new file mode 100644 index 00000000..c3929e1b --- /dev/null +++ b/src/types/react-native-get-location.d.ts @@ -0,0 +1,23 @@ +declare module 'react-native-get-location' { + interface Location { + latitude: number; + longitude: number; + accuracy?: number; + altitude?: number; + heading?: number; + speed?: number; + time?: number; + } + + interface GetLocationOptions { + enableHighAccuracy?: boolean; + timeout?: number; + } + + const GetLocation: { + getCurrentPosition: (options?: GetLocationOptions) => Promise; + }; + + export default GetLocation; + } + \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 4f5b63bc..32ed4fdf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,11 @@ "extends": "@react-native/typescript-config/tsconfig.json", "compilerOptions": { "target": "ES5", - "module": "CommonJS", - "sourceMap": true + "module": "es2015", + "sourceMap": true, + "typeRoots": ["./node_modules/@types", "./src/types"], + "strict": true + }, + "include": ["src/**/*"] } +