Skip to content

Commit

Permalink
Merge branch 'backend-rewrite' of https://github.com/willhuff0/OSC-Pr…
Browse files Browse the repository at this point in the history
…oximity-Chat-App into backend-rewrite
  • Loading branch information
willhuff0 committed Nov 19, 2024
2 parents 88146c6 + 3cb4553 commit 21f319d
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 113 deletions.
5 changes: 2 additions & 3 deletions client/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"resizeMode": "contain",
"backgroundColor": "34D1BF"
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
Expand All @@ -27,6 +25,7 @@
"web": {
"favicon": "./assets/favicon.png"
},
"newArchEnabled": true,
"plugins": [
"expo-router",
[
Expand Down
6 changes: 3 additions & 3 deletions client/app/components/chat/ChatScreenFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export const ChatScreenFooter: React.FC<ChatInputProps> = ({
return (
<View style={styles.container}>
<View style={styles.iconContainer}>
<TouchableOpacity>
{/* <TouchableOpacity>
<Image color="black" strokeWidth={1.8} style={styles.icons} />
</TouchableOpacity>
<TouchableOpacity>
<Smile color="black" strokeWidth={1.8} style={styles.icons} />
</TouchableOpacity>
</TouchableOpacity> */}
</View>
<TextInput
placeholder="Say Something..."
Expand All @@ -57,7 +57,7 @@ const styles = StyleSheet.create({
borderWidth: 1,
borderRadius: Dimensions.get("window").width * 0.058,
marginHorizontal: Dimensions.get("window").width * 0.005,
marginBottom: Platform.OS === "ios" ? 0 : 5,
marginBottom: 3,
minHeight: Dimensions.get("window").width * 0.113,
maxHeight: Dimensions.get("window").width * 0.3,
},
Expand Down
24 changes: 16 additions & 8 deletions client/app/components/chat/NearbyHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,24 @@ import {
} from "react-native";
import { ChevronLeft } from "react-native-feather";

Check warning on line 10 in client/app/components/chat/NearbyHeader.tsx

View workflow job for this annotation

GitHub Actions / lint (21.x)

'ChevronLeft' is defined but never used

export const NearbyHeader: React.FC = () => {
interface NearbyHeaderProps {
onClick: () => void;
}

export const NearbyHeader: React.FC<NearbyHeaderProps> = ({ onClick }) => {
return (
<View style={styles.nearbyContainer}>
<Text style={styles.nearbyText}>Nearby</Text>
<View style={styles.iconContainer}>
<Image
style={styles.peopleIcon}
source={require("../../../assets/icons/misc/nearby_icon.png")}
/>
<Text style={styles.countText}>{5}</Text>
</View>
<TouchableOpacity onPress={onClick}>
<View style={styles.iconContainer}>
<Image
style={styles.peopleIcon}
source={require("../../../assets/icons/misc/nearby_icon.png")}
/>

<Text style={styles.countText}>{5}</Text>
</View>
</TouchableOpacity>
</View>
);
};
Expand All @@ -40,6 +47,7 @@ const styles = StyleSheet.create({
paddingRight: "5%",
paddingLeft: "10%",
gap: 10,
zIndex: 1,
},
nearbyText: {
fontFamily: "Quicksand",
Expand Down
99 changes: 99 additions & 0 deletions client/app/components/chat/NearbyUserDrawer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import React, { useState } from "react";
import { View, Text, StyleSheet, FlatList, Dimensions } from "react-native";
import Animated, {
useSharedValue,
useAnimatedStyle,
withTiming,
Easing,
} from "react-native-reanimated";
import NearbyHeader from "./NearbyHeader";
import { Pressable } from "react-native";

const SCREEN_WIDTH = Dimensions.get("window").width;

const NearbyUserDrawer = () => {
const [isOpen, setIsOpen] = useState(false);
const translateX = useSharedValue(SCREEN_WIDTH);

const toggleDrawer = () => {
translateX.value = isOpen
? withTiming(SCREEN_WIDTH, {
duration: 300, // Duration in milliseconds
easing: Easing.out(Easing.ease), // Smooth easing out
})
: withTiming(0, {
duration: 300,
easing: Easing.out(Easing.ease), // Smooth easing out
});
setIsOpen(!isOpen);
};

const animatedStyle = useAnimatedStyle(() => ({
transform: [{ translateX: translateX.value }],
}));

const nearbyUsers = ["Alice", "Bob", "Charlie", "Diana", "Eve"]; // Example names

return (
<View style={styles.container}>
<NearbyHeader onClick={toggleDrawer} />
{/* Overlay and Drawer */}
{isOpen && <Pressable style={styles.overlay} onPress={toggleDrawer} />}
<Animated.View style={[styles.drawer, animatedStyle]}>
<Text style={styles.headerText}>Nearby Users</Text>
<FlatList
data={nearbyUsers}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item }) => <Text style={styles.name}>{item}</Text>}
/>
</Animated.View>
</View>
);
};

const styles = StyleSheet.create({
container: {
display: "flex",
height: Dimensions.get("screen").height,
flexDirection: "column",
alignItems: "center",
position: "absolute",
},
overlay: {
position: "absolute",
top: 0,
left: 0,
width: "100%",
height: "100%",
backgroundColor: "rgba(0, 0, 0, 0.15)",
zIndex: 1,
},
drawer: {
position: "absolute",
right: 0,
top: 0,
width: SCREEN_WIDTH * 0.6,
height: "100%",
backgroundColor: "#fff",
borderLeftWidth: 1,
borderLeftColor: "#ddd",
padding: 30,
shadowColor: "#000",
shadowOffset: { width: -2, height: 0 },
shadowOpacity: 0.3,
shadowRadius: 4,
zIndex: 2,
gap: 20,
},
headerText: {
fontFamily: "Quicksand",
fontSize: 24,
fontWeight: "bold",
},
name: {
fontSize: 18,
marginVertical: 10,
},
});

export default NearbyUserDrawer;
4 changes: 1 addition & 3 deletions client/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ const App = () => {

if (!initialized) return <Text>Loading...</Text>;

return (
isLoggedin ? <AppNavigator /> : <AuthNavigator />
);
return isLoggedin ? <AppNavigator /> : <AuthNavigator />;
};

export default App;
4 changes: 2 additions & 2 deletions client/app/screens/chat/ChatScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useState, useEffect } from "react";
import { useUser } from "@app/contexts/UserContext";
import NearbyHeader from "@app/components/chat/NearbyHeader";
import React from "react";
import NearbyUserDrawer from "@app/components/chat/NearbyUserDrawer";

const ChatScreen = () => {
const settings = useSettings();
Expand Down Expand Up @@ -91,7 +92,7 @@ const ChatScreen = () => {
Platform.OS === "ios" ? screenHeight * 0.055 : 0
}>
<View style={styles.mainContainer}>
<NearbyHeader />
<NearbyUserDrawer />
<View style={styles.chatContainer}>
<MessageChannel messages={messages} />
</View>
Expand Down Expand Up @@ -135,7 +136,6 @@ const styles = StyleSheet.create({

footerContainer: {
width: "95%",

maxHeight: Dimensions.get("window").height * 0.15,
display: "flex",
flexDirection: "row",
Expand Down
Loading

0 comments on commit 21f319d

Please sign in to comment.