Skip to content

Commit

Permalink
dont break please
Browse files Browse the repository at this point in the history
don't break...
  • Loading branch information
Frank-Gu-81 committed Jan 22, 2025
1 parent 8c1da47 commit 4e415f4
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 18 deletions.
37 changes: 37 additions & 0 deletions src/components/Account/Friends/MyFriends.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import { List, ListItem, ListItemText, Button, Container } from '@mui/material';
import { removeFriend } from '../../../utilities/friendService';
import AppBar from '../../AppBar/AppBar';
import NavigationBar from '../../NavigationBar/NavigationBar';
import "./Friends.css";

function MyFriends({ user, friends, loadFriends }) {
const handleUnfriend = async (friendId) => {
await removeFriend(user.uid, friendId);
await loadFriends();
};

return (
<div>
<AppBar />
<Container className="my-friends-page">
<h2>My Friends</h2>
<List>
{friends.length === 0 && <p>You have no friends yet.</p>}
{friends.map((friend) => (
<ListItem key={friend.id}>
<ListItemText
primary={friend.displayName || 'Unknown'}
secondary={friend.email || friend.id}
/>
<Button variant="outlined" onClick={() => handleUnfriend(friend.id)}>Unfriend</Button>
</ListItem>
))}
</List>
</Container>
<NavigationBar />
</div>
);
}

export default MyFriends;
4 changes: 4 additions & 0 deletions src/components/Comment/Comment.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@
.comments-list {
margin-top: 20px;
}

.comment-container {
margin-top: 80px;
}
3 changes: 2 additions & 1 deletion src/components/Comment/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import AppBar from '../AppBar/AppBar';
import NavigationBar from '../NavigationBar/NavigationBar';
import Post from '../Post/Post';
import { useParams } from 'react-router-dom';
import './Comment.css';

function Comment({ userName, profilePic }) {
const post_id = useParams().post_id;
Expand Down Expand Up @@ -86,7 +87,7 @@ function Comment({ userName, profilePic }) {
return (
<div>
<AppBar />
<Container maxWidth="sm">
<Container className="comment-container" maxWidth="sm">
{/* <Typography variant="h5" gutterBottom>
Comments for {post_id}
</Typography> */}
Expand Down
10 changes: 8 additions & 2 deletions src/components/RatingHistory/RatingHistory.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
}

.rating-history-page {
padding: 3em;
height: 100vh;
padding-bottom: 3em;
margin-top: 2px;
margin-bottom: auto;
}

.profile-container {
text-align: center;
padding-top: 100px;
}
28 changes: 14 additions & 14 deletions src/components/RatingHistory/RatingHistory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ function RatingHistory({ userName, profilePic, filteredPost }) {
return (
<div>
<AppBar />
<Container className='rating-history-page'>
<Container>

<Container maxWidth="xs" style={{ textAlign: 'center', paddingTop: '20px' }}>
</Container>

<Container maxWidth="sm">
<Container className="rating-history-page" maxWidth="sm">
<Box paddingBottom="30px">
<Stack spacing={3}>
{ filteredPost.length === 0 ?
(<p>Loading posts...</p>) :
(filteredPost
.slice()
.sort((a, b) => b.date.seconds - a.date.seconds).map((post) =>
<div key={post.id}>
<Post post={post} friends={fake_friends} postAnonymously={false}/>
</div>)
)
}
</Stack>
<Stack spacing={3}>
{ filteredPost.length === 0 ?
(<p>Loading posts...</p>) :
(filteredPost
.slice()
.sort((a, b) => b.date.seconds - a.date.seconds).map((post) =>
<div key={post.id}>
<Post post={post} friends={fake_friends} postAnonymously={false}/>
</div>)
)
}
</Stack>
</Box>
</Container>
<NavigationBar />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { db } from '../utilities/firebase';
import { db } from './firebase';
import {
collection,
doc,
Expand Down

0 comments on commit 4e415f4

Please sign in to comment.