Skip to content

Commit 998e5d6

Browse files
committed
Minor cleanup and layout changes
1 parent 0e52374 commit 998e5d6

10 files changed

Lines changed: 9 additions & 54 deletions

File tree

client/src/components/ui/popups/user_friends_add_popup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { removeFriend,sendFriendRequest } from "../../../lib/api/friends";
1+
import { removeFriend, sendFriendRequest } from "../../../lib/api/friends";
22
import { OtherUsers } from "../user_tables/user_friends_add_table";
33

44
const FriendAddItemModal = ({

client/src/components/ui/popups/user_friends_search_popup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ function UserFriendsSearchPopup({ isOpen, onClose }: ItemModalProps) {
3636
placeholder="Eg., Ky Kiske"
3737
/>
3838
<button
39-
className="absolute right-1 top-1 flex items-center rounded border border-transparent bg-slate-800 px-2.5 py-1 text-center text-sm text-white shadow-sm transition-all hover:bg-slate-700 hover:shadow focus:bg-slate-700 focus:shadow-none active:bg-slate-700 active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
4039
type="button"
40+
className="absolute right-1 top-1 flex items-center rounded border border-transparent bg-slate-800 px-2.5 py-1 text-center text-sm text-white shadow-sm transition-all hover:bg-slate-700 hover:shadow focus:bg-slate-700 focus:shadow-none active:bg-slate-700 active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
4141
>
4242
<svg
4343
xmlns="http://www.w3.org/2000/svg"

client/src/components/ui/popups/user_friends_select_popup.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ function UserFriendsSelectPopup({ isOpen, item, onClose }: ItemModalProps) {
2727
{/* Header */}
2828
{/* Avatar */}
2929
<ProfilePicture />
30+
{/* Implement below when we implement a profile picture field */}
31+
3032
{/* {profile_picture === Null ? (
3133
<ProfilePicture/>
3234
) : (

client/src/components/ui/popups/user_inventory_select_popup.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// import Link from "next/link";
44
import React from "react";
55

6+
import ProfilePicture from "../profile_picture"; // Replace with item image when available
7+
68
type InventoryItem = {
79
id: number;
810
name: string;
@@ -31,12 +33,7 @@ function UserInventorySelectPopup({
3133
<div className="flex gap-4">
3234
{/* Header */}
3335
{/* Avatar */}
34-
<div className="relative flex justify-between">
35-
<div className="relative flex h-24 w-24 items-center justify-center overflow-hidden rounded-full bg-blue-500">
36-
<div className="absolute top-5 h-12 w-12 rounded-full bg-blue-200"></div>
37-
<div className="absolute -bottom-2 left-1/2 h-12 w-16 -translate-x-1/2 rounded-full bg-blue-200"></div>
38-
</div>
39-
</div>
36+
<ProfilePicture />
4037
{/* Text column */}
4138
<div className="flex min-w-0 flex-1 flex-col">
4239
{/* Name */}

client/src/components/ui/user_navbar.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@ const UserNavbar = () => {
1515
null,
1616
);
1717

18-
// modal logic
19-
// const handleOpen = () => {
20-
// setIsModalOpen(true);
21-
// };
22-
// const handleClose = () => {
23-
// setIsModalOpen(false);
24-
// };
25-
2618
return (
2719
<>
2820
{/* 1. Navigation Bar */}
@@ -54,8 +46,8 @@ const UserNavbar = () => {
5446
placeholder="Eg., Ky Kiske"
5547
/>
5648
<button
57-
className="absolute right-1 top-1 flex items-center rounded border border-transparent bg-slate-800 px-2.5 py-1 text-center text-sm text-white shadow-sm transition-all hover:bg-slate-700 hover:shadow focus:bg-slate-700 focus:shadow-none active:bg-slate-700 active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
5849
type="button"
50+
className="absolute right-1 top-1 flex items-center rounded border border-transparent bg-slate-800 px-2.5 py-1 text-center text-sm text-white shadow-sm transition-all hover:bg-slate-700 hover:shadow focus:bg-slate-700 focus:shadow-none active:bg-slate-700 active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
5951
>
6052
<svg
6153
xmlns="http://www.w3.org/2000/svg"
@@ -138,7 +130,6 @@ const UserNavbar = () => {
138130
>
139131
Login
140132
</button>
141-
{/* <a href="/user_login">Login</a> */}
142133
</Link>
143134
</div>
144135
)}

client/src/components/ui/user_tables/user_friends_table.tsx

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,11 @@ import { getFriends } from "../../../lib/api/friends";
66
import { Friend } from "../../../types/friends";
77
import FriendItemModal from "../popups/user_friends_select_popup";
88

9-
// export type MyFriends = {
10-
// id: number;
11-
// username: string;
12-
13-
// };
14-
// profile_picture?: string | null;
15-
169
const UserFriendsTable = () => {
17-
// const [selectedItem, setSelectedItem] = useState<MyFriends | null>(null);
18-
// const [isModalOpen, setIsModalOpen] = useState(false);
19-
// const [friends, SetFriends] = useState<MyFriends[]>([]);
2010
const [selectedItem, setSelectedItem] = useState<Friend | null>(null);
2111
const [isModalOpen, setIsModalOpen] = useState(false);
2212
const [friends, setFriends] = useState<Friend[]>([]);
2313

24-
// Mock data (replace with Django API call later)
25-
// useEffect(() => {
26-
// getFriends().then((res) => {
27-
// const normalized = res.data.friends.map((f: any) => ({
28-
// id: f.id,
29-
// username: f.username,
30-
// // profile_picture: f.profile_picture,
31-
// }));
32-
33-
// SetFriends(normalized);
34-
// });
35-
// }, []);
3614
useEffect(() => {
3715
getFriends().then((res) => {
3816
setFriends(res.data.friends);

client/src/pages/user_friends.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const UserFriendsPage = () => {
3333
<h2 className="mb-2 text-xl font-semibold">My Friends</h2>
3434

3535
<button
36-
className="cursor-pointer text-sm font-semibold text-blue-600 hover:underline"
3736
onClick={() => {
3837
setIsModalOpen(true);
3938
}}
39+
className="cursor-pointer text-sm font-semibold text-blue-600 hover:underline"
4040
>
4141
+ Friends{" "}
4242
</button>

client/src/pages/user_groups.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@ import UserNavbar from "../components/ui/user_navbar";
77
// import {useState, useEffect} from "react";
88
import UserGroupsTable from "../components/ui/user_tables/user_groups_table";
99

10-
// type MyGroups = {
11-
// id: number;
12-
// name: string;
13-
// }
14-
15-
{
16-
/* optional: later have a list for friends in said groups or something in above "my groups" */
17-
}
18-
1910
// The Header component is now one directory level up from 'pages',
2011
// so the path is '../components/Header'
2112
//import Header from '../components/Header';

server/friend/models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
class FriendList(models.Model):
1313

14-
# user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="user")
15-
# friends = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True, related_name="friends")
1614
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="friend_list")
1715
friends = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True, related_name="friends_of")
1816

server/friend/views.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def post(self, request, request_id):
4646
friend_request.decline()
4747
return Response({"success": "Friend request declined"})
4848

49-
# TESTING OUT
5049
class CancelFriendRequest(APIView):
5150
permission_classes = [IsAuthenticated]
5251

@@ -72,7 +71,6 @@ def get(self, request):
7271
serializer = FriendRequestSerializer(requests, many=True)
7372
return Response(serializer.data)
7473

75-
# TESTING OUT
7674
class RemoveFriends(APIView):
7775
permission_classes = [IsAuthenticated]
7876

0 commit comments

Comments
 (0)