From 12c29fe160d61338a403ec2164cbec34d4427696 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Tue, 25 Jul 2023 18:22:12 +0600 Subject: [PATCH] wip: progress sorting --- src/components/TeamDropdown/TeamDropdown.tsx | 19 +++++++++---------- .../TeamProgress/MemberProgressItem.tsx | 7 +++++-- .../TeamProgress/TeamProgressPage.tsx | 17 ++++++++++++----- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/components/TeamDropdown/TeamDropdown.tsx b/src/components/TeamDropdown/TeamDropdown.tsx index 5fccaa30a..fe4fd3e78 100644 --- a/src/components/TeamDropdown/TeamDropdown.tsx +++ b/src/components/TeamDropdown/TeamDropdown.tsx @@ -76,13 +76,13 @@ export function TeamDropdown() { .filter((team) => team.status === 'invited') .map((team) => team._id); - if ( - !user?.email.endsWith('@insightpartners.com') && - !user?.email.endsWith('@roadmap.sh') && - !['arikchangma@gmail.com', 'kamranahmed.se@gmail.com', 'stephen.chetcuti@gmail.com'].includes(user?.email!) - ) { - return null; - } + // if ( + // !user?.email.endsWith('@insightpartners.com') && + // !user?.email.endsWith('@roadmap.sh') && + // !['arikchangma@gmail.com', 'kamranahmed.se@gmail.com', 'stephen.chetcuti@gmail.com'].includes(user?.email!) + // ) { + // return null; + // } return (
@@ -101,9 +101,8 @@ export function TeamDropdown() { { return b.done - a.done; @@ -31,7 +34,7 @@ export function MemberProgressItem(props: MemberProgressItemProps) { )}
@@ -60,7 +63,7 @@ export function MemberProgressItem(props: MemberProgressItemProps) { > - {progress.resourceTitle} + {progress.resourceTitle} {progress.done} / {progress.total} diff --git a/src/components/TeamProgress/TeamProgressPage.tsx b/src/components/TeamProgress/TeamProgressPage.tsx index 51188d101..7a6aa76fa 100644 --- a/src/components/TeamProgress/TeamProgressPage.tsx +++ b/src/components/TeamProgress/TeamProgressPage.tsx @@ -10,6 +10,7 @@ import { GroupRoadmapItem } from './GroupRoadmapItem'; import { setUrlParams } from '../../lib/browser'; import { getUrlParams } from '../../lib/browser'; import { $toastMessage } from '../../stores/toast'; +import { useAuth } from '../../hooks/use-auth'; export type UserProgress = { resourceTitle: string; @@ -55,6 +56,7 @@ export function TeamProgressPage() { const [isLoading, setIsLoading] = useState(true); const toast = useToast(); const currentTeam = useStore($currentTeam); + const user = useAuth(); const [teamMembers, setTeamMembers] = useState([]); const [selectedGrouping, setSelectedGrouping] = useState< @@ -69,6 +71,12 @@ export function TeamProgressPage() { toast.error(error?.message || 'Failed to get team progress'); return; } + const userProgress = response.find((member) => member.email === user?.email); + if (userProgress) { + const index = response.indexOf(userProgress); + response.splice(index, 1); + response.unshift(userProgress); + } setTeamMembers(response); } @@ -134,11 +142,10 @@ export function TeamProgressPage() {
{groupingTypes.map((grouping) => (