Merge branch 'typescript' into temp
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
82a3b0b5c8
After Width: | Height: | Size: 35 KiB |
@ -0,0 +1,21 @@
|
||||
import { FC} from "react"
|
||||
import { Pressable, Text} from "react-native"
|
||||
import React from "react"
|
||||
import styles from "./style/PickerGreySmall"
|
||||
import RNPickerSelect from "react-native-picker-select";
|
||||
|
||||
export const PickerGreySmall:
|
||||
FC<{ valueChange: any, title: string, donePress?: any, values?: any;}>
|
||||
=
|
||||
({valueChange, donePress, title, values}) =>
|
||||
{
|
||||
return(
|
||||
<RNPickerSelect
|
||||
placeholder={{label:title, value: null}}
|
||||
onValueChange={valueChange}
|
||||
onDonePress={donePress}
|
||||
items={values}
|
||||
style={styles}
|
||||
/>
|
||||
)
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
export default StyleSheet.create(
|
||||
{inputIOS: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: 3,
|
||||
marginTop: 5,
|
||||
borderRadius: 10,
|
||||
backgroundColor: '#2D2C33',
|
||||
paddingHorizontal: 10,
|
||||
fontSize: 16,
|
||||
fontWeight: 'bold',
|
||||
letterSpacing: 0.25,
|
||||
textAlign: 'center',
|
||||
color: 'white',
|
||||
},
|
||||
placeholder: {
|
||||
color: 'white',
|
||||
},
|
||||
},
|
||||
{inputAndroid: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: 3,
|
||||
marginTop: 5,
|
||||
borderRadius: 10,
|
||||
backgroundColor: '#2D2C33',
|
||||
paddingHorizontal: 10,
|
||||
fontSize: 16,
|
||||
fontWeight: 'bold',
|
||||
letterSpacing: 0.25,
|
||||
textAlign: 'center',
|
||||
color: 'white',
|
||||
},
|
||||
placeholder: {
|
||||
color: 'white',
|
||||
},
|
||||
}
|
||||
)
|
@ -1,25 +0,0 @@
|
||||
import { Message } from "./core/message"
|
||||
import { Conversation } from "./core/conversation"
|
||||
import tabSkinApp from './constSkin'
|
||||
import { User } from "./core/User/user";
|
||||
|
||||
|
||||
let UserActu:User=new User("14", "leBg", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, []);
|
||||
let UserTest:User=new User("48", "Wesh Wesh", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[5], tabSkinApp, []);
|
||||
|
||||
let tabMessageTest:Message[]=[
|
||||
new Message("Salut", UserActu, new Date(2022,12,12,11,30,40)),
|
||||
new Message("Wesh", UserTest, new Date(2022,12,13,12,20,40)),
|
||||
new Message("Ca va", UserActu, new Date(2022,12,14, 12, 30, 35)),
|
||||
new Message("Ouais et toi?", UserTest, new Date(2022,12,14,12,35,0)),
|
||||
]
|
||||
|
||||
let tabUS:User[]=[UserActu, UserTest];
|
||||
|
||||
let conv = new Conversation(tabUS, tabMessageTest, "le super nom");
|
||||
|
||||
let tabConv:Conversation[]=[conv];
|
||||
|
||||
export default tabConv;
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
|
||||
const tabNat = [
|
||||
{ label: "France", value: "Français" },
|
||||
{ label: "Allemagne", value: "Allemand" },
|
||||
{ label: "Espagne", value: "Espagnol" },
|
||||
{ label: "Royaume-Uni", value: "Anglais" },
|
||||
{ label: "États-Unis", value: "Américain" },
|
||||
{ label: "Italie", value: "Italien" },
|
||||
]
|
||||
|
||||
export default tabNat;
|
@ -1,14 +0,0 @@
|
||||
import { Skin } from "./core/skin";
|
||||
|
||||
let tabSkinApp:Skin[]=[
|
||||
new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0),
|
||||
new Skin("S0002", "Bob Blue",require('bob_party/assets/BobsSkins/BobBlue.png'), 100),
|
||||
new Skin("S0003", "Bob BW",require('bob_party/assets/BobsSkins/BobBW.png'), 100),
|
||||
new Skin("S0004", "Bob Green",require('bob_party/assets/BobsSkins/BobGreen.png'), 100),
|
||||
new Skin("S0005", "Bob P&T",require('bob_party/assets/BobsSkins/BobPinkTurquoise.png'), 100),
|
||||
new Skin("S0006", "Bob Red",require('bob_party/assets/BobsSkins/BobRed.png'), 100),
|
||||
new Skin("S0007", "Bob Cute",require('bob_party/assets/BobsSkins/BobYellowGreenBlueHeart.png'), 100),
|
||||
]
|
||||
|
||||
|
||||
export default tabSkinApp;
|
@ -1,15 +0,0 @@
|
||||
import { Message } from "./core/message"
|
||||
import { Conversation } from "./core/conversation"
|
||||
import tabSkinApp from './constSkin'
|
||||
import { User } from "./core/User/user";
|
||||
import tabConv from "./constCov";
|
||||
|
||||
|
||||
let UserActu:User=new User("14", "leBg", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, []);
|
||||
let UserTest:User=new User("48", "WeshWesh", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[2], tabSkinApp, []);
|
||||
let Alban:User=new User("17", "Alban", "oui", "ouioui", "homme", new Date(2022,12,12), 555, 667, 12, tabSkinApp[1], tabSkinApp, tabConv);
|
||||
let Fefe63:User=new User("17", "Fefe63", "jesuishm", "ouioui", "homme", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[6], tabSkinApp, []);
|
||||
|
||||
let tabUS:User[]=[UserActu, UserTest, Alban, Fefe63];
|
||||
|
||||
export default tabUS;
|
@ -0,0 +1,26 @@
|
||||
import { loginUser } from '../../redux/features/currentUserSlice';
|
||||
import { updateIncorrectCredentials } from '../../redux/features/credentialErrorsSlice';
|
||||
import tabUS from "../../constUser";
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '../../redux/store';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const checkCredentials = (login: string, password: string, dispatch: any, nav: any) => {
|
||||
if((tabUS.map((User) => User.getUsername()).indexOf(login)) !== -1){
|
||||
let id = (tabUS.map((User) => User.getUsername()).indexOf(login))
|
||||
if ((tabUS.map((User) => User.getUsername()).indexOf(login) === id) && ( tabUS[id].getPassword() === password) ){
|
||||
dispatch(loginUser(tabUS[id]));
|
||||
nav.navigate('HomeTab')
|
||||
}
|
||||
else{
|
||||
dispatch(updateIncorrectCredentials(true))
|
||||
}
|
||||
}
|
||||
else{
|
||||
dispatch(updateIncorrectCredentials(true));
|
||||
}
|
||||
};
|
||||
|
@ -0,0 +1,71 @@
|
||||
|
||||
import { loginUser } from '../../redux/features/currentUserSlice';
|
||||
import tabUS from "../../constUser";
|
||||
import { User } from '../User/user';
|
||||
import { updateAlreadyUsedPseudo,updateImpossibleBirthDate,updateUndefinedBirthDate,updateUndefinedNationality,updateTooLongPseudo,updateUndefinedPseudo,updateUndefinedSex, updateTooShortPassword, updateInvalidPassword, updateInvalidPseudo, updateUndefinedPassword } from '../../redux/features/credentialErrorsSlice';
|
||||
|
||||
function max(array: User[]){
|
||||
let max: string = "";
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
const element = array[index].getId();
|
||||
if (element > max) max = element;
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
|
||||
export const checkNewUserValidity = (login: string, password: string, dateOfBirth: Date, nationality: string, sexe: string, dispatch: any, nav: any) => {
|
||||
let actualDate : number = Date.now();
|
||||
let givenDate : number = dateOfBirth.getTime();
|
||||
let passwordRegex : RegExp = /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-])(?!.*?[.\n\\{}[\],]).{8,}$/;
|
||||
let loginRegex : RegExp = /^[A-Za-z0-9_-]{1,22}$/;
|
||||
|
||||
switch(true){
|
||||
case (login === ''):
|
||||
dispatch(updateUndefinedPseudo(true));
|
||||
break;
|
||||
|
||||
case (password === ''):
|
||||
dispatch(updateUndefinedPassword(true));
|
||||
break;
|
||||
|
||||
case (givenDate == null):
|
||||
dispatch(updateUndefinedBirthDate(true));
|
||||
break;
|
||||
|
||||
case (nationality == ''):
|
||||
dispatch(updateUndefinedNationality(true))
|
||||
break;
|
||||
|
||||
case (sexe == ''):
|
||||
dispatch(updateUndefinedSex(true));
|
||||
break;
|
||||
|
||||
case (login.length > 22):
|
||||
dispatch(updateTooLongPseudo(true));
|
||||
break;
|
||||
|
||||
case (! loginRegex.test(login)):
|
||||
dispatch(updateInvalidPseudo(true));
|
||||
break;
|
||||
|
||||
//ALREADY USED PSEUDO
|
||||
|
||||
case (password.length < 8):
|
||||
dispatch(updateTooShortPassword(true));
|
||||
break;
|
||||
|
||||
case (! passwordRegex.test(password)):
|
||||
dispatch(updateInvalidPassword(true));
|
||||
break;
|
||||
|
||||
case ((actualDate-givenDate) < 409968000000):
|
||||
dispatch(updateImpossibleBirthDate(true));
|
||||
break;
|
||||
|
||||
default:
|
||||
const newUser : User = new User("0",login,password,nationality,sexe,dateOfBirth);
|
||||
dispatch(loginUser(newUser));
|
||||
nav.navigate('HomeTab');
|
||||
}
|
||||
};
|
@ -0,0 +1,174 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit"
|
||||
|
||||
var incorrectCredentialsBool : boolean = false;
|
||||
var tooLongPseudodBool : boolean = false;
|
||||
var tooShortPasswordBool : boolean = false;
|
||||
var invalidPseudoBool : boolean = false;
|
||||
var invalidPasswordBool : boolean = false;
|
||||
var impossibleBirthDateBool : boolean = false;
|
||||
var undefinedPseudoBool : boolean = false;
|
||||
var undefinedPasswordBool : boolean = false;
|
||||
var undefinedBirthDateBool : boolean = false;
|
||||
var undefinedNationalityBool : boolean = false;
|
||||
var undefinedSexBool : boolean = false;
|
||||
var alreadyUsedPseudoBool : boolean = false;
|
||||
|
||||
|
||||
export const credentialErrorsSlice = createSlice({
|
||||
name: "credentialErrors",
|
||||
initialState:{
|
||||
newUserErrorList : {
|
||||
tooLongPseudo: tooLongPseudodBool,
|
||||
tooShortPassword : tooShortPasswordBool,
|
||||
invalidPseudo: invalidPseudoBool,
|
||||
invalidPassword: invalidPasswordBool,
|
||||
impossibleBirthDate: impossibleBirthDateBool,
|
||||
undefinedPseudo: undefinedPseudoBool,
|
||||
undefinedPassword: undefinedPasswordBool,
|
||||
undefinedBirthDate: undefinedBirthDateBool,
|
||||
undefinedNationality: undefinedNationalityBool,
|
||||
undefinedSex: undefinedSexBool,
|
||||
alreadyUsedPseudo: alreadyUsedPseudoBool,
|
||||
},
|
||||
loginErrorList : {
|
||||
incorrectCredentials: incorrectCredentialsBool,
|
||||
}
|
||||
},
|
||||
reducers: {
|
||||
updateIncorrectCredentials: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
incorrectCredentials: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateTooLongPseudo: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
tooShortPseudo: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateTooLongPassword: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
tooLongPassword: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateTooShortPassword: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
tooShortPassword: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateInvalidPseudo: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
invalidPseudo: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateInvalidPassword: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
invalidPassword: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateImpossibleBirthDate: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
impossibleBirthDate: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateUndefinedPseudo: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
undefinedPseudo: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateUndefinedPassword: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
undefinedPassword: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateUndefinedBirthDate: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
undefinedBirthDate: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateUndefinedNationality: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
undefinedNationality: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateUndefinedSex: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
undefinedSex: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
updateAlreadyUsedPseudo: (state, action: PayloadAction<boolean>) => {
|
||||
return {
|
||||
...state,
|
||||
newUserErrorList:{
|
||||
...state.newUserErrorList,
|
||||
alreadyUsedPseudo: action.payload
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { updateIncorrectCredentials } = credentialErrorsSlice.actions
|
||||
export const { updateTooShortPassword } = credentialErrorsSlice.actions
|
||||
export const { updateTooLongPseudo } = credentialErrorsSlice.actions
|
||||
export const { updateTooLongPassword } = credentialErrorsSlice.actions
|
||||
export const { updateInvalidPseudo } = credentialErrorsSlice.actions
|
||||
export const { updateInvalidPassword } = credentialErrorsSlice.actions
|
||||
export const { updateImpossibleBirthDate } = credentialErrorsSlice.actions
|
||||
export const { updateUndefinedPseudo } = credentialErrorsSlice.actions
|
||||
export const { updateUndefinedPassword } = credentialErrorsSlice.actions
|
||||
export const { updateUndefinedBirthDate } = credentialErrorsSlice.actions
|
||||
export const { updateUndefinedNationality } = credentialErrorsSlice.actions
|
||||
export const { updateUndefinedSex } = credentialErrorsSlice.actions
|
||||
export const { updateAlreadyUsedPseudo } = credentialErrorsSlice.actions
|
||||
|
||||
|
||||
|
||||
export default credentialErrorsSlice.reducer;
|
@ -1,29 +1,142 @@
|
||||
// import { StatusBar } from 'expo-status-bar'
|
||||
// import { StyleSheet, View, ImageSourcePropType, Pressable, Text} from 'react-native'
|
||||
// import React from 'react';
|
||||
// import stylesScreen from './style/screens.style'
|
||||
// import { TextInput } from 'react-native-gesture-handler';
|
||||
// import { ButtonGameTypeChoice } from '../components/ButtonGameTypeChoice';
|
||||
|
||||
// import styles from "./style/SignIn.style"
|
||||
|
||||
// function SignUp(props: { navigation: any; }) {
|
||||
// const { navigation } = props
|
||||
// return (
|
||||
// <View style={stylesScreen.container}>
|
||||
// <View style={stylesScreen.bodyCenter}>
|
||||
// <CustomTextInput placeholder={""} text="Pseudo"/>
|
||||
// <CustomTextInput placeholder={""} text="Mot de passe"/>
|
||||
// <CustomTextInput placeholder={""} text="Mot de passe"/>
|
||||
// <CustomTextInput placeholder={""} text="Nationalité"/>
|
||||
// <CustomTextInput placeholder={""} text="Date de naisance"/>
|
||||
// <CustomTextInput placeholder={""} text="Sexe"/>
|
||||
// <Pressable style={styles.button} onPress={navigation.navigate('Home')}>
|
||||
// <Text style={styles.text}>S'inscrire</Text>
|
||||
// </Pressable>
|
||||
// </View>
|
||||
// </View>
|
||||
// );
|
||||
// }
|
||||
|
||||
// export default SignUp
|
||||
import { StatusBar } from 'expo-status-bar'
|
||||
import { StyleSheet, View, ImageSourcePropType, Pressable, Text, Alert} from 'react-native'
|
||||
import React, { useState } from 'react';
|
||||
import stylesScreen from './style/screens.style'
|
||||
import { TextInput } from 'react-native-gesture-handler';
|
||||
import { ButtonGameTypeChoice } from '../components/ButtonGameTypeChoice';
|
||||
import styleScreen from "./style/screens.style";
|
||||
import styles from "./style/SignUp.style";
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { checkNewUserValidity } from '../core/Auth/newUser';
|
||||
import DateTimePicker, { DateTimePickerEvent } from '@react-native-community/datetimepicker';
|
||||
import RNPickerSelect from "react-native-picker-select";
|
||||
import tabSex from '../constSex';
|
||||
import tabNat from '../constNat';
|
||||
import { PickerGreySmall } from '../components/PickerGreySmall';
|
||||
import { loginUser } from '../redux/features/currentUserSlice';
|
||||
import { RootState } from '../redux/store';
|
||||
import { updateImpossibleBirthDate, updateInvalidPassword, updateInvalidPseudo, updateTooLongPseudo, updateTooShortPassword, updateUndefinedBirthDate, updateUndefinedNationality, updateUndefinedPassword, updateUndefinedPseudo, updateUndefinedSex } from '../redux/features/credentialErrorsSlice';
|
||||
import { getSystemErrorMap } from 'util';
|
||||
import RNDateTimePicker from '@react-native-community/datetimepicker';
|
||||
|
||||
function SignUp(props: { navigation: any; }) {
|
||||
const { navigation } = props
|
||||
|
||||
const [pseudo, setPseudo] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [date, setDate] = useState(new Date())
|
||||
|
||||
|
||||
function onDateSelected(event : DateTimePickerEvent, value : Date | undefined) {
|
||||
console.log(value);
|
||||
if (value != undefined) {
|
||||
setDate(value);
|
||||
}
|
||||
}
|
||||
|
||||
const [selectedSex, setSelectedSex] = useState('');
|
||||
const [selectedNationality, setSelectedNationality] = useState('')
|
||||
|
||||
const errorList = useSelector((state: RootState) => state.credentialErrors.newUserErrorList);
|
||||
|
||||
|
||||
const dispatch=useDispatch();
|
||||
|
||||
switch(true){
|
||||
case (errorList.undefinedPseudo):
|
||||
Alert.alert("Veuillez définir un pseudo");
|
||||
dispatch(updateUndefinedPseudo(false));
|
||||
break;
|
||||
|
||||
case (errorList.undefinedPassword):
|
||||
Alert.alert("Veuillez définir un mot de passe");
|
||||
dispatch(updateUndefinedPassword(false));
|
||||
break;
|
||||
|
||||
case (errorList.undefinedBirthDate):
|
||||
Alert.alert("Veuillez définir une date de naissance");
|
||||
dispatch(updateUndefinedBirthDate(false));
|
||||
break;
|
||||
|
||||
case (errorList.undefinedNationality):
|
||||
Alert.alert("Veuillez définir une nationalité");
|
||||
dispatch(updateUndefinedNationality(false))
|
||||
break;
|
||||
|
||||
case (errorList.undefinedSex):
|
||||
Alert.alert("Veuillez définir un sexe");
|
||||
dispatch(updateUndefinedSex(false));
|
||||
break;
|
||||
|
||||
case (errorList.tooLongPseudo):
|
||||
Alert.alert("Votre pseudo ne doit pas dépasser 22 caractères");
|
||||
dispatch(updateTooLongPseudo(false));
|
||||
break;
|
||||
|
||||
case (errorList.invalidPseudo):
|
||||
Alert.alert("Votre pseudo doit contenir uniquement des lettres des chiffres et des - ou _");
|
||||
dispatch(updateInvalidPseudo(false));
|
||||
break;
|
||||
|
||||
//ALREADY USED PSEUDO
|
||||
|
||||
case (errorList.tooShortPassword):
|
||||
Alert.alert("Votre mot de passe doit faire au moins 8 caractères");
|
||||
dispatch(updateTooShortPassword(false));
|
||||
break;
|
||||
|
||||
case (errorList.invalidPassword):
|
||||
Alert.alert("Votre pseudo doit contenir au moins une majuscule, une majuscule, un chiffre et un caractère spécial (#?!@$%^&*-)");
|
||||
dispatch(updateInvalidPassword(false));
|
||||
break;
|
||||
|
||||
case (errorList.impossibleBirthDate):
|
||||
Alert.alert("Vous devez avoir au moins 13 ans");
|
||||
dispatch(updateImpossibleBirthDate(false));
|
||||
break;
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={stylesScreen.container}>
|
||||
<View style={stylesScreen.bodyCenter}>
|
||||
|
||||
<View style={{width: '60%', alignItems: 'center'}}>
|
||||
<Text style={styles.text}>Login</Text>
|
||||
<TextInput style={styles.textInput} placeholder='Login' onChangeText={(val) => setPseudo(val)} autoCapitalize='none' />
|
||||
</View>
|
||||
|
||||
<View style={{width: '60%', alignItems: 'center'}}>
|
||||
<Text style={styles.text}>Password</Text>
|
||||
<TextInput style={styles.textInput} placeholder='Password' onChangeText={(val) => setPassword(val)} autoCapitalize='none' />
|
||||
</View>
|
||||
|
||||
|
||||
<View style={{width: '70%', alignItems: 'center'}}>
|
||||
<Text style={styles.text}>Date de naissance</Text>
|
||||
<View style={{width: 150, margin: 10}}>
|
||||
<RNDateTimePicker onChange={(event, value) => onDateSelected(event, value)} mode='date' value={date} themeVariant='dark'/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={{width: '60%', alignItems: 'center'}}>
|
||||
<Text style={styles.text}>Nationalité</Text>
|
||||
<PickerGreySmall title='Choisir la Nationalité' valueChange={(value:string) =>
|
||||
setSelectedNationality(value)} values={tabNat} />
|
||||
</View>
|
||||
|
||||
<View style={{width: '60%', alignItems: 'center'}}>
|
||||
<Text style={styles.text}>Sexe</Text>
|
||||
<PickerGreySmall title='Choisir le sexe' valueChange={(value:string) => setSelectedSex(value)} values={tabSex} />
|
||||
</View>
|
||||
<Pressable style={styles.button} onPress={() => checkNewUserValidity(pseudo,password,date,selectedNationality,selectedSex, dispatch, navigation)}>
|
||||
<Text style={styles.text}>S'inscrire</Text>
|
||||
</Pressable>
|
||||
<Pressable onPress={() => navigation.navigate('SignIn')}>
|
||||
<Text style={styles.textLink}>J'ai déjà un compte</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export default SignUp
|
||||
|
@ -0,0 +1,35 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
|
||||
export default StyleSheet.create({
|
||||
textInput: {
|
||||
width: '100%',
|
||||
height: '5%',
|
||||
backgroundColor: 'white',
|
||||
padding: 10,
|
||||
marginTop: 10,
|
||||
},
|
||||
button: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: 50,
|
||||
width: 225,
|
||||
margin:'10%',
|
||||
borderRadius: 10,
|
||||
elevation: 3,
|
||||
backgroundColor: '#0085FF',
|
||||
},
|
||||
text: {
|
||||
fontSize: 16,
|
||||
lineHeight: 21,
|
||||
fontWeight: 'bold',
|
||||
letterSpacing: 0.25,
|
||||
color: 'white',
|
||||
},
|
||||
textLink:{
|
||||
fontSize:15,
|
||||
color:'white',
|
||||
textDecorationLine:"underline",
|
||||
},
|
||||
})
|
||||
|
@ -1,12 +0,0 @@
|
||||
import { GameSolo } from "./core/gameSolo";
|
||||
|
||||
let myMap = new Map<number, number>([
|
||||
[50, 3],
|
||||
[75, 4],
|
||||
[100, 5],
|
||||
[150, 6]
|
||||
]);
|
||||
|
||||
let game=new GameSolo("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, myMap);
|
||||
|
||||
export default game;
|
@ -1,108 +0,0 @@
|
||||
#Drop all the tables
|
||||
|
||||
DROP TABLE Battle;
|
||||
DROP TABLE Own;
|
||||
DROP TABLE Message;
|
||||
DROP TABLE Belong;
|
||||
DROP TABLE ConvGroup;
|
||||
DROP TABLE User;
|
||||
DROP TABLE Skin;
|
||||
DROP TABLE Game;
|
||||
|
||||
|
||||
|
||||
|
||||
#Create the User table
|
||||
|
||||
CREATE TABLE User (
|
||||
ID char(5) PRIMARY KEY,
|
||||
Username varchar(20) NOT NULL,
|
||||
Password varchar(20) NOT NULL,
|
||||
Nationality varchar(20) NOT NULL,
|
||||
Sex char(1) NOT NULL,
|
||||
DateOfBirth date NOT NULL,
|
||||
CurrentBobCoins bigint(255) DEFAULT 0,
|
||||
TotalBobCoins bigint(255) DEFAULT 0,
|
||||
NbGamePlayed bigint(255) DEFAULT 0
|
||||
);
|
||||
|
||||
|
||||
|
||||
#Create the Skin table
|
||||
|
||||
CREATE TABLE Skin (
|
||||
ID char(5) PRIMARY KEY,
|
||||
Name varchar(20) UNIQUE NOT NULL,
|
||||
Image varchar(20) UNIQUE NOT NULL
|
||||
);
|
||||
|
||||
|
||||
|
||||
#Create the Own table
|
||||
|
||||
CREATE TABLE Own (
|
||||
IDSkin char(5),
|
||||
IDUser char(5),
|
||||
CONSTRAINT FK_Skin FOREIGN KEY (IDSkin) REFERENCES User(ID),
|
||||
CONSTRAINT FK_User FOREIGN KEY (IDUser) REFERENCES Skin(ID),
|
||||
PRIMARY KEY (IDUser, IDSkin)
|
||||
);
|
||||
|
||||
|
||||
|
||||
#Create the Game table
|
||||
|
||||
CREATE TABLE Game (
|
||||
ID char(5) PRIMARY KEY,
|
||||
Name varchar(20) UNIQUE NOT NULL
|
||||
);
|
||||
|
||||
|
||||
|
||||
#Create the Match table
|
||||
|
||||
CREATE TABLE Battle (
|
||||
ID char(5) PRIMARY KEY,
|
||||
Winner char(5) NOT NULL,
|
||||
Loser char(5) NOT NULL,
|
||||
Game char(5) NOT NULL,
|
||||
CONSTRAINT Fk_Winner FOREIGN KEY (Winner) REFERENCES User(ID),
|
||||
CONSTRAINT Fk_Loser FOREIGN KEY (Loser) REFERENCES User(ID),
|
||||
CONSTRAINT Fk_Game FOREIGN KEY (Game) REFERENCES Game(ID)
|
||||
);
|
||||
|
||||
|
||||
|
||||
#Create the Group table
|
||||
|
||||
CREATE TABLE ConvGroup (
|
||||
ID char(5) PRIMARY KEY,
|
||||
Name varchar(20) NOT NULL
|
||||
);
|
||||
|
||||
|
||||
|
||||
#Create the Message table
|
||||
|
||||
CREATE TABLE Message (
|
||||
ID char(5) PRIMARY KEY,
|
||||
Message text NOT NULL,
|
||||
IDSender char(5) NOT NULL,
|
||||
IDUserReceiver char(5),
|
||||
IDGroupReceiver char(5),
|
||||
CONSTRAINT Fk_Sender FOREIGN KEY (IDSender) REFERENCES User(ID),
|
||||
CONSTRAINT Fk_UsRec FOREIGN KEY (IDUserReceiver) REFERENCES User(ID),
|
||||
CONSTRAINT Fk_GrRec FOREIGN KEY (IDGroupReceiver) REFERENCES ConvGroup(ID)
|
||||
);
|
||||
|
||||
|
||||
|
||||
#Create the Belong Table
|
||||
|
||||
CREATE TABLE Belong (
|
||||
IDUser char(5),
|
||||
IDGroup char(5),
|
||||
CONSTRAINT Fk_UserID FOREIGN KEY (IDUser) REFERENCES User(ID),
|
||||
CONSTRAINT Fk_Group FOREIGN KEY (IDGroup) REFERENCES ConvGroup(ID),
|
||||
PRIMARY KEY (IDUser, IDGroup)
|
||||
);
|
Loading…
Reference in new issue