diff --git a/src/components/Befriend.tsx b/src/components/Befriend.tsx index 32ead3ace..b972471d9 100644 --- a/src/components/Befriend.tsx +++ b/src/components/Befriend.tsx @@ -1,6 +1,5 @@ import { useEffect, useState } from 'preact/hooks'; import { httpDelete, httpGet, httpPatch, httpPost } from '../lib/http'; -import ErrorIcon from '../icons/error.svg'; import { pageProgressMessage } from '../stores/page'; import { isLoggedIn } from '../lib/jwt'; import { showLoginPopup } from '../lib/popup'; @@ -10,7 +9,8 @@ import { DeleteUserIcon } from './ReactIcons/DeleteUserIcon'; import { useToast } from '../hooks/use-toast'; import { useAuth } from '../hooks/use-auth'; import { AddedUserIcon } from './ReactIcons/AddedUserIcon'; -import {StopIcon} from "./ReactIcons/StopIcon"; +import { StopIcon } from './ReactIcons/StopIcon'; +import { ErrorIcon } from './ReactIcons/ErrorIcon'; export type FriendshipStatus = | 'none' @@ -106,11 +106,7 @@ export function Befriend() { if (!user) { return (
diff --git a/src/components/Friends/FriendsPage.tsx b/src/components/Friends/FriendsPage.tsx
index d0d5be541..a6b27de6c 100644
--- a/src/components/Friends/FriendsPage.tsx
+++ b/src/components/Friends/FriendsPage.tsx
@@ -1,12 +1,53 @@
-import { useEffect } from 'preact/hooks';
-import UserPlus from '../../icons/user-plus.svg';
+import { useEffect, useState } from 'preact/hooks';
import { pageProgressMessage } from '../../stores/page';
import { useAuth } from '../../hooks/use-auth';
+import { AddUserIcon } from '../ReactIcons/AddUserIcon';
+import { httpGet } from '../../lib/http';
+import type { FriendshipStatus } from '../Befriend';
+import { useToast } from '../../hooks/use-toast';
import { EmptyFriends } from './EmptyFriends';
+type FriendResourceProgress = {
+ updatedAt: string;
+ title: string;
+ resourceId: string;
+ resourceType: string;
+ learning: number;
+ skipped: number;
+ done: number;
+ total: number;
+};
+
+type ListFriendsResponse = {
+ userId: string;
+ name: string;
+ avatar: string;
+ status: FriendshipStatus;
+ roadmaps: FriendResourceProgress[];
+ bestPractices: FriendResourceProgress[];
+}[];
+
export function FriendsPage() {
+ const toast = useToast();
+ const [friends, setFriends] = useState