import React, { useState, useEffect } from 'react'; import theme from '../theme'; import AppSearch from './Appsearch.jsx'; import { Paper, Typography, Divider, IconButton, Badge, CircularProgress, Tooltip, Button, } from "@material-ui/core"; import { Close as CloseIcon, Delete as DeleteIcon, } from "@material-ui/icons"; const AppSearchPopout = (props) => { const { cy, paperTitle, setPaperTitle, newSelectedApp, setNewSelectedApp, selectionOpen, setSelectionOpen, discoveryData, setDiscoveryData, userdata, } = props; const [defaultSearch, setDefaultSearch] = React.useState(paperTitle !== undefined ? paperTitle : "") if (selectionOpen !== true) { return null } return ( {paperTitle !== undefined && paperTitle.length > 0 ? {paperTitle} : null} { //cy.elements().unselectify(); if (cy !== undefined) { cy.elements().unselect() } e.preventDefault(); setSelectionOpen(false) }} > {/* {/*Causes errors in Cytoscape. Removing for now.} { e.preventDefault(); setDiscoveryData({ "id": discoveryData.id, "label": discoveryData.label, "name": "" }) setNewSelectedApp({ "image_url": "", "name": "", "id": "", "objectID": "remove", }) setSelectionOpen(true) setDefaultSearch("") const foundelement = cy.getElementById(discoveryData.id) if (foundelement !== undefined && foundelement !== null) { console.log("element: ", foundelement) foundelement.data("large_image", discoveryData.large_image) foundelement.data("text_margin_y", "14px") foundelement.data("margin_x", "32px") foundelement.data("margin_y", "19x") foundelement.data("width", "45px") foundelement.data("height", "45px") } setTimeout(() => { setDiscoveryData({}) setNewSelectedApp({}) }, 1000) }} > */}
{discoveryData.name !== undefined && discoveryData.name !== null && discoveryData.name.length > 0 ?
{discoveryData.id} 0 ? newSelectedApp.image_url : discoveryData.large_image} style={{height: 40, width: 40, margin: "auto",}}/>
: {discoveryData.id} } {discoveryData.name !== undefined && discoveryData.name !== null && discoveryData.name.length > 0 ? discoveryData.name : newSelectedApp.name !== undefined && newSelectedApp.name !== null && newSelectedApp.name.length > 0 ? newSelectedApp.name : `No ${discoveryData.label} app chosen` }
{discoveryData !== undefined && discoveryData.name !== undefined && discoveryData.name !== null && discoveryData.name.length > 0 ? {discoveryData.description} {/*isCloud && defaultSearch !== undefined && defaultSearch.length > 0 ? {< newSelectedApp={newSelectedApp} setNewSelectedApp={setNewSelectedApp} defaultSearch={defaultSearch} />} : null */} : selectionOpen ? Click an app below to select it : }
{selectionOpen ? : null}
) } export default AppSearchPopout;