mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-29 03:59:54 +02:00
Friend progress tracking
This commit is contained in:
@@ -221,7 +221,7 @@ export function FriendProgressItem(props: FriendProgressItemProps) {
|
|||||||
'flex w-full flex-grow flex-col items-center justify-center px-4'
|
'flex w-full flex-grow flex-col items-center justify-center px-4'
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<AddUserIcon additionalClasses="mr-2 h-10 w-10 mb-1 text-green-500" />
|
<AddUserIcon additionalClasses="mr-2 h-8 w-8 mb-1 text-green-500" />
|
||||||
<span className="mb-3 text-green-600">Request Received</span>
|
<span className="mb-3 text-green-600">Request Received</span>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
@@ -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 ..');
|
||||||
|
@@ -13,8 +13,10 @@ import { Spinner } from '../ReactIcons/Spinner';
|
|||||||
import { ErrorIcon } from '../ReactIcons/ErrorIcon';
|
import { ErrorIcon } from '../ReactIcons/ErrorIcon';
|
||||||
|
|
||||||
export type ProgressMapProps = {
|
export type ProgressMapProps = {
|
||||||
|
userId?: string;
|
||||||
resourceId: string;
|
resourceId: string;
|
||||||
resourceType: ResourceType;
|
resourceType: ResourceType;
|
||||||
|
onClose?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
type UserProgressResponse = {
|
type UserProgressResponse = {
|
||||||
@@ -31,8 +33,13 @@ type UserProgressResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function UserProgressModal(props: ProgressMapProps) {
|
export function UserProgressModal(props: ProgressMapProps) {
|
||||||
const { s: userId } = getUrlParams();
|
const {
|
||||||
const { resourceId, resourceType } = props;
|
resourceId,
|
||||||
|
resourceType,
|
||||||
|
userId: propUserId,
|
||||||
|
onClose: onModalClose,
|
||||||
|
} = props;
|
||||||
|
const { s: userId = propUserId } = getUrlParams();
|
||||||
|
|
||||||
const resourceSvgEl = useRef<HTMLDivElement>(null);
|
const resourceSvgEl = useRef<HTMLDivElement>(null);
|
||||||
const popupBodyEl = useRef<HTMLDivElement>(null);
|
const popupBodyEl = useRef<HTMLDivElement>(null);
|
||||||
@@ -95,6 +102,7 @@ export function UserProgressModal(props: ProgressMapProps) {
|
|||||||
deleteUrlParam('s');
|
deleteUrlParam('s');
|
||||||
setError('');
|
setError('');
|
||||||
setShowModal(false);
|
setShowModal(false);
|
||||||
|
onModalClose?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
useKeydown('Escape', () => {
|
useKeydown('Escape', () => {
|
||||||
|
@@ -10,6 +10,6 @@ import { FriendsPage } from '../../components/Friends/FriendsPage';
|
|||||||
initialLoadingMessage='Loading friends'
|
initialLoadingMessage='Loading friends'
|
||||||
>
|
>
|
||||||
<AccountSidebar activePageId='friends' activePageTitle='Friends'>
|
<AccountSidebar activePageId='friends' activePageTitle='Friends'>
|
||||||
<FriendsPage client:load />
|
<FriendsPage client:only />
|
||||||
</AccountSidebar>
|
</AccountSidebar>
|
||||||
</AccountLayout>
|
</AccountLayout>
|
||||||
|
Reference in New Issue
Block a user