Преглед на файлове

Elimine los homeScreen files que sobraban

ErnestoOrtiz2 преди 2 години
родител
ревизия
d12d8574ef
променени са 4 файла, в които са добавени 0 реда и са изтрити 385 реда
  1. 0
    88
      Home_page.js
  2. 0
    128
      screens/AvailabilityScreen.js
  3. 0
    142
      screens/HomeScreen.js
  4. 0
    27
      screens/main/Home_page.js

+ 0
- 88
Home_page.js Целия файл

@@ -1,88 +0,0 @@
1
-
2
-import React, {useState, useEffect} from 'react'
3
-import { Button, Text, View, StyleSheet} from 'react-native'
4
-import {FlatList, ListViewBase } from 'react-native'
5
-import {TouchableOpacity} from 'react-native-gesture-handler'
6
-import {List, Divider} from 'react-native-paper'
7
-import Loading from './Loading'
8
-import firebase from 'firebase';
9
-import { styles } from "../config/styles";
10
-import { TextInput, TouchableWithoutFeedback, Keyboard, ImageBackground} from "react-native";
11
-
12
-export default function Home_page({navigation}) {
13
-  const [threads, setThreads] = useState([]);  
14
-  const [loading, setLoading] = useState(true);
15
-
16
-  useEffect(() => {
17
-
18
-    const fire = firebase.firestore()
19
-    .collection('THREADS')
20
-    
21
-    .onSnapshot(querySnapshot => {
22
-      const threads = querySnapshot.docs.map(documentSnapshot => {
23
-        return{
24
-          _id:documentSnapshot.id,
25
-          name:'',
26
-          ...documentSnapshot.data()
27
-        };
28
-
29
-      });
30
-
31
-      setThreads(threads);
32
-
33
-      if(loading){
34
-        setLoading(false);
35
-      }
36
-
37
-    });
38
-
39
-    return () => fire();
40
-  }, []);
41
-  
42
-  if (loading) {
43
-    return <Loading />;
44
-  }
45
-  
46
-  return (
47
-    <View>
48
-    <ImageBackground style={styles.stdcontainer} source={require('../assets/yellow-white.jpg')}>
49
-        <FlatList
50
-          data={threads}
51
-          keyExtractor = {item => item._id}
52
-          ItemSeparatorComponent={() => <Divider />}
53
-          renderItem = {({item}) => (
54
-
55
-            <TouchableOpacity
56
-            onPress={() => navigation.navigate('Room', {thread: item})}
57
-            
58
-            >
59
-            <List.Item
60
-              title={item.name}
61
-              description='Item description'
62
-              titleNumberOfLines={1}
63
-              titleStyle={styles.listTitle}
64
-              descriptionStyle={styles.listDescription}
65
-              descriptionNumberOfLines={1}
66
-            />
67
-          </TouchableOpacity>
68
-        )}
69
-      />
70
-
71
-      <Button
72
-        title='Ver mensajes'
73
-        onPress={() => navigation.navigate('Add')}
74
-      />
75
-
76
-        <Button
77
-        title ='Hacer Busqueda'
78
-        onPress= {() => navigation.navigate('Room')}
79
-        />
80
-        </ImageBackground>
81
-      </View>
82
-    );
83
-  }
84
-
85
-
86
-
87
-
88
-

+ 0
- 128
screens/AvailabilityScreen.js Целия файл

@@ -1,128 +0,0 @@
1
-import React, { Component } from "react";
2
-import { TextInput, TouchableWithoutFeedback, Keyboard, ImageBackground, Image, View, Text, Button } from "react-native";
3
-import firebase from "firebase";
4
-import { Calendar } from "react-native-calendars";
5
-import { ScrollView } from "react-native-gesture-handler";
6
-import SectionedMultiSelect from 'react-native-sectioned-multi-select';
7
-import Icon from 'react-native-vector-icons/MaterialIcons';
8
-import { connect } from 'react-redux';
9
-import { bindActionCreators } from 'redux';
10
-
11
-import { fetchUser } from "../redux/actions";
12
-import { styles } from "../config/styles";
13
-import { availability } from "../config/availability";
14
-
15
-export class AvailabilityScreen extends Component {
16
-    constructor(props) {
17
-        super(props);
18
-        this.state = {
19
-            english: false,
20
-            spanish: false,
21
-            virtual: false,
22
-            face_to_face: false,
23
-            personal: false,
24
-            group: false,
25
-            cities: [],
26
-            selectedItems: [],
27
-            markedDates: {}
28
-        };
29
-        this.onSelectedItemsChange = this.onSelectedItemsChange.bind(this);
30
-        this.onDaySelect = this.onDaySelect.bind(this);
31
-        this.onSave = this.onSave.bind(this);
32
-    };
33
-
34
-    componentDidMount(){
35
-        this.props.fetchUser();
36
-        const { currentUser } = this.props;
37
-
38
-        if(currentUser.english !== undefined){
39
-            this.setState(currentUser);
40
-        }
41
-    };
42
-
43
-    onSave(){
44
-        const { selectedItems } = this.state;
45
-    
46
-        selectedItems.forEach((value) => {
47
-            if(value === 'English'){
48
-                this.setState({english : true}, () => firebase.firestore().collection('Interpreters').doc(firebase.auth().currentUser.uid).set({english : true}, {merge : true}));
49
-            }
50
-            else if(value === 'Spanish'){
51
-                this.setState({spanish : true}, () => firebase.firestore().collection('Interpreters').doc(firebase.auth().currentUser.uid).set({spanish : true}, {merge : true}));
52
-            }
53
-            else if(value === 'Virtual'){
54
-                this.setState({virtual : true}, () => firebase.firestore().collection('Interpreters').doc(firebase.auth().currentUser.uid).set({virtual : true}, {merge : true}));
55
-            }
56
-            else if(value === 'Face-to-Face'){
57
-                this.setState({face_to_face : true}, () => firebase.firestore().collection('Interpreters').doc(firebase.auth().currentUser.uid).set({face_to_face : true}, {merge : true}));
58
-            }
59
-            else if(value === 'Personal Session'){
60
-                this.setState({personal : true}, () => firebase.firestore().collection('Interpreters').doc(firebase.auth().currentUser.uid).set({personal : true}, {merge : true}));
61
-            }
62
-            else if(value === 'Group Session'){
63
-                this.setState({group : true}, () => firebase.firestore().collection('Interpreters').doc(firebase.auth().currentUser.uid).set({group : true}, {merge : true}));
64
-            }
65
-            else if(!isNaN(value.charAt(0))){
66
-                for (let key in this.state.markedDates) {
67
-                    if(this.state.markedDates[key].hasOwnProperty('timeSlot')){
68
-                        this.state.markedDates[key].timeSlot.push(value);
69
-                    }
70
-                    else{
71
-                        this.state.markedDates[key].timeSlot = [];
72
-                        this.state.markedDates[key].timeSlot.push(value);
73
-                    }
74
-                }
75
-            }
76
-            else{
77
-                this.state.cities.push(value);
78
-            }
79
-        })
80
-        firebase.firestore().collection('Interpreters')
81
-            .doc(firebase.auth().currentUser.uid)
82
-            .set(this.state, {merge : true})
83
-            .then(() => {this.props.navigation.goBack()});
84
-    };
85
-
86
-    onSelectedItemsChange = (selectedItems) => {
87
-        this.setState({selectedItems});
88
-    };
89
-
90
-    onDaySelect = (day) => {
91
-        const selectedDay = day.dateString;
92
-        let selected = true;
93
-
94
-        if (this.state.markedDates[selectedDay]) {
95
-            selected = !this.state.markedDates[selectedDay].selected;
96
-        }
97
-        const updatedMarkedDates = {...this.state.markedDates, ...{ [selectedDay]: { selected } } }
98
-        this.setState({ markedDates : updatedMarkedDates });
99
-    }
100
-
101
-    render() {
102
-        return (
103
-            <ScrollView contentContainerstyle={styles.stdcontainer}>
104
-                <Calendar
105
-                    onDayPress={this.onDaySelect}
106
-                    style={styles.calendar}
107
-                    markedDates={this.state.markedDates}
108
-                    theme={{selectedDayBackgroundColor: 'green'}}
109
-                />
110
-                <SectionedMultiSelect 
111
-                    items={availability}
112
-                    IconRenderer={Icon}
113
-                    readOnlyHeadings={true}
114
-                    uniqueKey='name'
115
-                    subKey='children'
116
-                    selectText='Choose your availability...'
117
-                    onSelectedItemsChange={this.onSelectedItemsChange}
118
-                    selectedItems={this.state.selectedItems}
119
-                />
120
-                <Button title='Save' onPress={() => {this.onSave()}}/>
121
-            </ScrollView>
122
-        );
123
-    }
124
-}
125
-
126
-const mapStateProps = (store) => ({currentUser : store.userState.currentUser})
127
-const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch)
128
-export default connect(mapStateProps, mapDispatchProps)(AvailabilityScreen)

+ 0
- 142
screens/HomeScreen.js Целия файл

@@ -1,142 +0,0 @@
1
-import React, { Component } from 'react';
2
-import { connect } from 'react-redux';
3
-import { bindActionCreators } from 'redux';
4
-import firebase from 'firebase';
5
-import { Text, View, ImageBackground } from 'react-native';
6
-import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
7
-
8
-import { fetchUser } from '../redux/actions/index'
9
-//import Loading from '../components/Loading'
10
-import Loading from './main/Loading'
11
-import { styles } from '../config/styles'
12
-
13
-export class HomeScreen extends Component {
14
-  constructor(props){
15
-    super(props);
16
-    this.state = {
17
-      interpreter: false,
18
-    };
19
-    this.onLogout = this.onLogout.bind(this)
20
-  };
21
-
22
-  componentDidMount(){
23
-    this.props.fetchUser();
24
-    firebase.firestore()
25
-    .collection("Interpreters")
26
-    .doc(firebase.auth().currentUser.uid)
27
-    .get()
28
-    .then((snapshot) => {
29
-      if(snapshot.exists){
30
-        this.setState({interpreter: true})
31
-      }
32
-    })
33
-  }
34
-
35
-  onLogout(){
36
-    firebase.auth().signOut();
37
-  }
38
-
39
-  render() {
40
-    const { currentUser } = this.props;
41
-
42
-    if(currentUser == undefined){
43
-      return <Loading/>
44
-    }
45
-    if(this.state.interpreter){
46
-      return(
47
-        <View style={styles.regcontainer}>
48
-          <ImageBackground style={styles.home} source={require("../assets/yellow-white.jpg")}>
49
-            <View style={styles.homeTopView}>
50
-              <MaterialIcons name='logout' size={30} color='dodgerblue' onPress={() => this.onLogout()}/>
51
-              <MaterialIcons name='event' size={30} color='dodgerblue' style={styles.homeIcon} onPress={() => this.props.navigation.navigate('Availability')}/>
52
-              <MaterialIcons name='mail' size={30} color='dodgerblue' onPress={() => this.props.navigation.navigate('Mail')}/>
53
-            </View>
54
-          </ImageBackground>
55
-          <View style={styles.regcontainer}></View>
56
-        </View>
57
-      );
58
-    }
59
-    else{
60
-      return(
61
-        <View style={styles.regcontainer}><Text>You are a user</Text></View>
62
-      );
63
-    }
64
-  }
65
-}
66
-
67
-const mapStateProps = (store) => ({currentUser: store.userState.currentUser})
68
-const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch)
69
-export default connect(mapStateProps, mapDispatchProps)(HomeScreen)
70
-
71
-/*export default function HomeScreen({navigation}) {
72
-  const [threads, setThreads] = useState([]);  
73
-  const [loading, setLoading] = useState(true);
74
-
75
-  useEffect(() => {
76
-
77
-    const fire = firebase.firestore()
78
-    .collection('THREADS')
79
-    
80
-    .onSnapshot(querySnapshot => {
81
-      const threads = querySnapshot.docs.map(documentSnapshot => {
82
-        return{
83
-          _id:documentSnapshot.id,
84
-          name:'',
85
-          ...documentSnapshot.data()
86
-        };
87
-
88
-      });
89
-
90
-      setThreads(threads);
91
-
92
-      if(loading){
93
-        setLoading(false);
94
-      }
95
-
96
-    });
97
-
98
-    return () => fire();
99
-  }, []);
100
-  
101
-  if (loading) {
102
-    return <Loading />;
103
-  }
104
-  
105
-  return (
106
-      <View style={styles.container}>
107
-        <FlatList
108
-          data={threads}
109
-          keyExtractor = {item => item._id}
110
-          ItemSeparatorComponent={() => <Divider />}
111
-          renderItem = {({item}) => (
112
-
113
-            <TouchableOpacity
114
-            onPress={() => navigation.navigate('Room', {thread: item})}
115
-            
116
-            >
117
-            <List.Item
118
-              title={item.name}
119
-              description='Item description'
120
-              titleNumberOfLines={1}
121
-              titleStyle={styles.listTitle}
122
-              descriptionStyle={styles.listDescription}
123
-              descriptionNumberOfLines={1}
124
-            />
125
-          </TouchableOpacity>
126
-        )}
127
-      />
128
-
129
-      <Button
130
-        title='Add Room'
131
-        onPress={() => navigation.navigate('Add')}
132
-      />
133
-
134
-        <Button
135
-        title ='Room'
136
-        onPress= {() => navigation.navigate('Room')}
137
-        />
138
-
139
-      </View>
140
-    );
141
-  }
142
-*/

+ 0
- 27
screens/main/Home_page.js Целия файл

@@ -27,7 +27,6 @@ Notifications.setNotificationHandler({
27 27
 let x = "x";
28 28
 console.log(x);
29 29
 
30
-
31 30
 export function Home_page({navigation}) {
32 31
 
33 32
   const [threads, setThreads] = useState([]);  
@@ -241,7 +240,6 @@ export function Home_page({navigation}) {
241 240
                 x = item._id;
242 241
                 await sendPushNotification(item.i_token, x);
243 242
                 citaId(item._id);
244
-                //x = item._id;
245 243
                 }
246 244
               }
247 245
             /> 
@@ -313,31 +311,6 @@ export function Home_page({navigation}) {
313 311
           </TouchableOpacity>
314 312
         )}
315 313
         />
316
-        <FlatList style={{
317
-             flex: 1,
318
-             width: screenWidth,
319
-         }}
320
-          data={appointments}
321
-          keyExtractor = {item => item._id}
322
-          ItemSeparatorComponent={() => <Divider />}
323
-          renderItem={({ item }) => {
324
-            if(item.new == 'true'){
325
-            return (
326
-              <Button
327
-              title ='Pedir Cita'
328
-              onPress={ async () => {
329
-                x = item._id;
330
-                await sendPushNotification(item.i_token, x);
331
-                citaId(item._id);
332
-                //x = item._id;
333
-                console.log(x);
334
-                console.log("en pedir cita, appointments", appointments[0])
335
-                }
336
-              }
337
-            /> 
338
-            )
339
-          }}}
340
-            />
341 314
           <Button
342 315
           title ='Availability'
343 316
           onPress= {() => navigation.navigate('Availability')}