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

Mobile main updated #448

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4b9f136
feature: Create Post
karatashsyn Nov 22, 2024
c288321
feature: Explore Screen real data
karatashsyn Nov 25, 2024
0569390
feat: Portfolio Assets Connected Backend
karatashsyn Nov 25, 2024
f5bf534
Merge pull request #447 from bounswe/portfolio
karatashsyn Nov 25, 2024
1ab6e23
fix/tag selection fix
karatashsyn Dec 2, 2024
fc92cf7
fix: Connect followed subforums to backend correctly.
karatashsyn Dec 2, 2024
23ac587
feat/asset-details
karatashsyn Dec 5, 2024
6c0d4b0
Merge pull request #474 from bounswe/feat/asset-details
karatashsyn Dec 5, 2024
5747dd1
Subforum Explore and Detail
karatashsyn Dec 8, 2024
3e09ec8
Merge pull request #479 from bounswe/mobile/feat/explore-subforum
karatashsyn Dec 8, 2024
069e487
imp: Admin access rights assignments after logging in and permission …
gulsensabak Dec 11, 2024
9ca0f17
Revert "imp: Admin access rights assignments after logging in and per…
gulsensabak Dec 11, 2024
23542e2
imp: Admin access rights assignments after logging in and permission …
gulsensabak Dec 11, 2024
86f2652
Merge pull request #501 from bounswe/imp/adminCheck
gulsensabak Dec 11, 2024
ffa7099
imp: My posts screen
gulsensabak Dec 13, 2024
2a8eb83
Merge pull request #507 from bounswe/imp/my-posts-screen
gulsensabak Dec 13, 2024
02773c8
imp: Followers screen
gulsensabak Dec 13, 2024
5a3c207
Merge pull request #508 from bounswe/imp/followers-screen
gulsensabak Dec 13, 2024
ad903c7
imp: Followings Screen
gulsensabak Dec 13, 2024
efb6f52
Merge pull request #509 from bounswe/imp/following-screen
gulsensabak Dec 13, 2024
3afc24b
refactor: Home Screen
karatashsyn Dec 14, 2024
7033644
refactor:Refactor Explore Root Screen
karatashsyn Dec 14, 2024
0dae62d
refactor: Refactor explore root screen
karatashsyn Dec 14, 2024
4509339
refactor: Refactor Portfolio Screen
karatashsyn Dec 15, 2024
2b1ba49
Profile Update
Pqrq Dec 15, 2024
cfebebf
refactor: Refactor Portfolio
karatashsyn Dec 15, 2024
edbb293
refactor: Refactor Follower and Followings
karatashsyn Dec 15, 2024
24980a9
Portfolio Screen
Pqrq Dec 15, 2024
1ddc1dd
Delete mobile/tradeverse/services/oldPage.jsx
Pqrq Dec 15, 2024
0cfcd93
refactor: Refactor Result Cards on Search
karatashsyn Dec 15, 2024
b10ff55
Merge pull request #527 from bounswe/mobile/refactor
karatashsyn Dec 15, 2024
54abac6
Merge branch 'mobile-main-updated' into mobile-main-updated-profileUp…
karatashsyn Dec 15, 2024
16b7085
Merge pull request #525 from bounswe/mobile-main-updated-profileUpdate
Pqrq Dec 15, 2024
6ebe8db
Merge branch 'mobile-main-updated' into mobile-main-updated-portfolio
karatashsyn Dec 15, 2024
73c01a9
Delete mobile/tradeverse/services/oldPage.jsx
karatashsyn Dec 15, 2024
8036eff
Merge pull request #526 from bounswe/mobile-main-updated-portfolio
Pqrq Dec 15, 2024
cc06f35
Tag Detail Screen
Pqrq Dec 16, 2024
4ebda73
Delete .idea directory
karatashsyn Dec 16, 2024
680b31d
Merge pull request #530 from bounswe/mobile-main-updated-tagDetails
Pqrq Dec 16, 2024
6a5559b
mobile/feat/post-creation-improvements
karatashsyn Dec 16, 2024
95790a4
Merge branch 'mobile-main-updated' into mobile/feat/post-creation-imp…
karatashsyn Dec 16, 2024
6d575d1
Merge pull request #541 from bounswe/mobile/feat/post-creation-improv…
karatashsyn Dec 16, 2024
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
Binary file added .DS_Store
Binary file not shown.
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

3 changes: 1 addition & 2 deletions archive/src/mobile/src/pages/CreatePostScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ const CreatePost = () => {
photoDate: date ?? "",
animalName,
});
console.log("Post created:", response);
setTimeout(() => {
navigation.navigate("Home");
}, 2000); // 2000 milliseconds delay (2 seconds)
// You can show a success message or navigate to another screen here
} catch (error) {
console.error("Error creating post:", error);
console.log("Error creating post:", error);
// You can show an error message here
}
};
Expand Down
95 changes: 67 additions & 28 deletions archive/src/mobile/src/pages/GuestSearch.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import React, { useState } from 'react';
import { View, TextInput, TouchableOpacity, Text, Alert } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import MaterialIcon from 'react-native-vector-icons/MaterialIcons'; // Renamed import
import React, { useState } from "react";
import { View, TextInput, TouchableOpacity, Text, Alert } from "react-native";
import Icon from "react-native-vector-icons/FontAwesome";
import MaterialIcon from "react-native-vector-icons/MaterialIcons"; // Renamed import
function SearchScreen({ navigation }) {
const [searchQuery, setSearchQuery] = useState('');
const [searchQuery, setSearchQuery] = useState("");
const [selectedButton, setSelectedButton] = useState(null);

const handleSearch = (prefix) => {
if (searchQuery.trim() === '') {
Alert.alert('Error', 'Please enter a search query.');
if (searchQuery.trim() === "") {
Alert.alert("Error", "Please enter a search query.");
return;
}
// Concatenate the selected prefix with the search input
const prefixedSearchQuery = prefix + searchQuery;
console.log('Searching for:', prefixedSearchQuery);
// Navigate to the search results screen with the prefixed search query
navigation.navigate('SearchResults', { searchQuery: prefixedSearchQuery });
navigation.navigate("SearchResults", { searchQuery: prefixedSearchQuery });
};

const handleButtonClick = (prefix) => {
Expand All @@ -24,50 +23,90 @@ function SearchScreen({ navigation }) {
};

return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', paddingHorizontal: 20 }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 20 }}>
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
paddingHorizontal: 20,
}}
>
<View
style={{
flexDirection: "row",
justifyContent: "space-between",
marginBottom: 20,
}}
>
{/* Button for family search */}
<TouchableOpacity
style={{ backgroundColor: selectedButton === 'f@' ? 'lightblue' : 'lightgray', padding: 10, borderRadius: 5 }}
onPress={() => handleButtonClick('f@')}
disabled={selectedButton === 'f@'}
style={{
backgroundColor:
selectedButton === "f@" ? "lightblue" : "lightgray",
padding: 10,
borderRadius: 5,
}}
onPress={() => handleButtonClick("f@")}
disabled={selectedButton === "f@"}
>
<Text>Family</Text>
</TouchableOpacity>
{/* Button for work search */}
<TouchableOpacity
style={{ backgroundColor: selectedButton === 's@' ? 'lightgreen' : 'lightgray', padding: 10, borderRadius: 5 }}
onPress={() => handleButtonClick('s@')}
disabled={selectedButton === 's@'}
style={{
backgroundColor:
selectedButton === "s@" ? "lightgreen" : "lightgray",
padding: 10,
borderRadius: 5,
}}
onPress={() => handleButtonClick("s@")}
disabled={selectedButton === "s@"}
>
<Text>Species</Text>
</TouchableOpacity>
{/* Button for hobbies search */}

</View>
<TextInput
placeholder="Enter search query"
value={searchQuery}
onChangeText={text => setSearchQuery(text)}
style={{ width: '100%', marginBottom: 20, borderWidth: 1, borderColor: 'black', padding: 10 }}
onChangeText={(text) => setSearchQuery(text)}
style={{
width: "100%",
marginBottom: 20,
borderWidth: 1,
borderColor: "black",
padding: 10,
}}
/>

<TouchableOpacity
onPress={() => handleSearch(selectedButton)}
style={{ backgroundColor: 'green', padding: 10, borderRadius: 5 }}
disabled={!searchQuery.trim() || selectedButton==null }
style={{ backgroundColor: "green", padding: 10, borderRadius: 5 }}
disabled={!searchQuery.trim() || selectedButton == null}
>
<Text style={{ color: 'white' }}>Search</Text>
<Text style={{ color: "white" }}>Search</Text>
</TouchableOpacity>
{/* Bottom navigation bar */}
<View style={{ flexDirection: 'row', justifyContent: 'space-around', alignItems: 'center', height: 50, backgroundColor: '#f0f0f0', position: 'absolute', bottom: 0, left: 0, right: 0 }}>
<TouchableOpacity onPress={() => navigation.navigate('Guest')}>
<View
style={{
flexDirection: "row",
justifyContent: "space-around",
alignItems: "center",
height: 50,
backgroundColor: "#f0f0f0",
position: "absolute",
bottom: 0,
left: 0,
right: 0,
}}
>
<TouchableOpacity onPress={() => navigation.navigate("Guest")}>
<MaterialIcon name="home" size={30} color="green" />
</TouchableOpacity>
<TouchableOpacity onPress={() => navigation.navigate('GuestS')}>
<TouchableOpacity onPress={() => navigation.navigate("GuestS")}>
<MaterialIcon name="search" size={30} color="green" />
</TouchableOpacity>
<TouchableOpacity onPress={() => navigation.navigate('Sign-Up')}>
<TouchableOpacity onPress={() => navigation.navigate("Sign-Up")}>
<MaterialIcon name="person-add" size={30} color="green" />
</TouchableOpacity>
</View>
Expand Down
81 changes: 49 additions & 32 deletions archive/src/mobile/src/pages/GuestUserHome.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import React, { useContext, useEffect, useState} from 'react';
import { View, Text, FlatList, Image, TouchableOpacity, StyleSheet, Alert } from 'react-native';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; // Renamed import
import MaterialIcon from 'react-native-vector-icons/MaterialIcons'; // Renamed import
import { getFeed } from '../services/feed.js';
import React, { useContext, useEffect, useState } from "react";
import {
View,
Text,
FlatList,
Image,
TouchableOpacity,
StyleSheet,
Alert,
} from "react-native";
import FontAwesomeIcon from "react-native-vector-icons/FontAwesome"; // Renamed import
import MaterialIcon from "react-native-vector-icons/MaterialIcons"; // Renamed import
import { getFeed } from "../services/feed.js";
// Dummy data for posts


function HomeScreen({ navigation }) {
// State variables for like, dislike, comment counts, and flag status
const [likeCounts, setLikeCounts] = useState({});
Expand All @@ -21,10 +28,9 @@ function HomeScreen({ navigation }) {
if (!response.success) {
throw new Error(response.message);
}
console.log("here");
setPosts(response.posts);
} catch (error) {
console.error("Failed to fetch posts:", error);
console.log("Failed to fetch posts:", error);
}
};

Expand Down Expand Up @@ -97,32 +103,42 @@ function HomeScreen({ navigation }) {
// Function to display an alert for guest users
const displayGuestAlert = () => {
Alert.alert(
'Guest User',
'You cannot do this action, you are a guest user.',
[{ text: 'OK', onPress: () => console.log('OK Pressed') }],
"Guest User",
"You cannot do this action, you are a guest user.",
[{ text: "OK", onPress: () => console.log("OK Pressed") }],
{ cancelable: false }
);
};

const renderPost = ({ item }) => (
<View style={{ marginBottom: 20, backgroundColor: 'white' }}>
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 10 }}>
<Text style={{ fontWeight: 'bold', marginRight: 10 }}>{item.username}</Text>
<TouchableOpacity onPress={() => navigation.navigate('UserP', { username: item.username })}>
<Text style={{ color: 'blue' }}>View Profile</Text>
<View style={{ marginBottom: 20, backgroundColor: "white" }}>
<View
style={{ flexDirection: "row", alignItems: "center", marginBottom: 10 }}
>
<Text style={{ fontWeight: "bold", marginRight: 10 }}>
{item.username}
</Text>
<TouchableOpacity
onPress={() =>
navigation.navigate("UserP", { username: item.username })
}
>
<Text style={{ color: "blue" }}>View Profile</Text>
</TouchableOpacity>
</View>
{item.media && (
<Image
source={{ uri: `data:image/jpeg;base64,${item.media}` }}
style={{ width: '100%', height: 300 }}
style={{ width: "100%", height: 300 }}
/>
)}
<Text style={{ marginVertical: 10 }}>{item.animalName || 'No Animal Name'}</Text>
<Text style={{ marginVertical: 10 }}>
{item.animalName || "No Animal Name"}
</Text>
<Text style={{ marginVertical: 10 }}>{item.caption}</Text>
<Text style={{ marginVertical: 10 }}>Posted on: {item.postDate}</Text>
<Text style={{ marginVertical: 10 }}>Location: {item.location}</Text>
<View style={{ flexDirection: 'row', marginTop: 10 }}>
<View style={{ flexDirection: "row", marginTop: 10 }}>
<TouchableOpacity onPress={() => incrementLike(item.id)}>
<FontAwesomeIcon name="thumbs-up" size={30} color="green" />
</TouchableOpacity>
Expand All @@ -136,32 +152,33 @@ function HomeScreen({ navigation }) {
</TouchableOpacity>
<Text style={styles.iconText}>{commentCounts[item.id] || 0}</Text>
<TouchableOpacity onPress={() => toggleBookmark(item.id)}>
<FontAwesomeIcon name={bookmarkedPosts[item.id] ? "bookmark" : "bookmark-o"} size={30} color="pink" />
<FontAwesomeIcon
name={bookmarkedPosts[item.id] ? "bookmark" : "bookmark-o"}
size={30}
color="pink"
/>
</TouchableOpacity>
<View style={styles.iconContainer}>

</View>
<View style={styles.iconContainer}></View>
</View>
</View>
);


return (
<View style={{ flex: 1, paddingHorizontal: 20, paddingTop: 20 }}>
<FlatList
data={posts}
renderItem={renderPost}
keyExtractor={item => item.postID.toString()}
keyExtractor={(item) => item.postID.toString()}
/>
{/* Bottom navigation bar */}
<View style={styles.bottomNavBar}>
<TouchableOpacity onPress={() => navigation.navigate('Guest')}>
<TouchableOpacity onPress={() => navigation.navigate("Guest")}>
<MaterialIcon name="home" size={30} color="green" />
</TouchableOpacity>
<TouchableOpacity onPress={() => navigation.navigate('GuestS')}>
<TouchableOpacity onPress={() => navigation.navigate("GuestS")}>
<MaterialIcon name="search" size={30} color="green" />
</TouchableOpacity>
<TouchableOpacity onPress={() => navigation.navigate('Sign-Up')}>
<TouchableOpacity onPress={() => navigation.navigate("Sign-Up")}>
<MaterialIcon name="person-add" size={30} color="green" />
</TouchableOpacity>
</View>
Expand All @@ -171,11 +188,11 @@ function HomeScreen({ navigation }) {

const styles = StyleSheet.create({
bottomNavBar: {
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
flexDirection: "row",
justifyContent: "space-around",
alignItems: "center",
height: 50,
backgroundColor: '#f0f0f0',
backgroundColor: "#f0f0f0",
},
iconText: {
marginLeft: 3,
Expand Down
Loading