Skip to content

Commit

Permalink
Removed friend requests button/page
Browse files Browse the repository at this point in the history
  • Loading branch information
bc2k13 committed Jan 21, 2025
1 parent 1526c5a commit 2388a13
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 215 deletions.
9 changes: 0 additions & 9 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import SignIn from './components/SignIn/SignIn';
import Feed from './components/Feed/Feed';
import Submission from './components/Submission/Submission';
import Account from './components/Account/Account';
import FriendRequests from './components/Account/Friends/FriendRequests';
import MyFriends from './components/Account/Friends/MyFriends';
import RatingHistory from './components/RatingHistory/RatingHistory';
import Comment from './components/Comment/Comment';
Expand Down Expand Up @@ -77,14 +76,6 @@ function App() {
: <Navigate to="/" />
}
/>
<Route
path="/friend-requests"
element={
isAuthenticated
? <FriendRequests user={user} />
: <Navigate to="/" />
}
/>
<Route
path="/my-friends"
element={
Expand Down
182 changes: 0 additions & 182 deletions src/components/Account/Friends/FriendRequests.jsx

This file was deleted.

8 changes: 1 addition & 7 deletions src/components/Account/Friends/Friends.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
.friend-requests-page {
margin-top: 3rem;
padding-top: 3rem;
height: calc(100vh - 56px - 64px);
overflow-y: auto;
}


.my-friends-page {
margin-top: 3rem;
padding-top: 3rem;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Account/Friends/MyFriends.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect } from 'react';
import { List, ListItem, ListItemText, Button, Container } from '@mui/material';
import { fetchUserFriends, removeFriend } from '../../../services/friendService';
import { doc, getDoc } from 'firebase/firestore';
Expand Down
27 changes: 12 additions & 15 deletions src/components/AppBar/AppBar.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
import PersonSearchIcon from '@mui/icons-material/PersonSearch';
import PeopleAltIcon from '@mui/icons-material/PeopleAlt';
import "./AppBar.css";

function AppBar() {
Expand All @@ -10,33 +10,31 @@ function AppBar() {

let title = "CourseBuddy";
let showBackButton = false;
let showFriendRequestsIcon = false;
let showMyFriendsIcon = false;

if (location.pathname.startsWith('/feed')) {
title = "CourseBuddy";
} else if (location.pathname.startsWith('/submission')) {
title = "New Review";
} else if (location.pathname.startsWith('/account')) {
title = "My Account";
showFriendRequestsIcon = true;
} else if (location.pathname.startsWith('/search')) {
title = "Friends";
showMyFriendsIcon = true;
}

if (location.pathname === '/friend-requests') {
title = "Friend Requests";
showBackButton = true;
showFriendRequestsIcon = false;
} else if (location.pathname === '/my-friends') {
if (location.pathname === '/my-friends') {
title = "My Friends";
showBackButton = true;
showFriendRequestsIcon = false;
showMyFriendsIcon = false;
}

const handleBackClick = () => {
navigate(-1);
};

const handleFriendRequestsClick = () => {
navigate('/friend-requests');
const handleMyFriendsClick = () => {
navigate('/my-friends');
};

return (
Expand All @@ -46,12 +44,11 @@ function AppBar() {
<ArrowBackIcon />
</button>
)}

<h1 className="app-bar-title">{title}</h1>

{showFriendRequestsIcon && (
<button className="icon-button" onClick={handleFriendRequestsClick}>
<PersonSearchIcon />
{showMyFriendsIcon && (
<button className="icon-button" onClick={handleMyFriendsClick}>
<PeopleAltIcon />
</button>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/NavigationBar/NavigationBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ function NavigationBar() {
return (
<BottomNavigation className="nav-bar" showLabels>
<BottomNavigationAction label="Feed" icon={<RestoreIcon />} component={Link} to="/feed" />
<BottomNavigationAction label="Friends" icon={<PersonSearchIcon />} component={Link} to="/search" />
<BottomNavigationAction label="Post" icon={<RateReviewIcon />} component={Link} to="/submission" />
<BottomNavigationAction label="Friends" icon={<PersonSearchIcon />} component={Link} to="/search" />
<BottomNavigationAction label="Profile" icon={<AccountCircleIcon />} component={Link} to="/account" />
</BottomNavigation>
);
Expand Down

0 comments on commit 2388a13

Please sign in to comment.