Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create user chat and singlelisting #81

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions ios/assistlistSummer2018.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
3A7E84A1DAC0412DA5702B6A /* libRealmReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AE821F4D9C2D42C3A48C7E72 /* libRealmReact.a */; };
566D52FCF6284152A7DC3EA3 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 574D966CC6694BEFAF7F7CE5 /* libc++.tbd */; };
7D75C3866D004A4085AC86B0 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 554FB438BC7641458892DD49 /* libz.tbd */; };
238D8D7B940C4300890A0BCA /* libRNBlur.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B0DF87B94DB453F8BFBDF4C /* libRNBlur.a */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -405,6 +406,8 @@
AE821F4D9C2D42C3A48C7E72 /* libRealmReact.a */ = {isa = PBXFileReference; name = "libRealmReact.a"; path = "libRealmReact.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
574D966CC6694BEFAF7F7CE5 /* libc++.tbd */ = {isa = PBXFileReference; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = sourcecode.text-based-dylib-definition; explicitFileType = undefined; includeInIndex = 0; };
554FB438BC7641458892DD49 /* libz.tbd */ = {isa = PBXFileReference; name = "libz.tbd"; path = "usr/lib/libz.tbd"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = sourcecode.text-based-dylib-definition; explicitFileType = undefined; includeInIndex = 0; };
9783996AA3FC4B28B91DF745 /* RNBlur.xcodeproj */ = {isa = PBXFileReference; name = "RNBlur.xcodeproj"; path = "../node_modules/react-native-blur/ios/RNBlur.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
5B0DF87B94DB453F8BFBDF4C /* libRNBlur.a */ = {isa = PBXFileReference; name = "libRNBlur.a"; path = "libRNBlur.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -438,6 +441,7 @@
3A7E84A1DAC0412DA5702B6A /* libRealmReact.a in Frameworks */,
566D52FCF6284152A7DC3EA3 /* libc++.tbd in Frameworks */,
7D75C3866D004A4085AC86B0 /* libz.tbd in Frameworks */,
238D8D7B940C4300890A0BCA /* libRNBlur.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -662,6 +666,7 @@
E804CC7222194D5D8B5750E5 /* RNVectorIcons.xcodeproj */,
90703C6F07E7470997B01529 /* SplashScreen.xcodeproj */,
3D9FCF06744B4BE2903823FF /* RealmReact.xcodeproj */,
9783996AA3FC4B28B91DF745 /* RNBlur.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
Expand Down Expand Up @@ -1341,6 +1346,7 @@
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
);
INFOPLIST_FILE = assistlistSummer2018Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
Expand All @@ -1350,6 +1356,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
Expand All @@ -1370,6 +1377,7 @@
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
);
INFOPLIST_FILE = assistlistSummer2018Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
Expand All @@ -1379,6 +1387,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
Expand All @@ -1400,6 +1409,7 @@
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
);
INFOPLIST_FILE = assistlistSummer2018/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -1423,6 +1433,7 @@
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
);
INFOPLIST_FILE = assistlistSummer2018/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down Expand Up @@ -1453,6 +1464,7 @@
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
);
INFOPLIST_FILE = "assistlistSummer2018-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -1461,6 +1473,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
Expand Down Expand Up @@ -1491,6 +1504,7 @@
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
);
INFOPLIST_FILE = "assistlistSummer2018-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -1499,6 +1513,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
Expand Down Expand Up @@ -1528,6 +1543,7 @@
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
);
INFOPLIST_FILE = "assistlistSummer2018-tvOSTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand All @@ -1536,6 +1552,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
Expand Down Expand Up @@ -1565,6 +1582,7 @@
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
);
INFOPLIST_FILE = "assistlistSummer2018-tvOSTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand All @@ -1573,6 +1591,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
Expand Down
5 changes: 4 additions & 1 deletion js/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ApolloProvider } from 'react-apollo';
import SplashScreen from 'react-native-splash-screen';
import createRootNavigator from './navigation/RootStackNavigation';
import { getUser } from './config/models';
import { UserProvider } from './context/UserContext';

export default class App extends Component {
constructor(props) {
Expand All @@ -24,7 +25,9 @@ export default class App extends Component {
const Layout = createRootNavigator(this.state.signedIn);
return (
<ApolloProvider client={client}>
<Layout />
<UserProvider>
<Layout />
</UserProvider>
</ApolloProvider>
);
}
Expand Down
110 changes: 110 additions & 0 deletions js/components/ChatInput/ChatInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import React from 'react';
import {
View,
Text,
TouchableOpacity,
TextInput,
KeyboardAvoidingView,
} from 'react-native';
import { Form, Field } from 'react-final-form';
import PropTypes from 'prop-types'
import styles from './styles';

const ChatInput = ({
navigation,
createMessage,
currentUser,
messages,
item,
}) => {
let messageContent = [];
messages && messages.map(message => messageContent.push(message.content));
return (
<Form
onSubmit={values =>
createMessage({
variables: {
from: currentUser,
chatId: navigation.getParam('chatId'),
content: values.content,
},
}).then(this.textInput.clear())
}
render={({ handleSubmit }) => (
<KeyboardAvoidingView
style={styles.sendMessageContainer}
behavior="position"
enabled
keyboardVerticalOffset={64}
>
{currentUser !== item.user.id && (
<View style={styles.quickMessageContainer}>
{!messageContent.includes('What condition is it in?') && (
<TouchableOpacity
onPress={() =>
createMessage({
variables: {
from: currentUser,
chatId: navigation.getParam('chatId'),
content: 'What condition is it in?',
},
})
}
style={styles.quickMessage}
>
<Text style={styles.messageText}>
What condition is it in?
</Text>
</TouchableOpacity>
)}
{!messageContent.includes('Hi! Is this still available?') && (
<TouchableOpacity
onPress={() =>
createMessage({
variables: {
from: currentUser,
chatId: navigation.getParam('chatId'),
content: 'Hi! Is this still available?',
},
})
}
style={styles.quickMessage}
>
<Text style={styles.messageText}>
Hi! Is this still available?
</Text>
</TouchableOpacity>
)}
</View>
)}
<View style={styles.sendMessage}>
<Field name="content">
{({ input }) => (
<TextInput
style={styles.messageInput}
{...input}
ref={input => {
this.textInput = input;
}}
/>
)}
</Field>
<TouchableOpacity onPress={handleSubmit} style={styles.sendButton}>
<Text style={styles.sendButtonText}>Send</Text>
</TouchableOpacity>
</View>
</KeyboardAvoidingView>
)}
/>
);
};

ChatInput.propTypes = {
navigation: PropTypes.object.isRequired,
createMessage: PropTypes.func.isRequired,
currentUser: PropTypes.string.isRequired,
messages: PropTypes.array,
item: PropTypes.object.isRequired,
}

export default ChatInput;
3 changes: 3 additions & 0 deletions js/components/ChatInput/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ChatInput from './ChatInput';

export default ChatInput;
61 changes: 61 additions & 0 deletions js/components/ChatInput/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { StyleSheet, Dimensions } from 'react-native';
import { fonts, colors } from '../../config/styles';

const { width } = Dimensions.get('window');

const styles = StyleSheet.create({
sendMessageContainer: {
justifyContent: 'flex-end',
width: width,
height: 75,
paddingVertical: 8,
paddingHorizontal: 8,
},
quickMessageContainer: {
flexDirection: 'row',
justifyContent: 'space-between',
},
quickMessage: {
backgroundColor: colors.lightBlue,
borderRadius: 5,
padding: 5,
marginVertical: 8,
},
messageText: {
fontFamily: fonts.main,
color: 'white',
fontSize: 16,
},
sendMessage: {
flexDirection: 'row',
alignItems: 'center',
},
messageInput: {
flex: 1,
backgroundColor: 'white',
borderColor: colors.darkBlue,
marginRight: 5,
borderRadius: 7,
borderWidth: 1,
color: colors.darkBlue,
paddingVertical: 3,
paddingLeft: 10,
fontSize: 16,
},
sendButton: {
backgroundColor: colors.green,
borderRadius: 7,
paddingBottom: 4,
paddingTop: 2,
flex: 0.2,
},
sendButtonText: {
color: 'white',
fontFamily: fonts.main,
fontWeight: '700',
fontSize: 18,
textAlign: 'center'
}
});

export default styles;
1 change: 1 addition & 0 deletions js/components/CreateItemNav/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const styles = StyleSheet.create({
width: width / 8,
padding: 7,
marginBottom: 10,
overflow: 'visible'
},
container: {
backgroundColor: 'white',
Expand Down
42 changes: 42 additions & 0 deletions js/components/ItemMeta/ItemMeta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react';
import { View, Image, Text } from 'react-native';
import styles from './styles';

const capitalizeFirstLetter = str => {
return str
.split(' ')
.map(string => {
return string[0].toUpperCase() + string.slice(1);
})
.join(' ');
};

const ItemMeta = ({ itemData }) => {
return (
<View>
<View style={styles.imageBorder}>
<Image
style={styles.image}
source={{
uri:
'https://images-na.ssl-images-amazon.com/images/I/91MBcSocZuL._SL1500_.jpg',
}}
/>
</View>
<Text style={styles.title}>{capitalizeFirstLetter(itemData.title)}</Text>
<Text style={styles.title}>{itemData.subCategory.title}</Text>
<View style={styles.priceLocationContainer}>
<Text style={styles.price}>${itemData.price}</Text>
<View style={styles.locationContainer}>
<Image
style={styles.locationIcon}
source={require('../../assets/images/Icons/Location.png')}
/>
<Text style={styles.location}>{itemData.location.title}</Text>
</View>
</View>
</View>
);
};

export default ItemMeta;
3 changes: 3 additions & 0 deletions js/components/ItemMeta/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ItemMeta from './ItemMeta'

export default ItemMeta
Loading