diff --git a/frontend/src/components/card-content/CardContent.tsx b/frontend/src/components/card-content/CardContent.tsx index 7e6c8b317..2eef6eab1 100644 --- a/frontend/src/components/card-content/CardContent.tsx +++ b/frontend/src/components/card-content/CardContent.tsx @@ -5,11 +5,20 @@ import { Box } from "@mui/material"; import { cardContentWrapperStyle } from "./style"; import { CardContentProps } from "./types"; import { displayContentByType, onClick } from "./utils"; +import { useBoard } from "~/providers/BoardProvider"; export const CardContent: FC = ({ card }) => { + const { boardImages } = useBoard(); + return ( onClick(card)}> - {displayContentByType(card)} + {card.resourceType === "board" + ? displayContentByType( + card, + boardImages?.find((img: any) => img._id === card.resourceUrl) + ?.imageUrl, + ) + : displayContentByType(card)} ); }; diff --git a/frontend/src/components/card-content/utils.tsx b/frontend/src/components/card-content/utils.tsx index b83f16c87..f43689ec6 100644 --- a/frontend/src/components/card-content/utils.tsx +++ b/frontend/src/components/card-content/utils.tsx @@ -27,7 +27,7 @@ export const onClick = (card: Card) => { } }; -export const displayContentByType = (card: Card) => { +export const displayContentByType = (card: Card, src?: string) => { const cardType = card.resourceType as RESOURCE_TYPE; switch (cardType) { case RESOURCE_TYPE.VIDEO: @@ -51,5 +51,7 @@ export const displayContentByType = (card: Card) => { extension={card.metadata ? card.metadata.extension : ""} /> ); + case RESOURCE_TYPE.BOARD: + return ; } }; diff --git a/frontend/src/providers/BoardProvider/index.tsx b/frontend/src/providers/BoardProvider/index.tsx index b60b0fd23..c927469bb 100644 --- a/frontend/src/providers/BoardProvider/index.tsx +++ b/frontend/src/providers/BoardProvider/index.tsx @@ -99,12 +99,6 @@ export const BoardProvider: FC = ({ children }) => { skip: !boardResourceIds?.length, }); - console.log(boardImages); - - useEffect(() => { - console.log("cc", boardImages); - }, [boardImages]); - const documents = useMemo(() => { return documentsData ?? []; }, [documentsData]); @@ -189,6 +183,7 @@ export const BoardProvider: FC = ({ children }) => { openActiveCardAction, closeActiveCardAction, behaviours, + boardImages, }), [ board, @@ -201,6 +196,7 @@ export const BoardProvider: FC = ({ children }) => { activeCard, isModalDuplicate, behaviours, + boardImages, ], ); diff --git a/frontend/src/providers/BoardProvider/types.ts b/frontend/src/providers/BoardProvider/types.ts index e5793e7fd..b41e17ea1 100644 --- a/frontend/src/providers/BoardProvider/types.ts +++ b/frontend/src/providers/BoardProvider/types.ts @@ -36,6 +36,7 @@ export type BoardContextType = { openActiveCardAction: (card: Card, actionType: BOARD_MODAL_TYPE) => void; closeActiveCardAction: (actionType: BOARD_MODAL_TYPE) => void; behaviours: any; + boardImages: any; //TODO : type }; export type Section = {