|
|
@ -8,6 +8,7 @@ import { useToast } from '../../hooks/use-toast'; |
|
|
|
import { EmptyFriends } from './EmptyFriends'; |
|
|
|
import { EmptyFriends } from './EmptyFriends'; |
|
|
|
import { FriendProgressItem } from './FriendProgressItem'; |
|
|
|
import { FriendProgressItem } from './FriendProgressItem'; |
|
|
|
import UserIcon from '../../icons/user.svg'; |
|
|
|
import UserIcon from '../../icons/user.svg'; |
|
|
|
|
|
|
|
import { UserProgressModal } from '../UserProgress/UserProgressModal'; |
|
|
|
|
|
|
|
|
|
|
|
type FriendResourceProgress = { |
|
|
|
type FriendResourceProgress = { |
|
|
|
updatedAt: string; |
|
|
|
updatedAt: string; |
|
|
@ -45,6 +46,11 @@ const groupingTypes: GroupingType[] = [ |
|
|
|
export function FriendsPage() { |
|
|
|
export function FriendsPage() { |
|
|
|
const toast = useToast(); |
|
|
|
const toast = useToast(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [showFriendProgress, setShowFriendProgress] = useState<{ |
|
|
|
|
|
|
|
resourceId: string; |
|
|
|
|
|
|
|
friend: ListFriendsResponse[0]; |
|
|
|
|
|
|
|
}>(); |
|
|
|
|
|
|
|
|
|
|
|
const [isLoading, setIsLoading] = useState(true); |
|
|
|
const [isLoading, setIsLoading] = useState(true); |
|
|
|
const [friends, setFriends] = useState<ListFriendsResponse>([]); |
|
|
|
const [friends, setFriends] = useState<ListFriendsResponse>([]); |
|
|
|
const [selectedGrouping, setSelectedGrouping] = |
|
|
|
const [selectedGrouping, setSelectedGrouping] = |
|
|
@ -102,6 +108,15 @@ export function FriendsPage() { |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
|
|
|
|
{showFriendProgress && ( |
|
|
|
|
|
|
|
<UserProgressModal |
|
|
|
|
|
|
|
userId={showFriendProgress.friend.userId} |
|
|
|
|
|
|
|
resourceId={showFriendProgress.resourceId} |
|
|
|
|
|
|
|
resourceType={'roadmap'} |
|
|
|
|
|
|
|
onClose={() => setShowFriendProgress(undefined)} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|
<div className="mb-4 flex items-center justify-between"> |
|
|
|
<div className="mb-4 flex items-center justify-between"> |
|
|
|
<div className="flex items-center gap-2"> |
|
|
|
<div className="flex items-center gap-2"> |
|
|
|
{groupingTypes.map((grouping) => { |
|
|
|
{groupingTypes.map((grouping) => { |
|
|
@ -140,7 +155,12 @@ export function FriendsPage() { |
|
|
|
{filteredFriends.map((friend) => ( |
|
|
|
{filteredFriends.map((friend) => ( |
|
|
|
<FriendProgressItem |
|
|
|
<FriendProgressItem |
|
|
|
friend={friend} |
|
|
|
friend={friend} |
|
|
|
onShowResourceProgress={(resourceId) => {}} |
|
|
|
onShowResourceProgress={(resourceId) => { |
|
|
|
|
|
|
|
setShowFriendProgress({ |
|
|
|
|
|
|
|
resourceId, |
|
|
|
|
|
|
|
friend, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}} |
|
|
|
key={friend.userId} |
|
|
|
key={friend.userId} |
|
|
|
onReload={() => { |
|
|
|
onReload={() => { |
|
|
|
pageProgressMessage.set('Reloading friends ..'); |
|
|
|
pageProgressMessage.set('Reloading friends ..'); |
|
|
|