|
|
|
@ -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<TeamMember[]>([]); |
|
|
|
|
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,8 +142,7 @@ export function TeamProgressPage() { |
|
|
|
|
<div className="flex items-center gap-2"> |
|
|
|
|
{groupingTypes.map((grouping) => ( |
|
|
|
|
<button |
|
|
|
|
className={`rounded-md border p-1 px-2 text-sm ${ |
|
|
|
|
selectedGrouping === grouping.value |
|
|
|
|
className={`rounded-md border p-1 px-2 text-sm ${selectedGrouping === grouping.value |
|
|
|
|
? ' border-gray-400 bg-gray-200 ' |
|
|
|
|
: '' |
|
|
|
|
}`}
|
|
|
|
|