From 962faab3c37dd3e617db74bc2a6e13e9303c59c4 Mon Sep 17 00:00:00 2001 From: tmaog Date: Thu, 22 May 2025 12:06:35 +0200 Subject: [PATCH 1/2] fix: publish concept implementation --- src/components/Card/FlowCard.tsx | 22 +++++++++++++++++----- src/components/Modals/EditFlowModal.tsx | 20 +++++++++++++++++--- src/pages/flows/index.tsx | 1 - 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/components/Card/FlowCard.tsx b/src/components/Card/FlowCard.tsx index 72a4f2a8..2a08aade 100644 --- a/src/components/Card/FlowCard.tsx +++ b/src/components/Card/FlowCard.tsx @@ -1,13 +1,15 @@ -import { DeleteIcon } from '@chakra-ui/icons'; +import { CheckIcon, CloseIcon, DeleteIcon } from '@chakra-ui/icons'; import { Avatar, Badge, + Box, Button, Card, CardBody, CardFooter, Heading, HStack, + IconButton, Image, LinkBox, LinkOverlay, @@ -15,7 +17,7 @@ import { Spacer, Stack, Text, - Tooltip, + Tooltip,Flex } from '@chakra-ui/react'; import cardImage from '../../public/test_card.png'; import { PolyglotFlow } from '../../types/polyglotElements'; @@ -45,7 +47,7 @@ const FlowCard = ({ flow, px, py, canDelete, setSelected }: FlowCardProps) => { - {canDelete && ( + {canDelete && (<> + )} {flow.title} {flow.tags && @@ -77,6 +79,7 @@ const FlowCard = ({ flow, px, py, canDelete, setSelected }: FlowCardProps) => { In this Learning Path there are: {flow.nodes.length} learning activities + @@ -88,7 +91,16 @@ const FlowCard = ({ flow, px, py, canDelete, setSelected }: FlowCardProps) => { - )} + )} + {flow.publish ? 'Published' : 'Not published'}: + + {flow.publish ? : } + + diff --git a/src/components/Modals/EditFlowModal.tsx b/src/components/Modals/EditFlowModal.tsx index 48b2df90..400ea682 100644 --- a/src/components/Modals/EditFlowModal.tsx +++ b/src/components/Modals/EditFlowModal.tsx @@ -1,4 +1,4 @@ -import { AddIcon, CloseIcon } from '@chakra-ui/icons'; +import { AddIcon, CheckIcon, CloseIcon } from '@chakra-ui/icons'; import { Box, Button, @@ -54,7 +54,7 @@ const EditFlowModal = ({ const [topicName, setTopicName] = useState(''); const [topics, setTopics] = useState([...flow.topics]); const [tagName, setTagName] = useState(''); - const [publish] = useState(false); + const [publish, setPublish] = useState(false); const [colorTag, setColorTag] = useState(colors[0]); const [tags, setTags] = useState([...flow.tags]); const { isOpen: ioPop, onClose: ocPop, onOpen: opPop } = useDisclosure(); @@ -67,6 +67,7 @@ const EditFlowModal = ({ setTopics([...flow.topics]); setColorTag(colors[0]); setTags([...flow.tags]); + setPublish(flow.publish); }, [flow]); return ( @@ -270,6 +271,19 @@ const EditFlowModal = ({ ))} + + {publish ? 'Published' : 'Not published'}:{' '} + { + console.log(publish); + setPublish(!publish); + }} + aria-label={''} + > + {publish ? : } + + + {canDelete && ( + <> + + )} {flow.title} {flow.tags && @@ -79,7 +82,6 @@ const FlowCard = ({ flow, px, py, canDelete, setSelected }: FlowCardProps) => { In this Learning Path there are: {flow.nodes.length} learning activities - @@ -91,9 +93,11 @@ const FlowCard = ({ flow, px, py, canDelete, setSelected }: FlowCardProps) => { - )} + )} + {flow.publish ? 'Published' : 'Not published'}: - {