diff --git a/packages/utils/state/models/teamsModel.ts b/packages/utils/state/models/teamsModel.ts index 948618f515e3924a63388e3af57b6ee5a8f3e4e5..fa0d31413dae3878d48e5b085fb36c0c1918fc0c 100644 --- a/packages/utils/state/models/teamsModel.ts +++ b/packages/utils/state/models/teamsModel.ts @@ -74,10 +74,7 @@ export interface Team { // group?: Group; sessions?: Session[]; artifacts: TeamArtifact[]; - // TODO maybe remove? - deliverables?: TeamDeliverable[]; deliverableStatus?: TeamDeliverableStatus[]; - forms?: Form<TeamForm>[]; logs?: ActivityLog[]; wikiURL?: string; softwareURL?: string; @@ -113,6 +110,7 @@ export interface TeamDeliverable { deliverableUUID: DeliverableUUID; submitted: boolean; accepted?: boolean; + artifactUUID?: TeamArtifactUUID; artifact?: TeamArtifact; reviewerComments?: string; form?: Form<TeamForm>; diff --git a/packages/utils/state/slices/api/eventsSlice.ts b/packages/utils/state/slices/api/eventsSlice.ts index 18cbd0f66a629f674720b36634c2116f5c28a906..b155eb8e73502b03d72178652686bdd9de247a78 100644 --- a/packages/utils/state/slices/api/eventsSlice.ts +++ b/packages/utils/state/slices/api/eventsSlice.ts @@ -27,6 +27,7 @@ import { SessionLocationUUID, SessionStatus, SessionType, + TeamID, UpsertLiveStream, UpsertSession, UpsertSessionLocation, @@ -162,6 +163,10 @@ export const eventsSlice = apiSlice providesTags: ["Session"], }), + findTeamSessions: builder.query<Session[], TeamID>({ + query: (teamID) => `events/sessions/teams/${teamID}`, + }), + importEventSessions: builder.mutation< void, { eventUUID: EventUUID; file: File } @@ -525,4 +530,5 @@ export const { useUploadEventSessionPhotoMutation, useDeleteEventSessionPhotoMutation, useUpdateSessionVideoMutation, + useFindTeamSessionsQuery, } = eventsSlice; diff --git a/packages/utils/state/slices/api/teamsSlice.ts b/packages/utils/state/slices/api/teamsSlice.ts index ac2e88a76cad93eb262d53591a3b142249f530f9..f9d83beffd5b44a28b61e26a68a493925b74dfaf 100644 --- a/packages/utils/state/slices/api/teamsSlice.ts +++ b/packages/utils/state/slices/api/teamsSlice.ts @@ -528,6 +528,11 @@ export const teamsSlice = apiSlice }, }), + findTeamArtifacts: builder.query<TeamArtifact[], { teamID: TeamID }>({ + query: ({ teamID }) => `teams/${teamID}/artifacts`, + providesTags: ["AllTeamArtifacts"], + }), + importTeamBooths: builder.mutation< void, { body: FormData; competitionUUID: CompetitionUUID } @@ -611,6 +616,15 @@ export const teamsSlice = apiSlice }), providesTags: ["Deliverables"], }), + findVisibleTeamDeliverables: builder.query< + TeamDeliverableStatus[], + { teamID: TeamID } + >({ + query: ({ teamID }) => `teams/${teamID}/deliverables/public`, + extraOptions: { + skipErrorHandling: true, + }, + }), findTeamDeliverableStatus: builder.query< TeamDeliverableStatus, { teamID: TeamID; deliverableUUID: DeliverableUUID } @@ -1053,4 +1067,6 @@ export const { useFindTeamAssociationQuery, useLazySearchCompetitionFormsQuery, useUpdateCompetitionFormStatusMutation, + useFindTeamArtifactsQuery, + useFindVisibleTeamDeliverablesQuery, } = teamsSlice; diff --git a/websites/community/src/utils/ContentIndex.tsx b/websites/community/src/utils/ContentIndex.tsx index b7b586dba296317ceefbe9a730f84bd747311f08..106d9aa6c055a1666accd0192eef338c1f234604 100644 --- a/websites/community/src/utils/ContentIndex.tsx +++ b/websites/community/src/utils/ContentIndex.tsx @@ -195,6 +195,7 @@ import Event_igemataustralasiansynbiocompetition from "@/content/events/attended import Event_igemataustraliaandnewzealandigemregionalmeetup2024 from "@/content/events/attended/igem-at-australia-and-new-zealand-igem-regional-meetup-2024.mdx"; import Event_igematbeneluxgermanyminijamboree2024 from "@/content/events/attended/igem-at-benelux-germany-mini-jamboree-2024.mdx"; import Event_igematbiomania from "@/content/events/attended/igem-at-biomania.mdx"; +import Event_igematbiospectrum2024 from "@/content/events/attended/igem-at-biospectrum-2024.mdx"; import Event_igematbioteclinandounifal from "@/content/events/attended/igem-at-bioteclinando-unifal.mdx"; import Event_igematbrazilianmeetup2024 from "@/content/events/attended/igem-at-brazilian-meetup-2024.mdx"; import Event_igematbuiltwithbiology from "@/content/events/attended/igem-at-built-with-biology.mdx"; @@ -250,7 +251,6 @@ import Event_igematxjornadasdelasinvestigadorasdecastillayleon from "@/content/e import Event_igeminformationsessionnewzealand from "@/content/events/attended/igem-information-session-new-zealand.mdx"; import Event_promotingsyntheticbiologyinthailand from "@/content/events/attended/promoting-synthetic-biology-in-thailand.mdx"; import Event_synbioforthefutureinbangladesh from "@/content/events/attended/synbio-for-the-future-in-bangladesh.mdx"; -import Event_igematbiospectrum2024 from "@/content/events/attended/igem-at-biospectrum-2024.mdx"; // EVENTS (ORGANIZED) import Event_kickoffevent2021 from "@/content/events/organized/2021-igem-community-kickoff.mdx"; diff --git a/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.utils.tsx b/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.utils.tsx index bc8b52bb00bd8d5566083f1a58d642e6771250e4..54aad98bc54e106fdbf03921925344ab228e7c9a 100644 --- a/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.utils.tsx +++ b/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.utils.tsx @@ -18,6 +18,7 @@ export interface DeliverablesRow { icon: string; title: string; open: boolean; + openTime?: Date; closeTime?: Date; } diff --git a/websites/hq/src/containers/Jamboree/Schedule/components/UpsertSession/UpsertSessionForm.tsx b/websites/hq/src/containers/Jamboree/Schedule/components/UpsertSession/UpsertSessionForm.tsx index 5c06cd60940c789e4e33276621beb55cb3232d50..b4e8f101be6be53df3f468db70db07d0429f62f2 100644 --- a/websites/hq/src/containers/Jamboree/Schedule/components/UpsertSession/UpsertSessionForm.tsx +++ b/websites/hq/src/containers/Jamboree/Schedule/components/UpsertSession/UpsertSessionForm.tsx @@ -30,7 +30,6 @@ import { UpsertSession, useFindEventLocationsQuery, useFindEventSessionsAdminMetadataQuery, - useFindTeamByIDQuery, } from "utils"; export function UpsertSessionForm({ @@ -44,9 +43,6 @@ export function UpsertSessionForm({ onSubmit: (body: UpsertSession) => Promise<void>; isCreating?: boolean; }): ReactNode { - const { data: team } = useFindTeamByIDQuery(session?.team?.id as number, { - skip: session?.team == null, - }); const { data: metadata } = useFindEventSessionsAdminMetadataQuery(eventUUID); const { data: locations = [] } = useFindEventLocationsQuery(eventUUID); @@ -81,10 +77,10 @@ export function UpsertSessionForm({ <Button className="mt-2">Submit</Button> </div> <div className="w-fit"> - {team != null && ( + {session?.team?.id != null && ( <p className="pb-2"> <LinkWrapper - link={`https://teams.igem.org/${team.id}`} + link={`https://teams.igem.org/${session.team.id}`} className="flex items-center gap-x-1" > Team Page <ArrowRight /> diff --git a/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx b/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx index 45a584d4fa18f0af13c7c73c1046f0eefde64f47..d528911bffd9d64aab7d9fbc3d7aeaf23bcb7fd0 100644 --- a/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx +++ b/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx @@ -22,7 +22,9 @@ import { TeamArtifactType, TeamDescription, TeamStatus, + useFindTeamArtifactsQuery, useFindTeamByIDQuery, + useFindTeamSessionsQuery, } from "utils"; interface TeamInfoPageProps { @@ -45,14 +47,28 @@ export function TeamInfoPage({ skip: teamIDForQuery == null, }); + const { data: teamArtifacts, isLoading: isLoadingArtifacts } = + useFindTeamArtifactsQuery( + { + teamID: teamIDForQuery as number, + }, + { skip: teamIDForQuery == null }, + ); + + const { data: teamSessions, isLoading: isLoadingSessions } = + useFindTeamSessionsQuery(teamIDForQuery as number, { + skip: teamIDForQuery == null, + }); + if (!teamIDForQuery || isError) return <NotFound />; - if (isLoading || team == null) + + if (isLoadingArtifacts || isLoadingSessions || isLoading || team == null) return <SkeletonSession className={className} />; - const descriptionMetadata = team.artifacts.find( + const descriptionMetadata = teamArtifacts?.find( (artifact) => artifact.type === TeamArtifactType.DESCRIPTION, )?.metadata as TeamDescription | undefined | null; - const teamBooths = team.artifacts.filter( + const teamBooths = teamArtifacts?.filter( (artifact) => artifact.type === TeamArtifactType.JAMBOREE_BOOTH, ); @@ -75,7 +91,7 @@ export function TeamInfoPage({ /> )} <div className="flex flex-col gap-6 md:gap-12"> - {descriptionMetadata && ( + {descriptionMetadata != null && ( <CardSection title={"Title"}> <TeamProjectTitleCard title={descriptionMetadata.title} @@ -83,7 +99,7 @@ export function TeamInfoPage({ /> </CardSection> )} - {descriptionMetadata && ( + {descriptionMetadata != null && ( <CardSection title={"Description"}> <SessionDescriptionCard description={descriptionMetadata.abstract} @@ -110,10 +126,10 @@ export function TeamInfoPage({ ))} </CardSection> )} - {team.sessions && team.sessions.length > 0 && ( + {teamSessions && teamSessions.length > 0 && ( <CardSection title={"Scheduled Sessions"}> <SessionTeamSessionsCard - sessions={team.sessions} + sessions={teamSessions} eventUUID={eventUUID} onClick={(sessionUUID) => setSessionUUID(sessionUUID)} /> diff --git a/websites/judging/src/containers/Ballot/Ballot.tsx b/websites/judging/src/containers/Ballot/Ballot.tsx index 41ee6ab559f52b9ec3087d2580fec02993649965..ff06628e4ac30cb89ef8ce963b130bcd682e0978 100644 --- a/websites/judging/src/containers/Ballot/Ballot.tsx +++ b/websites/judging/src/containers/Ballot/Ballot.tsx @@ -30,6 +30,7 @@ export function Ballot(): ReactNode { { teamID, judgeUUID: judgeUUID ?? (judge?.uuid as string) }, { skip: judgeUUID == null && judge == null }, ); + const { data: votes = { votes: [], comments: [] }, isFetching: isFetchingVotes, diff --git a/websites/judging/src/containers/Ballot/Team/Team.tsx b/websites/judging/src/containers/Ballot/Team/Team.tsx index 596a36738e59d488b92d398930dd07a8194e3b45..ee13458557b263555c0dac9acc08e4035122e215 100644 --- a/websites/judging/src/containers/Ballot/Team/Team.tsx +++ b/websites/judging/src/containers/Ballot/Team/Team.tsx @@ -17,22 +17,30 @@ import { TeamArtifactType, TeamDescription, VideoUUID, + useFindTeamArtifactsQuery, } from "utils"; export function BallotTeam({ team }: { team: Team }): ReactNode { - const description = team.artifacts?.find( + const { data: artifacts } = useFindTeamArtifactsQuery( + { + teamID: team.id, + }, + { skip: team.artifacts != null }, + ); + const teamArtifacts = team.artifacts ?? artifacts; + const description = teamArtifacts?.find( (artifact) => artifact.type === TeamArtifactType.DESCRIPTION, )?.metadata as TeamDescription | undefined; - const booth = team.artifacts?.find( + const booth = teamArtifacts?.find( (artifact) => artifact.type === TeamArtifactType.JAMBOREE_BOOTH, ) as TeamArtifact | undefined; - const presentation = team.artifacts?.find( + const presentation = teamArtifacts?.find( (artifact) => artifact.type === TeamArtifactType.TEAM_PRESENTATION, )?.videoUUID as string | undefined; - const projectPromotion = team.artifacts?.find( + const projectPromotion = teamArtifacts?.find( (artifact) => artifact.type === TeamArtifactType.PROJECT_PROMOTION, )?.videoUUID as string | undefined; diff --git a/websites/storybook/src/stories/prebuilt/MyDuties.stories.tsx b/websites/storybook/src/stories/prebuilt/MyDuties.stories.tsx index b16f69ed841ba202521c7a33abf0fccb0a223363..cbf7ef2429f21bc718e6163b7766f1f506a6d2ee 100644 --- a/websites/storybook/src/stories/prebuilt/MyDuties.stories.tsx +++ b/websites/storybook/src/stories/prebuilt/MyDuties.stories.tsx @@ -7,6 +7,7 @@ import { SessionType, TeamRole, useFindTeamByIDQuery, + useFindTeamSessionsQuery, } from "utils"; export default { @@ -19,9 +20,11 @@ export default { const Template: StoryFn = (props) => { const { data: team } = useFindTeamByIDQuery(mockTeamID as string); + const { data: teamSessions } = useFindTeamSessionsQuery(Number(mockTeamID)); + let sessions: JudgingSession[] = []; - if (team && team.sessions) { - sessions = team.sessions + if (team && teamSessions) { + sessions = teamSessions .filter( (session) => session.type === SessionType.JUDGING_SESSION && session.location, diff --git a/websites/storybook/src/stories/prebuilt/session/SessionTeamBoothCard.stories.tsx b/websites/storybook/src/stories/prebuilt/session/SessionTeamBoothCard.stories.tsx index 7d80e6b97561708e40e72e2093d116d5390fda14..92e0f5392b12c757a9871caf6c19b6a38558d1f6 100644 --- a/websites/storybook/src/stories/prebuilt/session/SessionTeamBoothCard.stories.tsx +++ b/websites/storybook/src/stories/prebuilt/session/SessionTeamBoothCard.stories.tsx @@ -2,7 +2,7 @@ import { mockTeamID } from "@/stories/mocks"; import { withProvider } from "@/utils/withProvider"; import { StoryFn } from "@storybook/react"; import { SessionTeamBoothCard } from "ui"; -import { TeamArtifactType, useFindTeamByIDQuery } from "utils"; +import { TeamArtifactType, useFindTeamArtifactsQuery } from "utils"; export default { title: "Prebuilt/Session/SessionTeamBoothCard", @@ -12,13 +12,15 @@ export default { }; const Template: StoryFn = () => { - const { data: team } = useFindTeamByIDQuery(mockTeamID as string); + const { data: teamArtifacts } = useFindTeamArtifactsQuery({ + teamID: Number(mockTeamID), + }); return ( <> - {team && ( + {teamArtifacts && ( <SessionTeamBoothCard booth={ - team.artifacts.filter( + teamArtifacts.filter( (artifact) => artifact.type === TeamArtifactType.JAMBOREE_BOOTH, )[0] } diff --git a/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx b/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx index bf12571aeffaa59ff7a4e7e3aca7587ee3325f08..b9a895800c2117ffb037dc0a0dcbbee6fec3a458 100644 --- a/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx +++ b/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx @@ -14,6 +14,7 @@ export default { const Template: StoryFn = () => { const { data: team } = useFindTeamByIDQuery(mockTeamID as string); + return <>{team && <SessionTeamLinksCard team={team} />}</>; }; diff --git a/websites/storybook/src/stories/prebuilt/session/SessionTeamSessionsCard.stories.tsx b/websites/storybook/src/stories/prebuilt/session/SessionTeamSessionsCard.stories.tsx index b3c5860ddcedf011ddb0601b4d405f1fddd48b73..793a3ed0c0eebfa8990b4bf43776e99b4c2f037b 100644 --- a/websites/storybook/src/stories/prebuilt/session/SessionTeamSessionsCard.stories.tsx +++ b/websites/storybook/src/stories/prebuilt/session/SessionTeamSessionsCard.stories.tsx @@ -2,7 +2,7 @@ import { mockTeamID } from "@/stories/mocks"; import { withProvider } from "@/utils/withProvider"; import { StoryFn } from "@storybook/react"; import { SessionTeamSessionsCard } from "ui"; -import { useFindTeamByIDQuery } from "utils"; +import { useFindTeamSessionsQuery } from "utils"; export default { title: "Prebuilt/Session/SessionTeamSessionsCard", @@ -12,13 +12,9 @@ export default { }; const Template: StoryFn = () => { - const { data: team } = useFindTeamByIDQuery(mockTeamID as string); + const { data: teamSessions } = useFindTeamSessionsQuery(Number(mockTeamID)); return ( - <> - {team && team.sessions && ( - <SessionTeamSessionsCard sessions={team.sessions} /> - )} - </> + <>{teamSessions && <SessionTeamSessionsCard sessions={teamSessions} />}</> ); }; diff --git a/websites/storybook/src/stories/prebuilt/session/SessionTitleCard.stories.tsx b/websites/storybook/src/stories/prebuilt/session/SessionTitleCard.stories.tsx index bd3726388bac98fc74a987d15fbb553c7f3b04a3..f87d78073196b831bdb55eabd662fe4e0d66e67c 100644 --- a/websites/storybook/src/stories/prebuilt/session/SessionTitleCard.stories.tsx +++ b/websites/storybook/src/stories/prebuilt/session/SessionTitleCard.stories.tsx @@ -2,7 +2,7 @@ import { mockTeamID } from "@/stories/mocks"; import { withProvider } from "@/utils/withProvider"; import { StoryFn } from "@storybook/react"; import { SessionTitleCard } from "ui"; -import { useFindTeamByIDQuery } from "utils"; +import { useFindTeamSessionsQuery } from "utils"; export default { title: "Prebuilt/Session/SessionTitleCard", @@ -12,12 +12,12 @@ export default { }; const Template: StoryFn = () => { - const { data: team } = useFindTeamByIDQuery(mockTeamID as string); + const { data: teamSessions } = useFindTeamSessionsQuery(Number(mockTeamID)); return ( <> - {team && team.sessions && team.sessions.length > 0 && ( - <SessionTitleCard session={team.sessions[0]} /> + {teamSessions && teamSessions.length > 0 && ( + <SessionTitleCard session={teamSessions[0]} /> )} </> ); diff --git a/websites/teams/src/containers/App/components/TeamContext.tsx b/websites/teams/src/containers/App/components/TeamContext.tsx index b6cfdbac48cfc48694803c892d2c31a89b0c7e8c..f16f70f77c8bb73c6776e8636f45ed1465e0261d 100644 --- a/websites/teams/src/containers/App/components/TeamContext.tsx +++ b/websites/teams/src/containers/App/components/TeamContext.tsx @@ -4,9 +4,11 @@ import { Loader, LoaderType, NotFound, SessionContext } from "ui"; import { StaffPrivilegeKind, Team, + TeamArtifact, TeamID, TeamTicketAndOrderSummary, useFindMyTeamRostersQuery, + useFindTeamArtifactsQuery, useFindTeamByIDQuery, } from "utils"; @@ -16,6 +18,7 @@ export interface TeamContextState { canManageTeams: boolean; team: Team; teamTicketSummary?: TeamTicketAndOrderSummary; + teamArtifacts?: TeamArtifact[]; } const initialState: Partial<TeamContextState> = { @@ -43,6 +46,11 @@ export function TeamContextWrapper({ skip: teamID == null, }); + const { data: teamArtifacts } = useFindTeamArtifactsQuery( + { teamID: teamID as number }, + { skip: teamID == null }, + ); + if (isFetching) return <Loader type={LoaderType.FULL_SCREEN} />; if (teamID == null) { return ( @@ -66,6 +74,7 @@ export function TeamContextWrapper({ isTeamMember, canManageTeams, team, + teamArtifacts, }} > {children} diff --git a/websites/teams/src/containers/Deliverables/JudgingForm/JudgingForm.tsx b/websites/teams/src/containers/Deliverables/JudgingForm/JudgingForm.tsx index d52747618704fb45ee5fa77555bb18079c3891e7..183d0bcbf83602c9e495f76ae34e82d06784f82c 100644 --- a/websites/teams/src/containers/Deliverables/JudgingForm/JudgingForm.tsx +++ b/websites/teams/src/containers/Deliverables/JudgingForm/JudgingForm.tsx @@ -27,7 +27,7 @@ export function JudgingForm({ }: { form?: Form<JudgingFormDTO>; }): ReactNode { - const { team } = useContext(TeamContext); + const { team, teamArtifacts } = useContext(TeamContext); if (form == null) return ( @@ -38,7 +38,7 @@ export function JudgingForm({ </div> ); - const { title, abstract } = (team.artifacts?.find( + const { title, abstract } = (teamArtifacts?.find( (artifact) => artifact.type === TeamArtifactType.DESCRIPTION, )?.metadata as TeamDescription) ?? { title: form.value.title, diff --git a/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverable/Deliverable.tsx b/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverable/Deliverable.tsx index e972dc332c83485636692b4770895f34cb1701a5..62f84bc0783478d41c7204bde3108163666e4158 100644 --- a/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverable/Deliverable.tsx +++ b/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverable/Deliverable.tsx @@ -3,25 +3,30 @@ import { ReactNode } from "react"; import { twMerge } from "tailwind-merge"; import { ConditionalWrapper, Tooltip } from "ui"; import { - CompetitionDeliverable, + Deliverable, ExternalDeliverablesType, FormType, Team, TeamArtifactType, - TeamDeliverable, + TeamDeliverableStatus, } from "utils"; -export function Deliverable({ - deliverable: { - deliverable: { icon, title, type }, - }, +export function SingleDeliverable({ + deliverable: { icon, title, type }, teamDeliverable, team, }: { - deliverable: CompetitionDeliverable; - teamDeliverable?: TeamDeliverable; + deliverable: Deliverable; + teamDeliverable?: TeamDeliverableStatus; team: Team; }): ReactNode { + const videoArtifactTypes = [ + TeamArtifactType.PROJECT_PROMOTION, + TeamArtifactType.TEAM_PRESENTATION, + TeamArtifactType.JUDGING_SESSION, + TeamArtifactType.LIVE_STAGE_TALK, + ]; + function getDeliverableLink(): string | undefined { switch (type) { case FormType.FINAL_SAFETY_FORM: @@ -36,12 +41,7 @@ export function Deliverable({ const link = getDeliverableLink(); const disable = teamDeliverable == null || - ([ - TeamArtifactType.PROJECT_PROMOTION, - TeamArtifactType.TEAM_PRESENTATION, - TeamArtifactType.JUDGING_SESSION, - TeamArtifactType.LIVE_STAGE_TALK, - ].includes(type as TeamArtifactType) && + (videoArtifactTypes.includes(type as TeamArtifactType) && teamDeliverable.artifact?.videoUUID == null) || (type === ExternalDeliverablesType.SOFTWARE && team.softwareURL == null) || (type === ExternalDeliverablesType.WIKI && team.wikiURL == null); diff --git a/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx b/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx index e9ac54bea43e1aba15200705f69b0b7c2b8fe97a..1153de85d7b5dc5aeeeb25ea08e9737fbf5fdbbb 100644 --- a/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx +++ b/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx @@ -3,37 +3,21 @@ import { ReactNode, useContext } from "react"; import { BoxTitle, Button, ContentBox, PeopleIcon } from "ui"; import { CompetitionStatus, - ExternalDeliverablesType, - FormType, - TeamArtifactType, TeamStatus, - useFindDeliverablesByCompetitionQuery, + useFindVisibleTeamDeliverablesQuery, } from "utils"; -import { Deliverable } from "./Deliverable/Deliverable"; - -const VISIBLE_DELIVERABLES = [ - ExternalDeliverablesType.WIKI, - TeamArtifactType.PROJECT_PROMOTION, - TeamArtifactType.TEAM_PRESENTATION, - TeamArtifactType.JUDGING_SESSION, - TeamArtifactType.JAMBOREE_PLAZA_PRESENTATION, - TeamArtifactType.LIVE_STAGE_TALK, - FormType.SAFETY_FORM, -]; +import { SingleDeliverable } from "./Deliverable/Deliverable"; export function Deliverables(): ReactNode { const { team, canManageTeams, isTeamMember } = useContext(TeamContext); - const { data: { data: deliverables } = { data: [] } } = - useFindDeliverablesByCompetitionQuery({ - competitionUUID: team.competitionUUID, - page: 1, - pageSize: 30, - }); + const { data: teamDeliverables = [] } = useFindVisibleTeamDeliverablesQuery({ + teamID: team.id, + }); const canManage = (team.status !== TeamStatus.WITHDRAWN && isTeamMember) || canManageTeams; - return deliverables.length > 0 ? ( + return teamDeliverables.length > 0 ? ( <ContentBox className="flex-1 ml-0"> <BoxTitle title="Team Deliverables Overview" @@ -45,20 +29,13 @@ export function Deliverables(): ReactNode { )} </BoxTitle> <div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 pt-4"> - {VISIBLE_DELIVERABLES.map((type) => { - const deliverable = deliverables.find( - (deliverable) => deliverable.deliverable.type === type, - ); - if (deliverable == null) return <></>; + {teamDeliverables?.map((teamDeliverable) => { return ( - <Deliverable + <SingleDeliverable team={team} - teamDeliverable={team.deliverables?.find( - ({ deliverable: { uuid } }) => - uuid === deliverable.deliverable.uuid, - )} - deliverable={deliverable} - key={deliverable.deliverable.uuid} + teamDeliverable={teamDeliverable} + deliverable={teamDeliverable.deliverable} + key={teamDeliverable.deliverable.uuid} /> ); })} diff --git a/websites/teams/src/containers/Team/TeamPage/components/Description.tsx b/websites/teams/src/containers/Team/TeamPage/components/Description.tsx index 889bd79cc371a4f3bc5f44afacf4d84a47943e44..86422b569a4f7690cb36a680621af3db9fac0ef1 100644 --- a/websites/teams/src/containers/Team/TeamPage/components/Description.tsx +++ b/websites/teams/src/containers/Team/TeamPage/components/Description.tsx @@ -18,8 +18,9 @@ import { } from "utils"; export function Description(): ReactNode { - const { team } = useContext(TeamContext); - const descriptionMetadata = team.artifacts?.find( + const { team, teamArtifacts } = useContext(TeamContext); + + const descriptionMetadata = teamArtifacts?.find( (artifact) => artifact.type === TeamArtifactType.DESCRIPTION, )?.metadata as TeamDescription | undefined | null; const teamVillage = getTrackTitle(team.track); diff --git a/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverview.tsx b/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverview.tsx index b193c1de670ac87a43a1cea66ff9ec7f3568e291..487c9e88655c485c8ae3929381caa2bcf5361054 100644 --- a/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverview.tsx +++ b/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverview.tsx @@ -9,7 +9,7 @@ import { import { JamboreeItemsList } from "./JamboreeOverviewItems"; export function JamboreeOverview(): ReactNode { - const { team } = useContext(TeamContext); + const { team, teamArtifacts } = useContext(TeamContext); const { data: teamTicketSummary } = useFindTeamOrderAndTicketStatusQuery( team.id, ); @@ -34,7 +34,11 @@ export function JamboreeOverview(): ReactNode { /> } > - <JamboreeItemsList team={team} jamboreeData={teamTicketSummary} /> + <JamboreeItemsList + team={team} + jamboreeData={teamTicketSummary} + teamArtifacts={teamArtifacts} + /> </AccordionItem> </Accordion> ); diff --git a/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverview.utils.tsx b/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverview.utils.tsx index 03f3bba87fb730961b0af856c92c40838126f6f8..96892a776213ab361b836a540dab09a53d47492c 100644 --- a/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverview.utils.tsx +++ b/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverview.utils.tsx @@ -14,6 +14,7 @@ import { DISABLED_TEAM_STATUS, SessionType, Team, + TeamArtifact, TeamArtifactType, TeamFeeStatus, TeamJamboreeBooth, @@ -120,6 +121,7 @@ export function getJamboreeFeeContent( export function getTeamBoothContent( team: Team, + teamArtifacts?: TeamArtifact[], ): Omit<OverviewItemProps, "title"> { const boothPopup = ( <InformationPopup> @@ -135,9 +137,9 @@ export function getTeamBoothContent( </div> </InformationPopup> ); - if (team.artifacts != null) { + if (teamArtifacts != null) { const teamBoothAssignment = - team.artifacts.find( + teamArtifacts.find( (artifacts) => artifacts.type === TeamArtifactType.JAMBOREE_BOOTH, ) || null; diff --git a/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverviewItems.tsx b/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverviewItems.tsx index bd895f37db04bc670d335b0eb134981d724a5da7..0801aea726dfe76ae7ba260128830b9227821a11 100644 --- a/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverviewItems.tsx +++ b/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverviewItems.tsx @@ -4,6 +4,7 @@ import { Divider, InformationPopup, LinkWrapper, TimeTooltip } from "ui"; import { SessionType, Team, + TeamArtifact, TeamTicketAndOrderSummary, stringToSlug, } from "utils"; @@ -23,6 +24,7 @@ function getJamboreeOverviewItemContent( item: JamboreeOverviewItems, team: Team, jamboreeData?: TeamTicketAndOrderSummary, + teamArtifacts?: TeamArtifact[], ): Omit<OverviewItemProps, "title"> { switch (item) { case JamboreeOverviewItems.ATTENDANCE_TYPE: @@ -105,7 +107,7 @@ function getJamboreeOverviewItemContent( subcontent: "", }; case JamboreeOverviewItems.TEAM_BOOTH: - return getTeamBoothContent(team); + return getTeamBoothContent(team, teamArtifacts); case JamboreeOverviewItems.JUDGING_SESSION: return getSessionBoxContent(team, SessionType.JUDGING_SESSION); case JamboreeOverviewItems.PLAZA_PRESENTATION: @@ -119,6 +121,7 @@ export function JamboreeItemsList({ }: { team: Team; jamboreeData?: TeamTicketAndOrderSummary; + teamArtifacts?: TeamArtifact[]; }): ReactNode { function OverviewItem( content: ReactNode,