Skip to content

Commit

Permalink
Merge branch 'main' into PORTALS-3339
Browse files Browse the repository at this point in the history
  • Loading branch information
afwillia authored Dec 3, 2024
2 parents d027ada + b221648 commit 3cf4979
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions apps/portals/adknowledgeportal/src/config/resources.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const computationalSql = 'Select * from syn20337467'
export const dataSql = 'SELECT * FROM syn11346063.63'
export const dataSql = 'SELECT * FROM syn11346063.64'
export const dataOnStudiesPageSql =
"SELECT id, name, metadataType, dataType, assay FROM syn11346063.63 WHERE `resourceType` = 'metadata'"
"SELECT id, name, metadataType, dataType, assay FROM syn11346063.64 WHERE `resourceType` = 'metadata'"
export const peopleSql = 'SELECT * FROM syn13897207'
export const projectsSql = 'SELECT * FROM syn17024229 ORDER BY isFeatured DESC'
export const publicationsSql = 'SELECT * FROM syn20448807'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@ const ChallengeDetailPageWrapper = () => {
enabled: !!projectId,
},
)
const { data: teamMembers, isLoading: isTeamMembersLoading } =
SynapseQueries.useGetTeamMembers(challenge?.participantTeamId ?? '', {

const { data: teamMemberCount, isLoading: isTeamMemberCountLoading } =
SynapseQueries.useGetTeamMemberCount(challenge?.participantTeamId ?? '', {
enabled: !!challenge,
})
if (isEntityBundleLoading || isChallengeLoading || isTeamMembersLoading) {
if (isEntityBundleLoading || isChallengeLoading || isTeamMemberCountLoading) {
return <Skeleton height="60px" width="400px" />
}
const isChallengeActive =
entityBundle?.annotations.annotations['Status']?.value[0] == 'Active'
const memberCount = teamMembers?.totalNumberOfResults
const memberCount = teamMemberCount?.count
if (projectId !== undefined) {
return (
// mimic card container layout to align with card fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,9 @@ export class KeyFactory {
public getTeamMembersQueryKey(teamId: string) {
return this.getKey('team', teamId, 'membersList')
}
public getTeamMemberCountQueryKey(teamId: string) {
return this.getKey('team', teamId, 'memberCount')
}

public getIsUserMemberOfTeamQueryKey(teamId: string, userId: string) {
return this.getKey('team', teamId, 'member', userId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
TeamMember,
TeamMembershipStatus,
} from '@sage-bionetworks/synapse-types'
import { Count } from '@sage-bionetworks/synapse-client'

export function useGetTeamMembers(
teamId: string | number,
Expand All @@ -31,6 +32,21 @@ export function useGetTeamMembers(
})
}

export function useGetTeamMemberCount(
teamId: string,
options?: Partial<UseQueryOptions<Count, SynapseClientError>>,
) {
const { keyFactory, synapseClient } = useSynapseContext()
return useQuery({
...options,
queryKey: keyFactory.getTeamMemberCountQueryKey(String(teamId)),
queryFn: () =>
synapseClient.teamServicesClient.getRepoV1TeamMembersCountId({
id: teamId,
}),
})
}

export function useGetIsUserMemberOfTeam(
teamId: string,
userId: string,
Expand Down

0 comments on commit 3cf4979

Please sign in to comment.