David пре 9 година
родитељ
комит
bc121f9cab

+ 1 - 0
package.json

@@ -12,6 +12,7 @@
     "react": "15.3.2",
     "react-native": "0.37.0",
     "react-native-action-button": "^2.0.15",
+    "react-native-local-storage": "^1.5.1",
     "react-native-orientation": "yamill/react-native-orientation",
     "react-native-router-flux": "^3.37.0",
     "react-native-scrollable-tab-view": "^0.6.0",

+ 0 - 1
src/actions/AuthActions.js

@@ -40,7 +40,6 @@ const loginUserFail = (dispatch, error) => {
 };
 
 const loginUserSuccess = (dispatch, user) => {
-  console.log("success", user);
   dispatch({
     type: LOGIN_USER_SUCCESS,
     payload: user

+ 9 - 0
src/actions/types.js

@@ -1,18 +1,27 @@
 export const EMAIL_CHANGED = "email_changed";
 export const PASSWORD_CHANGED = "password_changed";
+
 export const LOGIN_USER_SUCCESS = "login_user_success";
 export const LOGIN_USER_FAIL = "login_user_fail";
 export const LOGIN_USER = "login_user";
+
 export const CURSADA_FETCH_SUCCESS = "cursada_fetch_success";
 export const CURSADA_FETCH_FAIL = "cursada_fetch_fail";
+
 export const CURSADAS_FETCH_FAIL = "cursadas_fetch_fail";
 export const CURSADAS_FETCH_SUCCESS = "cursadas_fetch_success";
+
 export const CLASE_FETCH_FAIL = "clase_fetch_fail";
 export const CLASE_FETCH_SUCCESS = "clase_fetch_success";
 export const CLASE_FETCH = "clase_fetch";
+
 export const PROFESOR_FETCH = "profesor_fetch";
 export const PROFESOR_FETCH_SUCCESS = "profesor_fetch_success";
+
 export const PROP_CHANGED = "prop_changed";
 export const REGISTER_USER = "register_user";
 export const REGISTER_USER_SUCCESS = "register_user_success";
 export const REGISTER_USER_FAILURE = "register_user_failure";
+
+export const CLASE_SAVE = "clase_save";
+export const CLASE_DELETE = "clase_delete";

+ 7 - 12
src/components/ActionButton.js

@@ -3,19 +3,14 @@ import ActionButton from 'react-native-action-button';
 import Icon from 'react-native-vector-icons/Ionicons';
 import { Actions, ActionConst } from 'react-native-router-flux';
 
-const styles = {
-  actionButtonIcon: {
-    fontSize: 20,
-    height: 22,
-    color: 'white',
-  },
-};
-
-const MyActionButton = () => {
+const MyActionButton = (props) => {
+	const { children, onPress } = props;
 	return (
-		  <ActionButton buttonColor="rgba(231,76,60,1)"
-        onPress={ () => Actions.Menu() }
-      />
+		<ActionButton
+		  	buttonColor="rgba(231,76,60,1)"
+        	onPress={ onPress || (() => Actions.Menu()) }>
+			{children}
+		</ActionButton>
 	);
 }
 

+ 23 - 0
src/components/SaveClassButton.js

@@ -0,0 +1,23 @@
+import React from 'react';
+import ActionButton from 'react-native-action-button';
+import Icon from 'react-native-vector-icons/Ionicons';
+import { Actions, ActionConst } from 'react-native-router-flux';
+
+const SaveClassButton = (props) => {
+	const { children, onPress } = props;
+	return (
+		<ActionButton.Item onPress={() => {} } buttonColor='#ee22ee'>
+            <Icon name="md-cloud-download" style={styles.actionButtonIcon} />
+		</ActionButton.Item>
+	);
+}
+
+const styles = {
+	actionButtonIcon: {
+	  fontSize: 20,
+	  height: 22,
+	  color: 'white',
+	}
+}
+
+export default SaveClassButton;

+ 3 - 1
src/components/common/Button.js

@@ -23,11 +23,13 @@ const styles = {
     paddingBottom: 5
   },
   buttonStyle: {
-    height: 40,
+    flex: 1,
+    maxHeight: 40,
     justifyContent: 'center',
     alignSelf: 'stretch',
     backgroundColor: '#6281A2',
     borderRadius: 5,
+    marginTop: 10,
     marginLeft: 20,
     marginRight: 20,
     marginBottom: 10

+ 0 - 1
src/components/common/Spinner.js

@@ -11,7 +11,6 @@ const Spinner = ( props ) => {
 
 const styles = {
 	spinnerStyle: {
-		flex: 1,
 		justifyContent: 'center',
 		alignItems: 'center'
 	}

+ 24 - 0
src/reducers/ClasesReducer.js

@@ -0,0 +1,24 @@
+import {
+  CLASE_FETCH_SUCCESS,
+  CLASE_FETCH_FAIL,
+  CLASE_FETCH
+} from '../actions/types';
+
+const INITIAL_STATE = {
+  curClase: { profesor: {} },
+  loading: true,
+  error: false
+};
+
+export default (state = INITIAL_STATE, action) => {
+  switch(action.type) {
+	case CLASE_FETCH:
+	  return { ...state, loading: true };
+    case CLASE_FETCH_SUCCESS:
+      return { ...state, loading: false, curClase: action.payload };
+	case CLASE_FETCH_FAIL:
+	  return { ...state, loading: false, curClase: { error: true } };
+    default:
+      return state;
+  }
+};

+ 1 - 12
src/reducers/CursadaReducer.js

@@ -2,17 +2,13 @@ import {
   CURSADAS_FETCH_SUCCESS,
   CURSADA_FETCH_SUCCESS,
   CURSADAS_FETCH_FAIL,
-  CURSADA_FETCH_FAIL,
-  CLASE_FETCH_SUCCESS,
-  CLASE_FETCH_FAIL,
-  CLASE_FETCH
+  CURSADA_FETCH_FAIL
 } from '../actions/types';
 
 const INITIAL_STATE = {
   cursos: [],
   cursadas: [],
   curCursada: { clases: [] },
-  curClase: { profesor: {} },
   loading: true,
   error: false
 };
@@ -23,18 +19,11 @@ export default (state = INITIAL_STATE, action) => {
       const { cursadas, cursos } = action.payload;
       return { ...state, cursadas, cursos, error: false };
     case CURSADAS_FETCH_FAIL:
-      console.log("cursadas fetch fail");
       return { ...state, error: true };
     case CURSADA_FETCH_SUCCESS:
       return { ...state, curCursada: action.payload };
     case CURSADA_FETCH_FAIL:
       return { ...state, curCursada: { error: true } };
-	case CLASE_FETCH:
-	  return { ...state, loading: true };
-    case CLASE_FETCH_SUCCESS:
-      return { ...state, loading: false, curClase: action.payload };
-	case CLASE_FETCH_FAIL:
-	  return { ...state, loading: false, curClase: { error: true } };
     default:
       return state;
   }

+ 15 - 0
src/reducers/LocalStorageReducer.js

@@ -0,0 +1,15 @@
+import {
+  CLASE_SAVE,
+  CLASE_DELETE,
+} from '../actions/types';
+
+const INITIAL_STATE = {
+  clases: []
+};
+
+export default (state = INITIAL_STATE, action) => {
+  switch(action.type) {
+    default:
+      return state;
+  }
+};

+ 4 - 2
src/reducers/index.js

@@ -3,10 +3,12 @@ import AuthReducer from './AuthReducer';
 import CursadaReducer from './CursadaReducer';
 import ProfReducer from './ProfReducer';
 import RegisterReducer from './RegisterReducer';
+import ClasesReducer from './ClasesReducer';
 
 export default combineReducers({
   auth: AuthReducer,
   cursadasR: CursadaReducer,
-  profR: ProfReducer,
-  register: RegisterReducer
+  ProfReducer,
+  RegisterReducer,
+  ClasesReducer
 });

+ 31 - 8
src/scenes/Clase.js

@@ -2,14 +2,20 @@ import React, { Component } from 'react';
 import { View, Text } from 'react-native';
 import { connect } from 'react-redux';
 import Tabs from 'react-native-tabs';
+import Icon from 'react-native-vector-icons/Ionicons';
+import ActionButton from 'react-native-action-button';
+import { Actions, ActionConst } from 'react-native-router-flux';
+
 
 import { claseFetch } from '../actions/';
 import Teoria from './Clase/Teoria';
 import Comentarios from './Clase/Comentarios';
 import { Spinner } from '../components/common/';
 import MyActionButton from '../components/ActionButton';
+import SaveClassButton from '../components/SaveClassButton';
 import { ConnectionError } from '../components/common';
 
+
 class Clase extends Component {
   state = { page: 'Teoria' };
 
@@ -45,23 +51,40 @@ class Clase extends Component {
   		 <View tabLabel="Videos" />
   		 <Comentarios style={{flex:1}} comentarios={comentarios} respuestas={respuestas} tabLabel="Comentarios" />
         </ScrollableTabView>
-  	  <MyActionButton />
+  	  <MyActionButton onPress={() => true}>
+	  	<ActionButton.Item buttonColor='#22eeee' title="Comentario">
+            <Icon name="md-create" style={styles.actionButtonIcon} />
+		</ActionButton.Item>
+
+		<ActionButton.Item onPress={() => {} } buttonColor='#ee22ee' title="Guardar clase">
+			<Icon name={ false ? "ios-star" : "ios-star-outline" } style={styles.actionButtonIcon} />
+		</ActionButton.Item>
+
+		<ActionButton.Item onPress={() => Actions.Menu()} buttonColor='#eeee22' title="Menu">
+			<Icon name="md-apps" style={styles.actionButtonIcon} />
+		</ActionButton.Item>
+	  </MyActionButton>
 	  </View>
     );
   }
 };
 
 const styles = {
-  container: {
-    flex: 1,
-    justifyContent: 'center',
-    alignItems: 'center',
-    backgroundColor: '#F5FCFF',
-  }
+	actionButtonIcon: {
+	  fontSize: 20,
+	  height: 22,
+	  color: 'white',
+	},
+	container: {
+		flex: 1,
+		justifyContent: 'center',
+		alignItems: 'center',
+		backgroundColor: '#F5FCFF',
+	}
 };
 
 const mapStateToProps = state => {
-  const { curClase, loading } = state.cursadasR;
+  const { curClase, loading } = state.ClasesReducer;
 	return { loading, clase: curClase };
 };
 

+ 0 - 0
src/scenes/Directions.js


+ 1 - 1
src/scenes/LoginForm.js

@@ -97,7 +97,7 @@ const styles = {
     color:'#1E3146',
     backgroundColor:'#D8DFE8',
     fontSize: 14,
-    height: 35,
+    height: 40,
     borderRadius: 8,
     paddingTop: 10,
     paddingLeft: 10,

+ 2 - 1
src/scenes/Menu.js

@@ -1,11 +1,12 @@
 import React, { Component } from 'react';
 import { View, Text } from 'react-native';
+import MyAbout from './MyAbout';
 
 class Menu extends Component  {
   render() {
     return (
       <View style={{flex:1}}>
-        <Text>qwpeqiwe</Text>
+        <MyAbout />
       </View>
     );
   };

+ 24 - 0
src/scenes/MyAbout.js

@@ -0,0 +1,24 @@
+import React, { Component } from 'react';
+import { View, Text, Image } from 'react-native';
+
+const MyAbout = () => {
+    return (
+      <View style={{flex:1}}>
+        <Text style={{fontSize:20, alignSelf:'center', fontWeight:'700'}}>
+          ESPECIFICOS Buenos Aires
+        </Text>
+
+        <Image source={require('../../img/casa.png')}
+          style={{height: 300, width:400}}
+          resizeMode='contain'
+        />
+        <Text>Leopoldo Marechal 914, CABA (C1405BMD), Buenos Aires, Argentina.</Text>
+        <Text>
+          Teléfono: +5411 4139-6860/1 +5411 4982-2892.
+        </Text>
+        <Text>Cómo llegar?</Text>
+      </View>
+    );
+}
+
+export default MyAbout;

+ 1 - 1
src/scenes/Profesor.js

@@ -47,7 +47,7 @@ class Clase extends Component  {
 
 const mapStateToProps = state => {
   console.log("ProfState:", state);
-	return { profesor: state.profR.profesor };
+	return { profesor: state.ProfReducer.profesor };
 };
 
 export default connect(mapStateToProps, { profFetch })(Clase);

+ 1 - 1
src/scenes/RegisterForm.js

@@ -88,7 +88,7 @@ const styles = {
 }
 
 const mapStateToProps = ({ register }) => {
-  const { error, user, loading } = register;
+  const { error, user, loading } = RegisterReducer;
   return { error, loading, user };
 };