From f0d9bbd9047647b65aaaf6ba1dea90ad6fa4f299 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Mon, 2 Dec 2024 16:58:43 +0100
Subject: [PATCH 01/17] update team deliverables dashboard

---
 packages/utils/state/models/teamsModel.ts             |  3 ---
 packages/utils/state/slices/api/teamsSlice.ts         |  2 +-
 .../Deliverables/Deliverable/Deliverable.tsx          |  4 ++--
 .../TeamPage/components/Deliverables/Deliverables.tsx | 11 ++++++++++-
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/packages/utils/state/models/teamsModel.ts b/packages/utils/state/models/teamsModel.ts
index a1e09a9e0a..75c704a9e2 100644
--- a/packages/utils/state/models/teamsModel.ts
+++ b/packages/utils/state/models/teamsModel.ts
@@ -70,10 +70,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;
diff --git a/packages/utils/state/slices/api/teamsSlice.ts b/packages/utils/state/slices/api/teamsSlice.ts
index fce43bd2c7..baba49c3b0 100644
--- a/packages/utils/state/slices/api/teamsSlice.ts
+++ b/packages/utils/state/slices/api/teamsSlice.ts
@@ -614,7 +614,7 @@ export const teamsSlice = apiSlice
       }),
       findTeamDeliverablesDashboard: builder.query<
         Paginated<TeamDeliverableStatus>,
-        PaginatedParams<{ teamID: TeamID }>
+        PaginatedParams<{ teamID: TeamID; loadRelations?: boolean }>
       >({
         query: ({ teamID, ...params }) => ({
           url: `teams/${teamID}/deliverables`,
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 ee92747af9..882516d4e6 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
@@ -2,7 +2,7 @@ import { DeliverableWrapper } from "@/containers/Team/TeamPage/components/Delive
 import { ReactNode } from "react";
 import { twMerge } from "tailwind-merge";
 import { ConditionalWrapper, Tooltip } from "ui";
-import { FormType, Team, TeamArtifactType, TeamDeliverable } from "utils";
+import { FormType, Team, TeamArtifactType, TeamDeliverableStatus } from "utils";
 import {
   CompetitionDeliverable,
   ExternalDeliverablesType,
@@ -16,7 +16,7 @@ export function Deliverable({
   team,
 }: {
   deliverable: CompetitionDeliverable;
-  teamDeliverable?: TeamDeliverable;
+  teamDeliverable?: TeamDeliverableStatus;
   team: Team;
 }): ReactNode {
   function getDeliverableLink(): string | undefined {
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 3e99be3f09..2d084278eb 100644
--- a/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
+++ b/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
@@ -9,6 +9,7 @@ import {
   TeamArtifactType,
   TeamStatus,
   useFindDeliverablesByCompetitionQuery,
+  useFindTeamDeliverablesDashboardQuery,
 } from "utils";
 import { ExternalDeliverablesType } from "utils/state/models/deliverablesModel.ts";
 import { Deliverable } from "./Deliverable/Deliverable.tsx";
@@ -32,6 +33,14 @@ export function Deliverables(): ReactNode {
       pageSize: 30,
     });
 
+  const { data: { data: teamDeliverables } = { data: [] } } =
+    useFindTeamDeliverablesDashboardQuery({
+      teamID: team.id,
+      page: 1,
+      pageSize: 20,
+      loadRelations: true,
+    });
+
   const canManage =
     (team.status !== TeamStatus.WITHDRAWN && isTeamMember) || canManageTeams;
 
@@ -55,7 +64,7 @@ export function Deliverables(): ReactNode {
           return (
             <Deliverable
               team={team}
-              teamDeliverable={team.deliverables?.find(
+              teamDeliverable={teamDeliverables?.find(
                 ({ deliverable: { uuid } }) =>
                   uuid === deliverable.deliverable.uuid,
               )}
-- 
GitLab


From 7a137d38265c80682e8cbde11968dbfd4ca304c5 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Tue, 3 Dec 2024 11:55:29 +0100
Subject: [PATCH 02/17] update teams

---
 packages/utils/state/slices/api/teamsSlice.ts            | 6 ++++++
 .../teams/src/containers/App/components/TeamContext.tsx  | 9 +++++++++
 .../containers/Deliverables/JudgingForm/JudgingForm.tsx  | 4 ++--
 .../containers/Team/TeamPage/components/Description.tsx  | 5 +++--
 .../TeamPage/components/Jamboree/JamboreeOverview.tsx    | 8 ++++++--
 .../components/Jamboree/JamboreeOverview.utils.tsx       | 6 ++++--
 .../components/Jamboree/JamboreeOverviewItems.tsx        | 5 ++++-
 7 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/packages/utils/state/slices/api/teamsSlice.ts b/packages/utils/state/slices/api/teamsSlice.ts
index baba49c3b0..479da76889 100644
--- a/packages/utils/state/slices/api/teamsSlice.ts
+++ b/packages/utils/state/slices/api/teamsSlice.ts
@@ -539,6 +539,11 @@ export const teamsSlice = apiSlice
         },
       }),
 
+      fetchTeamArtifacts: builder.query<TeamArtifact[], { teamID: TeamID }>({
+        query: ({ teamID }) => `teams/${teamID}/artifacts`,
+        providesTags: ["AllTeamArtifacts"],
+      }),
+
       importTeamBooths: builder.mutation<
         void,
         { body: FormData; competitionUUID: CompetitionUUID }
@@ -1064,4 +1069,5 @@ export const {
   useFindTeamAssociationQuery,
   useLazySearchCompetitionFormsQuery,
   useUpdateCompetitionFormStatusMutation,
+  useFetchTeamArtifactsQuery,
 } = teamsSlice;
diff --git a/websites/teams/src/containers/App/components/TeamContext.tsx b/websites/teams/src/containers/App/components/TeamContext.tsx
index 75575b267a..951d697f5a 100644
--- a/websites/teams/src/containers/App/components/TeamContext.tsx
+++ b/websites/teams/src/containers/App/components/TeamContext.tsx
@@ -4,7 +4,9 @@ import { Loader, LoaderType, NotFound, SessionContext } from "ui";
 import {
   StaffPrivilegeKind,
   Team,
+  TeamArtifact,
   TeamTicketAndOrderSummary,
+  useFetchTeamArtifactsQuery,
   useFindMyTeamRostersQuery,
   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 } = useFetchTeamArtifactsQuery(
+    { 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 b0cced6165..6fcd55c6bb 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/Description.tsx b/websites/teams/src/containers/Team/TeamPage/components/Description.tsx
index 87901a00d9..634718e97a 100644
--- a/websites/teams/src/containers/Team/TeamPage/components/Description.tsx
+++ b/websites/teams/src/containers/Team/TeamPage/components/Description.tsx
@@ -17,8 +17,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 e368ca3e31..6d4b899938 100644
--- a/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverview.tsx
+++ b/websites/teams/src/containers/Team/TeamPage/components/Jamboree/JamboreeOverview.tsx
@@ -11,7 +11,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,
   );
@@ -36,7 +36,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 03f3bba87f..96892a7762 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 bd895f37db..0801aea726 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,
-- 
GitLab


From 1a1bb09fcb6002a43ec7a4c267872773e74a2253 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Tue, 3 Dec 2024 12:07:54 +0100
Subject: [PATCH 03/17] update jamboree and judging

---
 .../jamboree/src/components/TeamInfo/TeamInfo.tsx   | 12 ++++++++++--
 .../judging/src/containers/Ballot/Team/Team.tsx     | 13 +++++++++----
 .../session/SessionTeamBoothCard.stories.tsx        | 10 ++++++----
 3 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx b/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
index e9bba72ece..8c1c4a6b30 100644
--- a/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
+++ b/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
@@ -22,6 +22,7 @@ import {
   TeamArtifactType,
   TeamDescription,
   TeamStatus,
+  useFetchTeamArtifactsQuery,
   useFindTeamByIDQuery,
 } from "utils";
 
@@ -45,14 +46,21 @@ export function TeamInfoPage({
     skip: teamIDForQuery == null,
   });
 
+  const { data: teamArtifacts } = useFetchTeamArtifactsQuery(
+    {
+      teamID: teamIDForQuery as number,
+    },
+    { skip: team == null },
+  );
+
   if (!teamIDForQuery || isError) return <NotFound />;
   if (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,
   );
 
diff --git a/websites/judging/src/containers/Ballot/Team/Team.tsx b/websites/judging/src/containers/Ballot/Team/Team.tsx
index 400a33d9b4..bc09333856 100644
--- a/websites/judging/src/containers/Ballot/Team/Team.tsx
+++ b/websites/judging/src/containers/Ballot/Team/Team.tsx
@@ -16,23 +16,28 @@ import {
   TeamArtifact,
   TeamArtifactType,
   TeamDescription,
+  useFetchTeamArtifactsQuery,
 } from "utils";
 import { VideoUUID } from "utils/misc/uuidTypes";
 
 export function BallotTeam({ team }: { team: Team }): ReactNode {
-  const description = team.artifacts?.find(
+  const { data: teamArtifacts } = useFetchTeamArtifactsQuery({
+    teamID: team.id,
+  });
+
+  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/session/SessionTeamBoothCard.stories.tsx b/websites/storybook/src/stories/prebuilt/session/SessionTeamBoothCard.stories.tsx
index 6a5ce80cdc..f5c5f3cc80 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.tsx";
 import { withProvider } from "@/utils/withProvider.tsx";
 import { StoryFn } from "@storybook/react";
 import { SessionTeamBoothCard } from "ui";
-import { TeamArtifactType, useFindTeamByIDQuery } from "utils";
+import { TeamArtifactType, useFetchTeamArtifactsQuery } 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 } = useFetchTeamArtifactsQuery({
+    teamID: Number(mockTeamID),
+  });
   return (
     <>
-      {team && (
+      {teamArtifacts && (
         <SessionTeamBoothCard
           booth={
-            team.artifacts.filter(
+            teamArtifacts.filter(
               (artifact) => artifact.type === TeamArtifactType.JAMBOREE_BOOTH,
             )[0]
           }
-- 
GitLab


From 7008bd5b008fe2900b192b5e32c7a875b6150b41 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Tue, 3 Dec 2024 13:04:59 +0100
Subject: [PATCH 04/17] update team sessions

---
 .../session/SessionTeamLinksCard.tsx          | 18 ++++++--
 .../utils/state/slices/api/eventsSlice.ts     |  6 +++
 .../src/components/TeamInfo/TeamInfo.tsx      | 41 +++++++++++++------
 .../src/containers/Ballot/Team/Team.tsx       |  7 +++-
 4 files changed, 55 insertions(+), 17 deletions(-)

diff --git a/packages/ui/src/components/session/SessionTeamLinksCard.tsx b/packages/ui/src/components/session/SessionTeamLinksCard.tsx
index c7e84fd847..4c06d8a747 100644
--- a/packages/ui/src/components/session/SessionTeamLinksCard.tsx
+++ b/packages/ui/src/components/session/SessionTeamLinksCard.tsx
@@ -1,11 +1,23 @@
 import { ReactNode, useMemo } from "react";
-import { Team, TeamArtifactType, getTeamArtifactTitle, uiTwMerge } from "utils";
+import {
+  Team,
+  TeamArtifact,
+  TeamArtifactType,
+  getTeamArtifactTitle,
+  uiTwMerge,
+} from "utils";
 import { VideoUUID } from "utils/misc/uuidTypes";
 import { LinkIcon } from "../../assets/icons";
 import { VideoCard } from "../cards";
 import { LinkWrapper } from "../utility";
 
-export function SessionTeamLinksCard({ team }: { team: Team }): ReactNode {
+export function SessionTeamLinksCard({
+  team,
+  teamArtifacts,
+}: {
+  team: Team;
+  teamArtifacts?: TeamArtifact[];
+}): ReactNode {
   const videos = useMemo(() => {
     return [
       TeamArtifactType.PROJECT_PROMOTION,
@@ -16,7 +28,7 @@ export function SessionTeamLinksCard({ team }: { team: Team }): ReactNode {
       TeamArtifactType.FINALIST_PRESENTATION,
     ]
       .map((type) => {
-        const artifact = team.artifacts.find(
+        const artifact = teamArtifacts?.find(
           (artifact) => artifact.type === type,
         );
         if (artifact?.videoUUID)
diff --git a/packages/utils/state/slices/api/eventsSlice.ts b/packages/utils/state/slices/api/eventsSlice.ts
index 0d3f9612c0..617c187c70 100644
--- a/packages/utils/state/slices/api/eventsSlice.ts
+++ b/packages/utils/state/slices/api/eventsSlice.ts
@@ -6,6 +6,7 @@ import {
   EventUUID,
   LiveStreamUUID,
   SessionLocationUUID,
+  TeamID,
 } from "../../../misc/uuidTypes.ts";
 import {
   AdminScheduleMetadata,
@@ -164,6 +165,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 }
@@ -526,4 +531,5 @@ export const {
   useUploadEventSessionPhotoMutation,
   useDeleteEventSessionPhotoMutation,
   useUpdateSessionVideoMutation,
+  useFindTeamSessionsQuery,
 } = eventsSlice;
diff --git a/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx b/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
index 8c1c4a6b30..e461fb4821 100644
--- a/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
+++ b/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
@@ -24,6 +24,7 @@ import {
   TeamStatus,
   useFetchTeamArtifactsQuery,
   useFindTeamByIDQuery,
+  useFindTeamSessionsQuery,
 } from "utils";
 
 interface TeamInfoPageProps {
@@ -46,17 +47,33 @@ export function TeamInfoPage({
     skip: teamIDForQuery == null,
   });
 
-  const { data: teamArtifacts } = useFetchTeamArtifactsQuery(
-    {
-      teamID: teamIDForQuery as number,
-    },
-    { skip: team == null },
-  );
+  const { data: teamArtifacts, isLoading: isLoadingArtifacts } =
+    useFetchTeamArtifactsQuery(
+      {
+        teamID: teamIDForQuery as number,
+      },
+      { skip: teamIDForQuery == null },
+    );
+
+  const { data: teamSessions, isLoading: isLoadingSessions } =
+    useFindTeamSessionsQuery(teamIDForQuery as number, {
+      skip: teamIDForQuery == null,
+    });
+
+  console.log("teamIDForQuery", teamIDForQuery);
+  console.log("isError", isError);
+  console.log("isLoading", isLoading);
+  console.log("team", team);
+  console.log("teamArtifacts", teamArtifacts);
+  console.log("teamSessions", teamSessions);
 
   if (!teamIDForQuery || isError) return <NotFound />;
-  if (isLoading || team == null)
+
+  if (isLoadingArtifacts || isLoadingSessions || isLoading || team == null)
     return <SkeletonSession className={className} />;
 
+  console.log("teamArtifacts2", teamArtifacts);
+  console.log("teamSessions2", teamSessions);
   const descriptionMetadata = teamArtifacts?.find(
     (artifact) => artifact.type === TeamArtifactType.DESCRIPTION,
   )?.metadata as TeamDescription | undefined | null;
@@ -83,7 +100,7 @@ export function TeamInfoPage({
           />
         )}
         <div className="flex flex-col gap-6 md:gap-12">
-          {descriptionMetadata && (
+          {descriptionMetadata != null && (
             <CardSection title={"Title"}>
               <TeamProjectTitleCard
                 title={descriptionMetadata.title}
@@ -91,7 +108,7 @@ export function TeamInfoPage({
               />
             </CardSection>
           )}
-          {descriptionMetadata && (
+          {descriptionMetadata != null && (
             <CardSection title={"Description"}>
               <SessionDescriptionCard
                 description={descriptionMetadata.abstract}
@@ -101,7 +118,7 @@ export function TeamInfoPage({
           {team && (
             <CardSection title={"Links"}>
               {/* Team related links */}
-              <SessionTeamLinksCard team={team} />
+              <SessionTeamLinksCard team={team} teamArtifacts={teamArtifacts} />
             </CardSection>
           )}
         </div>
@@ -118,10 +135,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/Team/Team.tsx b/websites/judging/src/containers/Ballot/Team/Team.tsx
index bc09333856..4bb0e0935d 100644
--- a/websites/judging/src/containers/Ballot/Team/Team.tsx
+++ b/websites/judging/src/containers/Ballot/Team/Team.tsx
@@ -17,6 +17,7 @@ import {
   TeamArtifactType,
   TeamDescription,
   useFetchTeamArtifactsQuery,
+  useFindTeamSessionsQuery,
 } from "utils";
 import { VideoUUID } from "utils/misc/uuidTypes";
 
@@ -25,6 +26,8 @@ export function BallotTeam({ team }: { team: Team }): ReactNode {
     teamID: team.id,
   });
 
+  const { data: teamSessions } = useFindTeamSessionsQuery(team.id);
+
   const description = teamArtifacts?.find(
     (artifact) => artifact.type === TeamArtifactType.DESCRIPTION,
   )?.metadata as TeamDescription | undefined;
@@ -135,9 +138,9 @@ export function BallotTeam({ team }: { team: Team }): ReactNode {
         </CardSection>
       )}
 
-      {team.sessions != null && (
+      {teamSessions != null && (
         <CardSection title={"Scheduled Sessions"}>
-          <SessionTeamSessionsCard sessions={team.sessions} />
+          <SessionTeamSessionsCard sessions={teamSessions} />
         </CardSection>
       )}
 
-- 
GitLab


From cbb9e2a0e7c236f1cb3a3a27e9df631b2b066483 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Tue, 3 Dec 2024 13:12:19 +0100
Subject: [PATCH 05/17] cleanup

---
 websites/jamboree/src/components/TeamInfo/TeamInfo.tsx | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx b/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
index e461fb4821..8cf3fffd28 100644
--- a/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
+++ b/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
@@ -60,20 +60,11 @@ export function TeamInfoPage({
       skip: teamIDForQuery == null,
     });
 
-  console.log("teamIDForQuery", teamIDForQuery);
-  console.log("isError", isError);
-  console.log("isLoading", isLoading);
-  console.log("team", team);
-  console.log("teamArtifacts", teamArtifacts);
-  console.log("teamSessions", teamSessions);
-
   if (!teamIDForQuery || isError) return <NotFound />;
 
   if (isLoadingArtifacts || isLoadingSessions || isLoading || team == null)
     return <SkeletonSession className={className} />;
 
-  console.log("teamArtifacts2", teamArtifacts);
-  console.log("teamSessions2", teamSessions);
   const descriptionMetadata = teamArtifacts?.find(
     (artifact) => artifact.type === TeamArtifactType.DESCRIPTION,
   )?.metadata as TeamDescription | undefined | null;
-- 
GitLab


From 0302e474c3e693d3ed31bb56bd51a92144f51fe1 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Tue, 3 Dec 2024 13:45:14 +0100
Subject: [PATCH 06/17] update session

---
 .../UpsertSession/UpsertSessionForm.tsx        |  8 ++------
 .../judging/src/containers/Ballot/Ballot.tsx   |  1 +
 .../src/containers/Ballot/Team/Team.tsx        | 18 +++++++++---------
 3 files changed, 12 insertions(+), 15 deletions(-)

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 b48906d205..029fc846db 100644
--- a/websites/hq/src/containers/Jamboree/Schedule/components/UpsertSession/UpsertSessionForm.tsx
+++ b/websites/hq/src/containers/Jamboree/Schedule/components/UpsertSession/UpsertSessionForm.tsx
@@ -29,7 +29,6 @@ import {
   UpsertSession,
   useFindEventLocationsQuery,
   useFindEventSessionsAdminMetadataQuery,
-  useFindTeamByIDQuery,
 } from "utils";
 import { EventUUID } from "utils/misc/uuidTypes";
 
@@ -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/judging/src/containers/Ballot/Ballot.tsx b/websites/judging/src/containers/Ballot/Ballot.tsx
index bc0ade1546..9d02891412 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 4bb0e0935d..e8195cb288 100644
--- a/websites/judging/src/containers/Ballot/Team/Team.tsx
+++ b/websites/judging/src/containers/Ballot/Team/Team.tsx
@@ -17,17 +17,17 @@ import {
   TeamArtifactType,
   TeamDescription,
   useFetchTeamArtifactsQuery,
-  useFindTeamSessionsQuery,
 } from "utils";
 import { VideoUUID } from "utils/misc/uuidTypes";
 
 export function BallotTeam({ team }: { team: Team }): ReactNode {
-  const { data: teamArtifacts } = useFetchTeamArtifactsQuery({
-    teamID: team.id,
-  });
-
-  const { data: teamSessions } = useFindTeamSessionsQuery(team.id);
-
+  const { data: artifacts } = useFetchTeamArtifactsQuery(
+    {
+      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;
@@ -138,9 +138,9 @@ export function BallotTeam({ team }: { team: Team }): ReactNode {
         </CardSection>
       )}
 
-      {teamSessions != null && (
+      {team.sessions != null && (
         <CardSection title={"Scheduled Sessions"}>
-          <SessionTeamSessionsCard sessions={teamSessions} />
+          <SessionTeamSessionsCard sessions={team.sessions} />
         </CardSection>
       )}
 
-- 
GitLab


From 917d9e1d60de6b085a02499dd9dbfa5e5a960885 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Tue, 3 Dec 2024 14:10:13 +0100
Subject: [PATCH 07/17] update stories

---
 .../src/stories/prebuilt/MyDuties.stories.tsx      |  7 +++++--
 .../session/SessionTeamLinksCard.stories.tsx       | 14 ++++++++++++--
 .../session/SessionTeamSessionsCard.stories.tsx    | 10 +++-------
 .../prebuilt/session/SessionTitleCard.stories.tsx  |  8 ++++----
 4 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/websites/storybook/src/stories/prebuilt/MyDuties.stories.tsx b/websites/storybook/src/stories/prebuilt/MyDuties.stories.tsx
index 21acce9a58..b466caa078 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/SessionTeamLinksCard.stories.tsx b/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx
index f9925afe5e..732314fac2 100644
--- a/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx
+++ b/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx
@@ -3,7 +3,7 @@ import { withProvider } from "@/utils/withProvider.tsx";
 import { StoryFn } from "@storybook/react";
 import { withRouter } from "storybook-addon-remix-react-router";
 import { SessionTeamLinksCard } from "ui";
-import { useFindTeamByIDQuery } from "utils";
+import { useFetchTeamArtifactsQuery, useFindTeamByIDQuery } from "utils";
 
 export default {
   title: "Prebuilt/Session/SessionTeamLinksCard",
@@ -14,7 +14,17 @@ export default {
 
 const Template: StoryFn = () => {
   const { data: team } = useFindTeamByIDQuery(mockTeamID as string);
-  return <>{team && <SessionTeamLinksCard team={team} />}</>;
+
+  const { data: teamArtifacts } = useFetchTeamArtifactsQuery({
+    teamID: Number(mockTeamID),
+  });
+  return (
+    <>
+      {team && (
+        <SessionTeamLinksCard team={team} teamArtifacts={teamArtifacts} />
+      )}
+    </>
+  );
 };
 
 export const Default = Template.bind({});
diff --git a/websites/storybook/src/stories/prebuilt/session/SessionTeamSessionsCard.stories.tsx b/websites/storybook/src/stories/prebuilt/session/SessionTeamSessionsCard.stories.tsx
index fcd236997a..5f5a6693b4 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.tsx";
 import { withProvider } from "@/utils/withProvider.tsx";
 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 49d95f86e7..fbc9becf3e 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.tsx";
 import { withProvider } from "@/utils/withProvider.tsx";
 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]} />
       )}
     </>
   );
-- 
GitLab


From 96f2501086ebb09a92ebd82739e9b081a6fe4bee Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Tue, 3 Dec 2024 16:45:26 +0100
Subject: [PATCH 08/17] update deliverables on teams

---
 packages/utils/state/slices/api/teamsSlice.ts |  2 +-
 .../Deliverables/Deliverable/Deliverable.tsx  | 25 +++++++++++++++++--
 .../components/Deliverables/Deliverables.tsx  |  1 -
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/packages/utils/state/slices/api/teamsSlice.ts b/packages/utils/state/slices/api/teamsSlice.ts
index 8ebd8a0422..21af3a0310 100644
--- a/packages/utils/state/slices/api/teamsSlice.ts
+++ b/packages/utils/state/slices/api/teamsSlice.ts
@@ -622,7 +622,7 @@ export const teamsSlice = apiSlice
       }),
       findTeamDeliverablesDashboard: builder.query<
         Paginated<TeamDeliverableStatus>,
-        PaginatedParams<{ teamID: TeamID; loadRelations?: boolean }>
+        PaginatedParams<{ teamID: TeamID }>
       >({
         query: ({ teamID, ...params }) => ({
           url: `teams/${teamID}/deliverables`,
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 882516d4e6..f3978f9623 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
@@ -2,7 +2,13 @@ import { DeliverableWrapper } from "@/containers/Team/TeamPage/components/Delive
 import { ReactNode } from "react";
 import { twMerge } from "tailwind-merge";
 import { ConditionalWrapper, Tooltip } from "ui";
-import { FormType, Team, TeamArtifactType, TeamDeliverableStatus } from "utils";
+import {
+  FormType,
+  Team,
+  TeamArtifactType,
+  TeamDeliverableStatus,
+  useFindTeamArtifactQuery,
+} from "utils";
 import {
   CompetitionDeliverable,
   ExternalDeliverablesType,
@@ -19,6 +25,21 @@ export function Deliverable({
   teamDeliverable?: TeamDeliverableStatus;
   team: Team;
 }): ReactNode {
+  const videoArtifactTypes = [
+    TeamArtifactType.PROJECT_PROMOTION,
+    TeamArtifactType.TEAM_PRESENTATION,
+    TeamArtifactType.JUDGING_SESSION,
+    TeamArtifactType.LIVE_STAGE_TALK,
+  ];
+
+  const { data: videoArtifact } = useFindTeamArtifactQuery(
+    {
+      teamID: team.id,
+      type: type as TeamArtifactType,
+    },
+    { skip: !videoArtifactTypes.includes(type as TeamArtifactType) },
+  );
+
   function getDeliverableLink(): string | undefined {
     switch (type) {
       case FormType.FINAL_SAFETY_FORM:
@@ -39,7 +60,7 @@ export function Deliverable({
       TeamArtifactType.JUDGING_SESSION,
       TeamArtifactType.LIVE_STAGE_TALK,
     ].includes(type as TeamArtifactType) &&
-      teamDeliverable.artifact?.videoUUID == null) ||
+      videoArtifact?.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 2d084278eb..77e52ef714 100644
--- a/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
+++ b/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
@@ -38,7 +38,6 @@ export function Deliverables(): ReactNode {
       teamID: team.id,
       page: 1,
       pageSize: 20,
-      loadRelations: true,
     });
 
   const canManage =
-- 
GitLab


From ab0e8eb41f155b0e59bfcb3005e178a377a353d6 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Wed, 4 Dec 2024 11:59:09 +0100
Subject: [PATCH 09/17] review

---
 packages/utils/state/slices/api/teamsSlice.ts                 | 4 ++--
 websites/jamboree/src/components/TeamInfo/TeamInfo.tsx        | 4 ++--
 websites/judging/src/containers/Ballot/Team/Team.tsx          | 4 ++--
 .../stories/prebuilt/session/SessionTeamBoothCard.stories.tsx | 4 ++--
 .../stories/prebuilt/session/SessionTeamLinksCard.stories.tsx | 4 ++--
 websites/teams/src/containers/App/components/TeamContext.tsx  | 4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/packages/utils/state/slices/api/teamsSlice.ts b/packages/utils/state/slices/api/teamsSlice.ts
index ef40d414ac..0a2f2f9ad6 100644
--- a/packages/utils/state/slices/api/teamsSlice.ts
+++ b/packages/utils/state/slices/api/teamsSlice.ts
@@ -540,7 +540,7 @@ export const teamsSlice = apiSlice
         },
       }),
 
-      fetchTeamArtifacts: builder.query<TeamArtifact[], { teamID: TeamID }>({
+      findTeamArtifacts: builder.query<TeamArtifact[], { teamID: TeamID }>({
         query: ({ teamID }) => `teams/${teamID}/artifacts`,
         providesTags: ["AllTeamArtifacts"],
       }),
@@ -1070,5 +1070,5 @@ export const {
   useFindTeamAssociationQuery,
   useLazySearchCompetitionFormsQuery,
   useUpdateCompetitionFormStatusMutation,
-  useFetchTeamArtifactsQuery,
+  useFindTeamArtifactsQuery,
 } = teamsSlice;
diff --git a/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx b/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
index 3bc765971d..4f1063cfb7 100644
--- a/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
+++ b/websites/jamboree/src/components/TeamInfo/TeamInfo.tsx
@@ -22,7 +22,7 @@ import {
   TeamArtifactType,
   TeamDescription,
   TeamStatus,
-  useFetchTeamArtifactsQuery,
+  useFindTeamArtifactsQuery,
   useFindTeamByIDQuery,
   useFindTeamSessionsQuery,
 } from "utils";
@@ -48,7 +48,7 @@ export function TeamInfoPage({
   });
 
   const { data: teamArtifacts, isLoading: isLoadingArtifacts } =
-    useFetchTeamArtifactsQuery(
+    useFindTeamArtifactsQuery(
       {
         teamID: teamIDForQuery as number,
       },
diff --git a/websites/judging/src/containers/Ballot/Team/Team.tsx b/websites/judging/src/containers/Ballot/Team/Team.tsx
index ca9f622ccc..ee13458557 100644
--- a/websites/judging/src/containers/Ballot/Team/Team.tsx
+++ b/websites/judging/src/containers/Ballot/Team/Team.tsx
@@ -17,11 +17,11 @@ import {
   TeamArtifactType,
   TeamDescription,
   VideoUUID,
-  useFetchTeamArtifactsQuery,
+  useFindTeamArtifactsQuery,
 } from "utils";
 
 export function BallotTeam({ team }: { team: Team }): ReactNode {
-  const { data: artifacts } = useFetchTeamArtifactsQuery(
+  const { data: artifacts } = useFindTeamArtifactsQuery(
     {
       teamID: team.id,
     },
diff --git a/websites/storybook/src/stories/prebuilt/session/SessionTeamBoothCard.stories.tsx b/websites/storybook/src/stories/prebuilt/session/SessionTeamBoothCard.stories.tsx
index b9e1c9f2b6..92e0f5392b 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, useFetchTeamArtifactsQuery } from "utils";
+import { TeamArtifactType, useFindTeamArtifactsQuery } from "utils";
 
 export default {
   title: "Prebuilt/Session/SessionTeamBoothCard",
@@ -12,7 +12,7 @@ export default {
 };
 
 const Template: StoryFn = () => {
-  const { data: teamArtifacts } = useFetchTeamArtifactsQuery({
+  const { data: teamArtifacts } = useFindTeamArtifactsQuery({
     teamID: Number(mockTeamID),
   });
   return (
diff --git a/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx b/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx
index 449c019b23..e22185115f 100644
--- a/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx
+++ b/websites/storybook/src/stories/prebuilt/session/SessionTeamLinksCard.stories.tsx
@@ -3,7 +3,7 @@ import { withProvider } from "@/utils/withProvider";
 import { StoryFn } from "@storybook/react";
 import { withRouter } from "storybook-addon-remix-react-router";
 import { SessionTeamLinksCard } from "ui";
-import { useFetchTeamArtifactsQuery, useFindTeamByIDQuery } from "utils";
+import { useFindTeamArtifactsQuery, useFindTeamByIDQuery } from "utils";
 
 export default {
   title: "Prebuilt/Session/SessionTeamLinksCard",
@@ -15,7 +15,7 @@ export default {
 const Template: StoryFn = () => {
   const { data: team } = useFindTeamByIDQuery(mockTeamID as string);
 
-  const { data: teamArtifacts } = useFetchTeamArtifactsQuery({
+  const { data: teamArtifacts } = useFindTeamArtifactsQuery({
     teamID: Number(mockTeamID),
   });
   return (
diff --git a/websites/teams/src/containers/App/components/TeamContext.tsx b/websites/teams/src/containers/App/components/TeamContext.tsx
index 80c64ea2dc..f16f70f77c 100644
--- a/websites/teams/src/containers/App/components/TeamContext.tsx
+++ b/websites/teams/src/containers/App/components/TeamContext.tsx
@@ -7,8 +7,8 @@ import {
   TeamArtifact,
   TeamID,
   TeamTicketAndOrderSummary,
-  useFetchTeamArtifactsQuery,
   useFindMyTeamRostersQuery,
+  useFindTeamArtifactsQuery,
   useFindTeamByIDQuery,
 } from "utils";
 
@@ -46,7 +46,7 @@ export function TeamContextWrapper({
     skip: teamID == null,
   });
 
-  const { data: teamArtifacts } = useFetchTeamArtifactsQuery(
+  const { data: teamArtifacts } = useFindTeamArtifactsQuery(
     { teamID: teamID as number },
     { skip: teamID == null },
   );
-- 
GitLab


From 7376f71a002dddcf83e7f102e249888da54f1e96 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Thu, 5 Dec 2024 15:29:16 +0100
Subject: [PATCH 10/17] add public team deliverables

---
 packages/utils/state/models/teamsModel.ts     |  1 +
 packages/utils/state/slices/api/teamsSlice.ts | 11 ++++++++++
 .../Deliverables/Deliverable/Deliverable.tsx  | 22 ++++---------------
 .../components/Deliverables/Deliverables.tsx  | 13 +++++------
 4 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/packages/utils/state/models/teamsModel.ts b/packages/utils/state/models/teamsModel.ts
index cd5824109d..749ad602e0 100644
--- a/packages/utils/state/models/teamsModel.ts
+++ b/packages/utils/state/models/teamsModel.ts
@@ -110,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/teamsSlice.ts b/packages/utils/state/slices/api/teamsSlice.ts
index 0a2f2f9ad6..2d0a287fe5 100644
--- a/packages/utils/state/slices/api/teamsSlice.ts
+++ b/packages/utils/state/slices/api/teamsSlice.ts
@@ -28,6 +28,7 @@ import {
   TeamArtifact,
   TeamArtifactType,
   TeamAssociationForm,
+  TeamDeliverable,
   TeamDeliverableByTypeQueryFilters,
   TeamDeliverableStatus,
   TeamDeliverablesPaginationQueryResults,
@@ -628,6 +629,15 @@ export const teamsSlice = apiSlice
         }),
         providesTags: ["Deliverables"],
       }),
+      findTeamDeliverables: builder.query<
+        TeamDeliverable[],
+        { teamID: TeamID }
+      >({
+        query: ({ teamID }) => `teams/${teamID}/deliverables/public`,
+        extraOptions: {
+          skipErrorHandling: true,
+        },
+      }),
       findTeamDeliverableStatus: builder.query<
         TeamDeliverableStatus,
         { teamID: TeamID; deliverableUUID: DeliverableUUID }
@@ -1071,4 +1081,5 @@ export const {
   useLazySearchCompetitionFormsQuery,
   useUpdateCompetitionFormStatusMutation,
   useFindTeamArtifactsQuery,
+  useFindTeamDeliverablesQuery,
 } = teamsSlice;
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 92b7c0fb69..aa4b2a0795 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
@@ -8,8 +8,7 @@ import {
   FormType,
   Team,
   TeamArtifactType,
-  TeamDeliverableStatus,
-  useFindTeamArtifactQuery,
+  TeamDeliverable,
 } from "utils";
 
 export function Deliverable({
@@ -20,7 +19,7 @@ export function Deliverable({
   team,
 }: {
   deliverable: CompetitionDeliverable;
-  teamDeliverable?: TeamDeliverableStatus;
+  teamDeliverable?: TeamDeliverable;
   team: Team;
 }): ReactNode {
   const videoArtifactTypes = [
@@ -30,14 +29,6 @@ export function Deliverable({
     TeamArtifactType.LIVE_STAGE_TALK,
   ];
 
-  const { data: videoArtifact } = useFindTeamArtifactQuery(
-    {
-      teamID: team.id,
-      type: type as TeamArtifactType,
-    },
-    { skip: !videoArtifactTypes.includes(type as TeamArtifactType) },
-  );
-
   function getDeliverableLink(): string | undefined {
     switch (type) {
       case FormType.FINAL_SAFETY_FORM:
@@ -52,13 +43,8 @@ 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) &&
-      videoArtifact?.videoUUID == null) ||
+    (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 bae1877afb..88383a0661 100644
--- a/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
+++ b/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
@@ -8,7 +8,7 @@ import {
   TeamArtifactType,
   TeamStatus,
   useFindDeliverablesByCompetitionQuery,
-  useFindTeamDeliverablesDashboardQuery,
+  useFindTeamDeliverablesQuery,
 } from "utils";
 import { Deliverable } from "./Deliverable/Deliverable";
 
@@ -31,13 +31,10 @@ export function Deliverables(): ReactNode {
       pageSize: 30,
     });
 
-  const { data: { data: teamDeliverables } = { data: [] } } =
-    useFindTeamDeliverablesDashboardQuery({
-      teamID: team.id,
-      page: 1,
-      pageSize: 20,
-    });
-
+  const { data: teamDeliverables } = useFindTeamDeliverablesQuery({
+    teamID: team.id,
+  });
+  console.log(teamDeliverables);
   const canManage =
     (team.status !== TeamStatus.WITHDRAWN && isTeamMember) || canManageTeams;
 
-- 
GitLab


From f2b1319684546bdfa6d78557bda0595bea054056 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Mon, 9 Dec 2024 10:24:44 +0100
Subject: [PATCH 11/17] update visible deliverables

---
 .../utils/state/models/deliverablesModel.ts   |  1 +
 .../components/Deliverables/Deliverables.tsx  | 24 ++++---------------
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/packages/utils/state/models/deliverablesModel.ts b/packages/utils/state/models/deliverablesModel.ts
index f4cb1693cd..055ca23d60 100644
--- a/packages/utils/state/models/deliverablesModel.ts
+++ b/packages/utils/state/models/deliverablesModel.ts
@@ -53,6 +53,7 @@ export interface CompetitionDeliverable {
   competitionUUID: CompetitionUUID;
   competition?: Competition;
   deliverable: Deliverable;
+  isPublic: boolean;
   open: boolean;
   openTime?: Date;
   closeTime?: Date;
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 88383a0661..259466bb1e 100644
--- a/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
+++ b/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
@@ -3,25 +3,12 @@ import { ReactNode, useContext } from "react";
 import { BoxTitle, Button, ContentBox, PeopleIcon } from "ui";
 import {
   CompetitionStatus,
-  ExternalDeliverablesType,
-  FormType,
-  TeamArtifactType,
   TeamStatus,
   useFindDeliverablesByCompetitionQuery,
   useFindTeamDeliverablesQuery,
 } 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,
-];
-
 export function Deliverables(): ReactNode {
   const { team, canManageTeams, isTeamMember } = useContext(TeamContext);
   const { data: { data: deliverables } = { data: [] } } =
@@ -31,10 +18,13 @@ export function Deliverables(): ReactNode {
       pageSize: 30,
     });
 
+  const visibleDeliverables = deliverables.filter(
+    (deliverable) => deliverable.isPublic,
+  );
+
   const { data: teamDeliverables } = useFindTeamDeliverablesQuery({
     teamID: team.id,
   });
-  console.log(teamDeliverables);
   const canManage =
     (team.status !== TeamStatus.WITHDRAWN && isTeamMember) || canManageTeams;
 
@@ -50,11 +40,7 @@ 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 <></>;
+        {visibleDeliverables.map((deliverable) => {
           return (
             <Deliverable
               team={team}
-- 
GitLab


From 8dc957765119ed0be0e213af397b6f62f7eac35e Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Mon, 9 Dec 2024 11:33:31 +0100
Subject: [PATCH 12/17] add visibility management options

---
 .../state/slices/api/competitionsSlice.ts     | 22 +++++++++++
 .../Competition/components/Deliverables.tsx   | 37 ++++++++++++++++++-
 .../components/Deliverables.utils.tsx         | 32 +++++++++++++++-
 3 files changed, 87 insertions(+), 4 deletions(-)

diff --git a/packages/utils/state/slices/api/competitionsSlice.ts b/packages/utils/state/slices/api/competitionsSlice.ts
index 0b90f172b8..6438ceaacf 100644
--- a/packages/utils/state/slices/api/competitionsSlice.ts
+++ b/packages/utils/state/slices/api/competitionsSlice.ts
@@ -144,6 +144,26 @@ export const competitionsSlice = apiSlice
         }),
         invalidatesTags: ["CompetitionDeliverables"],
       }),
+      makeCompetitionDeliverablePublic: builder.mutation<
+        void,
+        { competitionUUID: CompetitionUUID; deliverableUUID: DeliverableUUID }
+      >({
+        query: ({ competitionUUID, deliverableUUID }) => ({
+          method: "PUT",
+          url: `competitions/${competitionUUID}/deliverables/${deliverableUUID}/make-public`,
+        }),
+        invalidatesTags: ["CompetitionDeliverables"],
+      }),
+      hideCompetitionDeliverable: builder.mutation<
+        void,
+        { competitionUUID: CompetitionUUID; deliverableUUID: DeliverableUUID }
+      >({
+        query: ({ competitionUUID, deliverableUUID }) => ({
+          method: "PUT",
+          url: `competitions/${competitionUUID}/deliverables/${deliverableUUID}/hide`,
+        }),
+        invalidatesTags: ["CompetitionDeliverables"],
+      }),
 
       //
       // Phases
@@ -221,4 +241,6 @@ export const {
   useGetCompetitionPhasesQuery,
   useOpenCompetitionPhaseMutation,
   useCloseCompetitionPhaseMutation,
+  useMakeCompetitionDeliverablePublicMutation,
+  useHideCompetitionDeliverableMutation,
 } = competitionsSlice;
diff --git a/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx b/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx
index cecbd95783..831d9f4d00 100644
--- a/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx
+++ b/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx
@@ -14,7 +14,9 @@ import {
   DeliverableUUID,
   capitalize,
   useCloseCompetitionDeliverableMutation,
+  useHideCompetitionDeliverableMutation,
   useLazyFindDeliverablesByCompetitionQuery,
+  useMakeCompetitionDeliverablePublicMutation,
   useOpenCompetitionDeliverableMutation,
   useUnassignCompetitionDeliverableMutation,
   useUpdateCompetitionDeliverableMutation,
@@ -65,7 +67,7 @@ function DeliverablesTable({
 }): ReactNode {
   const [deliverable, setDeliverable] = useState<{
     deliverableUUID: DeliverableUUID;
-    mode: "unassign" | "open" | "close" | "update";
+    mode: "unassign" | "open" | "close" | "update" | "make-public" | "hide";
     onConfirm: (body?: { openTime: Date; closeTime: Date }) => void;
   }>();
 
@@ -77,6 +79,8 @@ function DeliverablesTable({
   const [open] = useOpenCompetitionDeliverableMutation();
   const [close] = useCloseCompetitionDeliverableMutation();
   const [update] = useUpdateCompetitionDeliverableMutation();
+  const [makePublic] = useMakeCompetitionDeliverablePublicMutation();
+  const [hide] = useHideCompetitionDeliverableMutation();
 
   function closeModal(): void {
     setDeliverable(undefined);
@@ -115,6 +119,28 @@ function DeliverablesTable({
     });
   }
 
+  function onMakePublic(deliverableUUID: DeliverableUUID): void {
+    setDeliverable({
+      deliverableUUID,
+      mode: "make-public",
+      onConfirm: () => {
+        makePublic({ competitionUUID, deliverableUUID });
+        closeModal();
+      },
+    });
+  }
+
+  function onHide(deliverableUUID: DeliverableUUID): void {
+    setDeliverable({
+      deliverableUUID,
+      mode: "hide",
+      onConfirm: () => {
+        hide({ competitionUUID, deliverableUUID });
+        closeModal();
+      },
+    });
+  }
+
   function onUpdate(deliverableUUID: DeliverableUUID): void {
     setDeliverable({
       deliverableUUID,
@@ -138,7 +164,14 @@ function DeliverablesTable({
         className="my-4 bg-i-white p-4 rounded-md"
         disablePagination
         rows={getRows(data)}
-        columns={getColumns(onOpen, onClose, onUnassign, onUpdate)}
+        columns={getColumns(
+          onOpen,
+          onClose,
+          onUnassign,
+          onUpdate,
+          onMakePublic,
+          onHide,
+        )}
         loading={isLoading}
       />
       {deliverable != null && (
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 bc8b52bb00..aad5bee55b 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
@@ -4,8 +4,10 @@ import {
   CheckIcon,
   CloseIcon,
   EditIcon,
+  ExclamationIcon,
   friendlyString,
   NotAllowedIcon,
+  PersonPlayIcon,
   TableColumnV2 as TableColumn,
   TableRowV2 as TableRow,
   TimeTooltip,
@@ -18,6 +20,7 @@ export interface DeliverablesRow {
   icon: string;
   title: string;
   open: boolean;
+  isPublic?: boolean;
   openTime?: Date;
   closeTime?: Date;
 }
@@ -25,7 +28,7 @@ export interface DeliverablesRow {
 export function getRows(
   data: CompetitionDeliverable[],
 ): Array<TableRow<DeliverablesRow>> {
-  return data.map(({ deliverable, open, closeTime, openTime }) => ({
+  return data.map(({ deliverable, open, closeTime, openTime, isPublic }) => ({
     id: deliverable.uuid,
     title: deliverable.title,
     icon: deliverable.icon,
@@ -33,6 +36,7 @@ export function getRows(
     open,
     openTime,
     closeTime,
+    isPublic,
   }));
 }
 
@@ -41,6 +45,8 @@ export function getColumns(
   onClose: (deliverableUUID: DeliverableUUID) => void,
   onUnassign: (deliverableUUID: DeliverableUUID) => void,
   onUpdate: (deliverableUUID: DeliverableUUID) => void,
+  onMakePublic: (deliverableUUID: DeliverableUUID) => void,
+  onHide: (deliverableUUID: DeliverableUUID) => void,
 ): Array<TableColumn<TableRow<DeliverablesRow>>> {
   return [
     {
@@ -111,7 +117,8 @@ export function getColumns(
       title: "Action",
       key: "action",
       isCentered: true,
-      renderCell: ({ open, id }): ReactNode => {
+      renderCell: ({ open, isPublic, id }): ReactNode => {
+        console.log("isPublic", isPublic);
         return (
           <div className="flex items-center gap-2">
             <Tooltip title="Unassign Deliverable">
@@ -144,6 +151,27 @@ export function getColumns(
                 </button>
               </Tooltip>
             )}
+            {isPublic ? (
+              <Tooltip title="Hide Deliverable">
+                <button
+                  type="button"
+                  onClick={() => onHide(id)}
+                  className="text-i-red"
+                >
+                  <ExclamationIcon />
+                </button>
+              </Tooltip>
+            ) : (
+              <Tooltip title="Make Public">
+                <button
+                  type="button"
+                  onClick={() => onMakePublic(id)}
+                  className="text-i-green"
+                >
+                  <PersonPlayIcon />
+                </button>
+              </Tooltip>
+            )}
           </div>
         );
       },
-- 
GitLab


From a467fb93fda50529bbf354265445ec4da62a0eda Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos Antoniou <orestis@igem.org>
Date: Mon, 9 Dec 2024 13:44:27 +0000
Subject: [PATCH 13/17] Apply 1 suggestion(s) to 1 file(s)

Co-authored-by: Fabio Maschi <fabio@igem.org>
---
 .../Competitions/Competition/components/Deliverables.utils.tsx   | 1 -
 1 file changed, 1 deletion(-)

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 aad5bee55b..df5175e58b 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
@@ -118,7 +118,6 @@ export function getColumns(
       key: "action",
       isCentered: true,
       renderCell: ({ open, isPublic, id }): ReactNode => {
-        console.log("isPublic", isPublic);
         return (
           <div className="flex items-center gap-2">
             <Tooltip title="Unassign Deliverable">
-- 
GitLab


From 64f7eb0c5e1bd96f4b553c63806486165132f9ca Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Tue, 10 Dec 2024 11:19:24 +0100
Subject: [PATCH 14/17] revert api changes

---
 .../state/slices/api/competitionsSlice.ts     | 22 ------------
 .../Competition/components/Deliverables.tsx   | 35 +------------------
 .../components/Deliverables.utils.tsx         | 32 ++---------------
 3 files changed, 4 insertions(+), 85 deletions(-)

diff --git a/packages/utils/state/slices/api/competitionsSlice.ts b/packages/utils/state/slices/api/competitionsSlice.ts
index 6438ceaacf..0b90f172b8 100644
--- a/packages/utils/state/slices/api/competitionsSlice.ts
+++ b/packages/utils/state/slices/api/competitionsSlice.ts
@@ -144,26 +144,6 @@ export const competitionsSlice = apiSlice
         }),
         invalidatesTags: ["CompetitionDeliverables"],
       }),
-      makeCompetitionDeliverablePublic: builder.mutation<
-        void,
-        { competitionUUID: CompetitionUUID; deliverableUUID: DeliverableUUID }
-      >({
-        query: ({ competitionUUID, deliverableUUID }) => ({
-          method: "PUT",
-          url: `competitions/${competitionUUID}/deliverables/${deliverableUUID}/make-public`,
-        }),
-        invalidatesTags: ["CompetitionDeliverables"],
-      }),
-      hideCompetitionDeliverable: builder.mutation<
-        void,
-        { competitionUUID: CompetitionUUID; deliverableUUID: DeliverableUUID }
-      >({
-        query: ({ competitionUUID, deliverableUUID }) => ({
-          method: "PUT",
-          url: `competitions/${competitionUUID}/deliverables/${deliverableUUID}/hide`,
-        }),
-        invalidatesTags: ["CompetitionDeliverables"],
-      }),
 
       //
       // Phases
@@ -241,6 +221,4 @@ export const {
   useGetCompetitionPhasesQuery,
   useOpenCompetitionPhaseMutation,
   useCloseCompetitionPhaseMutation,
-  useMakeCompetitionDeliverablePublicMutation,
-  useHideCompetitionDeliverableMutation,
 } = competitionsSlice;
diff --git a/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx b/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx
index 831d9f4d00..4e321122c2 100644
--- a/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx
+++ b/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx
@@ -14,9 +14,7 @@ import {
   DeliverableUUID,
   capitalize,
   useCloseCompetitionDeliverableMutation,
-  useHideCompetitionDeliverableMutation,
   useLazyFindDeliverablesByCompetitionQuery,
-  useMakeCompetitionDeliverablePublicMutation,
   useOpenCompetitionDeliverableMutation,
   useUnassignCompetitionDeliverableMutation,
   useUpdateCompetitionDeliverableMutation,
@@ -79,8 +77,6 @@ function DeliverablesTable({
   const [open] = useOpenCompetitionDeliverableMutation();
   const [close] = useCloseCompetitionDeliverableMutation();
   const [update] = useUpdateCompetitionDeliverableMutation();
-  const [makePublic] = useMakeCompetitionDeliverablePublicMutation();
-  const [hide] = useHideCompetitionDeliverableMutation();
 
   function closeModal(): void {
     setDeliverable(undefined);
@@ -119,28 +115,6 @@ function DeliverablesTable({
     });
   }
 
-  function onMakePublic(deliverableUUID: DeliverableUUID): void {
-    setDeliverable({
-      deliverableUUID,
-      mode: "make-public",
-      onConfirm: () => {
-        makePublic({ competitionUUID, deliverableUUID });
-        closeModal();
-      },
-    });
-  }
-
-  function onHide(deliverableUUID: DeliverableUUID): void {
-    setDeliverable({
-      deliverableUUID,
-      mode: "hide",
-      onConfirm: () => {
-        hide({ competitionUUID, deliverableUUID });
-        closeModal();
-      },
-    });
-  }
-
   function onUpdate(deliverableUUID: DeliverableUUID): void {
     setDeliverable({
       deliverableUUID,
@@ -164,14 +138,7 @@ function DeliverablesTable({
         className="my-4 bg-i-white p-4 rounded-md"
         disablePagination
         rows={getRows(data)}
-        columns={getColumns(
-          onOpen,
-          onClose,
-          onUnassign,
-          onUpdate,
-          onMakePublic,
-          onHide,
-        )}
+        columns={getColumns(onOpen, onClose, onUnassign, onUpdate)}
         loading={isLoading}
       />
       {deliverable != null && (
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 df5175e58b..54aad98bc5 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
@@ -4,10 +4,8 @@ import {
   CheckIcon,
   CloseIcon,
   EditIcon,
-  ExclamationIcon,
   friendlyString,
   NotAllowedIcon,
-  PersonPlayIcon,
   TableColumnV2 as TableColumn,
   TableRowV2 as TableRow,
   TimeTooltip,
@@ -20,7 +18,7 @@ export interface DeliverablesRow {
   icon: string;
   title: string;
   open: boolean;
-  isPublic?: boolean;
+
   openTime?: Date;
   closeTime?: Date;
 }
@@ -28,7 +26,7 @@ export interface DeliverablesRow {
 export function getRows(
   data: CompetitionDeliverable[],
 ): Array<TableRow<DeliverablesRow>> {
-  return data.map(({ deliverable, open, closeTime, openTime, isPublic }) => ({
+  return data.map(({ deliverable, open, closeTime, openTime }) => ({
     id: deliverable.uuid,
     title: deliverable.title,
     icon: deliverable.icon,
@@ -36,7 +34,6 @@ export function getRows(
     open,
     openTime,
     closeTime,
-    isPublic,
   }));
 }
 
@@ -45,8 +42,6 @@ export function getColumns(
   onClose: (deliverableUUID: DeliverableUUID) => void,
   onUnassign: (deliverableUUID: DeliverableUUID) => void,
   onUpdate: (deliverableUUID: DeliverableUUID) => void,
-  onMakePublic: (deliverableUUID: DeliverableUUID) => void,
-  onHide: (deliverableUUID: DeliverableUUID) => void,
 ): Array<TableColumn<TableRow<DeliverablesRow>>> {
   return [
     {
@@ -117,7 +112,7 @@ export function getColumns(
       title: "Action",
       key: "action",
       isCentered: true,
-      renderCell: ({ open, isPublic, id }): ReactNode => {
+      renderCell: ({ open, id }): ReactNode => {
         return (
           <div className="flex items-center gap-2">
             <Tooltip title="Unassign Deliverable">
@@ -150,27 +145,6 @@ export function getColumns(
                 </button>
               </Tooltip>
             )}
-            {isPublic ? (
-              <Tooltip title="Hide Deliverable">
-                <button
-                  type="button"
-                  onClick={() => onHide(id)}
-                  className="text-i-red"
-                >
-                  <ExclamationIcon />
-                </button>
-              </Tooltip>
-            ) : (
-              <Tooltip title="Make Public">
-                <button
-                  type="button"
-                  onClick={() => onMakePublic(id)}
-                  className="text-i-green"
-                >
-                  <PersonPlayIcon />
-                </button>
-              </Tooltip>
-            )}
           </div>
         );
       },
-- 
GitLab


From 31026f2623ecf8e4824305349adebc4cbefe7835 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Tue, 10 Dec 2024 12:47:02 +0100
Subject: [PATCH 15/17] update visible competition deliverables

---
 packages/utils/state/models/deliverablesModel.ts           | 1 -
 packages/utils/state/slices/api/competitionsSlice.ts       | 2 +-
 .../Team/TeamPage/components/Deliverables/Deliverables.tsx | 7 ++-----
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/packages/utils/state/models/deliverablesModel.ts b/packages/utils/state/models/deliverablesModel.ts
index 055ca23d60..f4cb1693cd 100644
--- a/packages/utils/state/models/deliverablesModel.ts
+++ b/packages/utils/state/models/deliverablesModel.ts
@@ -53,7 +53,6 @@ export interface CompetitionDeliverable {
   competitionUUID: CompetitionUUID;
   competition?: Competition;
   deliverable: Deliverable;
-  isPublic: boolean;
   open: boolean;
   openTime?: Date;
   closeTime?: Date;
diff --git a/packages/utils/state/slices/api/competitionsSlice.ts b/packages/utils/state/slices/api/competitionsSlice.ts
index 0b90f172b8..f31b2d3a1c 100644
--- a/packages/utils/state/slices/api/competitionsSlice.ts
+++ b/packages/utils/state/slices/api/competitionsSlice.ts
@@ -59,7 +59,7 @@ export const competitionsSlice = apiSlice
       }),
       findDeliverablesByCompetition: builder.query<
         Paginated<CompetitionDeliverable>,
-        PaginatedParams<{ competitionUUID: CompetitionUUID }>
+        PaginatedParams<{ competitionUUID: CompetitionUUID; visible?: boolean }>
       >({
         query: ({ competitionUUID, ...params }) => ({
           url: `competitions/${competitionUUID}/deliverables`,
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 259466bb1e..f7b6eb643c 100644
--- a/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
+++ b/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
@@ -16,12 +16,9 @@ export function Deliverables(): ReactNode {
       competitionUUID: team.competitionUUID,
       page: 1,
       pageSize: 30,
+      visible: true,
     });
 
-  const visibleDeliverables = deliverables.filter(
-    (deliverable) => deliverable.isPublic,
-  );
-
   const { data: teamDeliverables } = useFindTeamDeliverablesQuery({
     teamID: team.id,
   });
@@ -40,7 +37,7 @@ export function Deliverables(): ReactNode {
         )}
       </BoxTitle>
       <div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 pt-4">
-        {visibleDeliverables.map((deliverable) => {
+        {deliverables.map((deliverable) => {
           return (
             <Deliverable
               team={team}
-- 
GitLab


From 3eafe92ede03e4e8c10b07039fb193a9fa0f1452 Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos <orestis@igem.org>
Date: Tue, 10 Dec 2024 16:16:04 +0100
Subject: [PATCH 16/17] after review

---
 .../state/slices/api/competitionsSlice.ts     |  2 +-
 packages/utils/state/slices/api/teamsSlice.ts |  7 ++---
 .../Deliverables/Deliverable/Deliverable.tsx  | 14 ++++-----
 .../components/Deliverables/Deliverables.tsx  | 31 ++++++-------------
 4 files changed, 20 insertions(+), 34 deletions(-)

diff --git a/packages/utils/state/slices/api/competitionsSlice.ts b/packages/utils/state/slices/api/competitionsSlice.ts
index f31b2d3a1c..0b90f172b8 100644
--- a/packages/utils/state/slices/api/competitionsSlice.ts
+++ b/packages/utils/state/slices/api/competitionsSlice.ts
@@ -59,7 +59,7 @@ export const competitionsSlice = apiSlice
       }),
       findDeliverablesByCompetition: builder.query<
         Paginated<CompetitionDeliverable>,
-        PaginatedParams<{ competitionUUID: CompetitionUUID; visible?: boolean }>
+        PaginatedParams<{ competitionUUID: CompetitionUUID }>
       >({
         query: ({ competitionUUID, ...params }) => ({
           url: `competitions/${competitionUUID}/deliverables`,
diff --git a/packages/utils/state/slices/api/teamsSlice.ts b/packages/utils/state/slices/api/teamsSlice.ts
index ddaa9fdc02..f9d83beffd 100644
--- a/packages/utils/state/slices/api/teamsSlice.ts
+++ b/packages/utils/state/slices/api/teamsSlice.ts
@@ -29,7 +29,6 @@ import {
   TeamArtifact,
   TeamArtifactType,
   TeamAssociationForm,
-  TeamDeliverable,
   TeamDeliverableByTypeQueryFilters,
   TeamDeliverableStatus,
   TeamDeliverablesPaginationQueryResults,
@@ -617,8 +616,8 @@ export const teamsSlice = apiSlice
         }),
         providesTags: ["Deliverables"],
       }),
-      findTeamDeliverables: builder.query<
-        TeamDeliverable[],
+      findVisibleTeamDeliverables: builder.query<
+        TeamDeliverableStatus[],
         { teamID: TeamID }
       >({
         query: ({ teamID }) => `teams/${teamID}/deliverables/public`,
@@ -1069,5 +1068,5 @@ export const {
   useLazySearchCompetitionFormsQuery,
   useUpdateCompetitionFormStatusMutation,
   useFindTeamArtifactsQuery,
-  useFindTeamDeliverablesQuery,
+  useFindVisibleTeamDeliverablesQuery,
 } = teamsSlice;
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 aa4b2a0795..62f84bc078 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,23 +3,21 @@ 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 = [
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 f7b6eb643c..1153de85d7 100644
--- a/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
+++ b/websites/teams/src/containers/Team/TeamPage/components/Deliverables/Deliverables.tsx
@@ -4,28 +4,20 @@ import { BoxTitle, Button, ContentBox, PeopleIcon } from "ui";
 import {
   CompetitionStatus,
   TeamStatus,
-  useFindDeliverablesByCompetitionQuery,
-  useFindTeamDeliverablesQuery,
+  useFindVisibleTeamDeliverablesQuery,
 } from "utils";
-import { Deliverable } from "./Deliverable/Deliverable";
+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,
-      visible: true,
-    });
-
-  const { data: teamDeliverables } = useFindTeamDeliverablesQuery({
+  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"
@@ -37,16 +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">
-        {deliverables.map((deliverable) => {
+        {teamDeliverables?.map((teamDeliverable) => {
           return (
-            <Deliverable
+            <SingleDeliverable
               team={team}
-              teamDeliverable={teamDeliverables?.find(
-                ({ deliverable: { uuid } }) =>
-                  uuid === deliverable.deliverable.uuid,
-              )}
-              deliverable={deliverable}
-              key={deliverable.deliverable.uuid}
+              teamDeliverable={teamDeliverable}
+              deliverable={teamDeliverable.deliverable}
+              key={teamDeliverable.deliverable.uuid}
             />
           );
         })}
-- 
GitLab


From 621b7ebbec12ee23de0ba39f98efc70ecdcbeb2c Mon Sep 17 00:00:00 2001
From: Orestis Athanasopoulos Antoniou <orestis@igem.org>
Date: Tue, 10 Dec 2024 16:55:52 +0000
Subject: [PATCH 17/17] Apply 1 suggestion(s) to 1 file(s)

Co-authored-by: Fabio Maschi <fabio@igem.org>
---
 .../Competitions/Competition/components/Deliverables.tsx        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx b/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx
index 4e321122c2..cecbd95783 100644
--- a/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx
+++ b/websites/hq/src/containers/Competitions/Competitions/Competition/components/Deliverables.tsx
@@ -65,7 +65,7 @@ function DeliverablesTable({
 }): ReactNode {
   const [deliverable, setDeliverable] = useState<{
     deliverableUUID: DeliverableUUID;
-    mode: "unassign" | "open" | "close" | "update" | "make-public" | "hide";
+    mode: "unassign" | "open" | "close" | "update";
     onConfirm: (body?: { openTime: Date; closeTime: Date }) => void;
   }>();
 
-- 
GitLab