import React, { useState, useEffect, useLayoutEffect } from "react"; import theme from '../theme.jsx'; import { Chip, Typography, Paper, Avatar, Grid, Tooltip, Button, } from "@material-ui/core"; import { AvatarGroup, } from "@mui/material" import { Restore as RestoreIcon, Edit as EditIcon, BubbleChart as BubbleChartIcon, MoreVert as MoreVertIcon, } from '@material-ui/icons'; import { useNavigate, Link, useParams } from "react-router-dom"; const workflowActionStyle = { display: "flex", width: 160, height: 44, justifyContent: "space-between", } const paperAppStyle = { minHeight: 130, maxHeight: 130, overflow: "hidden", width: "100%", color: "white", backgroundColor: theme.palette.surfaceColor, padding: "12px 12px 0px 15px", borderRadius: 5, display: "flex", boxSizing: "border-box", position: "relative", } const chipStyle = { backgroundColor: "#3d3f43", marginRight: 5, paddingLeft: 5, paddingRight: 5, height: 28, cursor: "pointer", borderColor: "#3d3f43", color: "white", } const WorkflowPaper = (props) => { const { data } = props; let navigate = useNavigate(); const [open, setOpen] = React.useState(false); const [anchorEl, setAnchorEl] = React.useState(null); const appGroup = data.action_references === undefined || data.action_references === null ? [] : data.action_references const activateWorkflow = (workflow) => { console.log("Should activate: ", workflow) } //console.log("Workflow: ", data) var boxColor = "#86c142"; var parsedName = data.name; if ( parsedName !== undefined && parsedName !== null && parsedName.length > 35 ) { parsedName = parsedName.slice(0, 36) + ".."; } const imageStyle = { width: 28, height: 28, marginRight: 10, border: "1px solid rgba(255,255,255,0.3)", } var image = data.creator_info !== undefined && data.creator_info !== null && data.creator_info.image !== undefined && data.creator_info.image !== null && data.creator_info.image.length > 0 ? : const creatorname = data.creator_info !== undefined && data.creator_info !== null && data.creator_info.username !== undefined && data.creator_info.username !== null && data.creator_info.username.length > 0 ? data.creator_info.username : "Shuffle" var orgName = ""; var orgId = ""; if ((data.objectID === undefined || data.objectID === null) && data.id !== undefined && data.id !== null) { data.objectID = data.id } //console.log("IMG: ", data) var parsedUrl = `/workflows/${data.objectID}` if (data.__queryID !== undefined && data.__queryID !== null) { parsedUrl += `?queryID=${data.__queryID}` } const paperImgStyle = { height: 150, width: "100%", backgroundImage: "linear-gradient(to right, #f86a3e, #f34079)", color: "white", position: "relative", borderRadius: "10px 10px 0% 0%", } const bgImage1 = "https://avatars.githubusercontent.com/u/5719530?v=4" const bgImage2 = "https://avatars.githubusercontent.com/u/5719530?v=4" const itemSize = 70 return (
Image alt
Image alt
{ if (data.creator_info !== undefined) { navigate("/creators/"+data.creator_info.username) } }} > {image}
{parsedName}
{/* {appGroup.length > 0 ?
{appGroup.map((app, index) => { return (
{ navigate("/apps/"+app.id) }} >
) })}
: {data.actions === undefined || data.actions === null ? 1 : data.actions.length} } */} {/* {data.triggers === undefined || data.triggers === null ? 1 : data.triggers.length} { }} > {0} */}
{/* {data.tags !== undefined && data.tags !== null ? data.tags.map((tag, index) => { if (index >= 3) { return null; } return ( ); }) : null} */}
) } export default WorkflowPaper