From 6b72b41b866f0baa5ad4e4012694fdb520b0e306 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Tue, 30 Apr 2024 15:05:03 +0200 Subject: [PATCH] Fixed playground name and collection card --- .../src/components/cardComponent/index.tsx | 393 +++++++++--------- src/frontend/src/modals/IOModal/index.tsx | 4 +- .../MainPage/components/components/index.tsx | 27 +- 3 files changed, 200 insertions(+), 224 deletions(-) diff --git a/src/frontend/src/components/cardComponent/index.tsx b/src/frontend/src/components/cardComponent/index.tsx index b6c7af538..b1a712667 100644 --- a/src/frontend/src/components/cardComponent/index.tsx +++ b/src/frontend/src/components/cardComponent/index.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from "react"; import { getComponent, postLikeComponent } from "../../controllers/API"; import DeleteConfirmationModal from "../../modals/DeleteConfirmationModal"; import IOModal from "../../modals/IOModal"; +import IOModal from "../../modals/IOModal"; import useAlertStore from "../../stores/alertStore"; import useFlowStore from "../../stores/flowStore"; import useFlowsManagerStore from "../../stores/flowsManagerStore"; @@ -27,12 +28,15 @@ export default function CollectionCardComponent({ authorized = true, disabled = false, button, + onClick, onDelete, playground, + playground, }: { data: storeComponent; authorized?: boolean; disabled?: boolean; + onClick?: () => void; button?: JSX.Element; playground?: boolean; onDelete?: () => void; @@ -165,72 +169,67 @@ export default function CollectionCardComponent({ } return ( - <> - -
- -
- - - -
{data.name}
-
- {data?.metadata !== undefined && ( -
- {data.private && ( - - - - - - )} - {!data.is_component && ( - - - - - {data?.metadata?.total ?? 0} - - - - )} - - - - - {likes_count ?? 0} - - - - - - - - {downloads_count ?? 0} - - - -
+ +
+ +
+ + + +
{data.name}
+
+ {data?.metadata !== undefined && ( +
+ {data.private && ( + + + + + + )} + {!data.is_component && ( + + + + + {data?.metadata?.total ?? 0} + + + + )} + + + + + {likes_count ?? 0} + + + + + + + + {downloads_count ?? 0} + + + +
+ )} {onDelete && data?.metadata === undefined && (
- -
-
-
- {data.tags && - data.tags.length > 0 && - data.tags.map((tag, index) => ( - - {tag.name} - - ))} -
- {data.liked_by_count != undefined && ( -
- {onDelete && data?.metadata !== undefined ? ( - - { - onDelete(); - }} - > - - - - ) : ( - +
+
+
+ {data.tags && + data.tags.length > 0 && + data.tags.map((tag, index) => ( + + {tag.name} + + ))} +
+ {data.liked_by_count != undefined && ( +
+ {onDelete && data?.metadata !== undefined ? ( + + { + onDelete(); + }} > - - )} + + + ) : ( -
- )} - {button && button} - {playground && ( - + +
+ )} + {button && button} + {playground && ( + - )} -
+ }); + } + }} + > + {!loadingPlayground ? ( + + ) : ( + + )} + Playground + + )} + {openPlayground && ( + + <> + + )}
- - - - {openPlayground && ( - - <> - - )} - +
+ + ); } diff --git a/src/frontend/src/modals/IOModal/index.tsx b/src/frontend/src/modals/IOModal/index.tsx index 463d7ce1e..93fdd5d41 100644 --- a/src/frontend/src/modals/IOModal/index.tsx +++ b/src/frontend/src/modals/IOModal/index.tsx @@ -126,9 +126,9 @@ export default function IOModal({ {/* TODO ADAPT TO ALL TYPES OF INPUTS AND OUTPUTS */}
- Interaction Panel + Playground