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

[feature]: Add a Manage Friends component #197

Open
gbowne1 opened this issue May 2, 2023 · 6 comments
Open

[feature]: Add a Manage Friends component #197

gbowne1 opened this issue May 2, 2023 · 6 comments
Labels
design frontend This is a frontend issue or PR good first issue Good for newcomers help wanted Extra attention is needed medium-complexity This issue is medium complexity medium-priority tech-debt This needs refactoring or improvement
Milestone

Comments

@gbowne1
Copy link
Owner

gbowne1 commented May 2, 2023

Is your feature request related to a problem? Please describe.

We should have an easily accessible means of Unfriending, Blocking, Reporting, Muting the users Friends.

Describe the solution you would like

We can show the users a list of their friends in a table, with some controls to block, unfriend, unfollow, mute temporarily, etc.

This needs to be easily accessible from the Friends panel accessible from the SideNav.

Describe the alternatives you have tried

Facebook has a new Manage Friends modal, but its hard to get to and only has controls to unfriend.

Additional context

I can propose some initial code to go with this.

This should be an addition of the Friends component and functionality so that it is easy to find.

@gbowne1 gbowne1 added enhancement New feature or request help wanted Extra attention is needed labels May 2, 2023
@gbowne1 gbowne1 added this to the Front End milestone May 2, 2023
@gbowne1
Copy link
Owner Author

gbowne1 commented May 2, 2023

@manuel12 @pawel975

Here is the code I propose:

ManageFriends.jsx

import React, { useState, useEffect, useContext, useRef, useCallback, useMemo } from 'react';
import PropTypes from 'prop-types';
import { useHistory } from 'react-router-dom';
import Panel from "../../components/Panel/Panel";
import BlockIcon from '@material-ui/icons/Block';
import DeleteIcon from '@material-ui/icons/Delete';
import UnfollowIcon from '@material-ui/icons/RemoveCircleOutline';
import MuteIcon from '@material-ui/icons/VolumeOff';
import IconButton from '@material-ui/core/IconButton';

const ManageFriends = (props) => {
  const [isOpen, setIsOpen] = useState(false);
  const history = useHistory();
  const friendsList = useContext(FriendsListContext);
  // other state variables and hooks here
  
  useEffect(() => {
    // code to run on mount or when dependencies change
  }, [/* dependencies go here */]);
  
  const handleBlock = useCallback(() => {
    // code to handle blocking a friend
  }, [/* dependencies go here */]);
  
  // other callback functions here
  
  const handleUnfriend = () => {
    // code to handle unfriending a friend
  };
  
  // other event handler functions here
  
  const memoizedValue = useMemo(() => {
    // code to create memoized value
  }, [/* dependencies go here */]);
  
  // other code here
  
  return (
    <Panel
      themeMode={props.themeMode}
      titleHeading="Manage Friends"
      contentHeading="Friends List"
      isOpen={isOpen}
      setIsOpen={setIsOpen}
    >
      {friendsList.map((friend) => (
        <div key={friend.id}>
          <span>{friend.name}</span>
          <IconButton onClick={handleBlock}>
            <BlockIcon />
          </IconButton>
          <IconButton onClick={handleUnfriend}>
            <DeleteIcon />
          </IconButton>
          <IconButton onClick={handleUnfollow}>
            <UnfollowIcon />
          </IconButton>
          <IconButton onClick={handleMute}>
            <MuteIcon />
          </IconButton>
        </div>
      ))}
    </Panel>
  );
};

ManageFriends.propTypes = {
  themeMode: PropTypes.string.isRequired
};

ManageFriends.css

.ManageFriends-header {
  height: 60px;
  background-color: #333;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.Panel {
  width: 1318.8px;
  height: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.ManageFriends-controls {
  width: 640px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 20px;
}

.ManageFriends-control {
  width: 150px;
  height: 50px;
  background-color: #ccc;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.ManageFriends-control:hover {
  background-color: #666;
}

@pawel975
Copy link
Collaborator

pawel975 commented May 3, 2023

Looks good to me.

@gbowne1
Copy link
Owner Author

gbowne1 commented May 3, 2023

Great thanks @pawel975

Someone could easily make the compoment better.

I will get a PR done here soon.

@manuel12
Copy link
Collaborator

manuel12 commented May 3, 2023

Also looks good to me. We can PR this.

@gbowne1
Copy link
Owner Author

gbowne1 commented May 3, 2023

I think this was a good idea. Wasn't too sure about its structure.. but this would or at least should give a way for this component to get built. I was thinking about making part of this component a table of friends using their photo or Avatar.

@gbowne1 gbowne1 added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers question Further information is requested css Issues with css and removed enhancement New feature or request help wanted Extra attention is needed labels May 31, 2023
@gbowne1 gbowne1 removed this from the Front End milestone Jun 5, 2023
@gbowne1 gbowne1 added this to the Friend System milestone Jun 13, 2023
@gbowne1 gbowne1 self-assigned this Jun 13, 2023
@gbowne1
Copy link
Owner Author

gbowne1 commented Jun 13, 2023

Adding myself to this so we can get moving on some issues.

@gbowne1 gbowne1 moved this to Todo in ReactSocialNetwork Oct 4, 2023
@gbowne1 gbowne1 added the hacktoberfest The hacktoberfest label label Oct 4, 2023
@gbowne1 gbowne1 removed their assignment Oct 6, 2023
@gbowne1 gbowne1 removed bug Something isn't working documentation Improvements or additions to documentation labels Feb 21, 2024
@gbowne1 gbowne1 added help wanted Extra attention is needed good first issue Good for newcomers frontend This is a frontend issue or PR design medium-priority medium-complexity This issue is medium complexity tech-debt This needs refactoring or improvement and removed enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers question Further information is requested css Issues with css hacktoberfest The hacktoberfest label labels Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design frontend This is a frontend issue or PR good first issue Good for newcomers help wanted Extra attention is needed medium-complexity This issue is medium complexity medium-priority tech-debt This needs refactoring or improvement
Projects
Development

No branches or pull requests

3 participants