More welcome page and recommendation system integrations

This commit is contained in:
frikky
2022-07-21 02:28:00 +02:00
parent 66d7cd4e80
commit 994696c28a
4 changed files with 64 additions and 27 deletions
+13 -8
View File
@@ -14,6 +14,9 @@ import { Grid, Paper, TextField, ButtonBase, InputAdornment, Typography, Button,
const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e5240") const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e5240")
const WorkflowSearch = props => { const WorkflowSearch = props => {
const { maxRows, showName, showSuggestion, isMobile, globalUrl, parsedXs, newSelectedApp, setNewSelectedApp, defaultSearch, showSearch, ConfiguredHits } = props const { maxRows, showName, showSuggestion, isMobile, globalUrl, parsedXs, newSelectedApp, setNewSelectedApp, defaultSearch, showSearch, ConfiguredHits } = props
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
const rowHandler = maxRows === undefined || maxRows === null ? 50 : maxRows const rowHandler = maxRows === undefined || maxRows === null ? 50 : maxRows
const xs = parsedXs === undefined || parsedXs === null ? 12 : parsedXs const xs = parsedXs === undefined || parsedXs === null ? 12 : parsedXs
const theme = useTheme(); const theme = useTheme();
@@ -164,15 +167,17 @@ const WorkflowSearch = props => {
}} onMouseOut={() => { }} onMouseOut={() => {
setMouseHoverIndex(-1) setMouseHoverIndex(-1)
}} onClick={() => { }} onClick={() => {
setNewSelectedApp(data) if (setNewSelectedApp !== undefined) {
//if (data.objectID !== data.objectID) { setNewSelectedApp(data)
//} }
//ReactGA.event({ if (isCloud) {
// category: "app_search", ReactGA.event({
// action: `app_${parsedname}_${data.id}_click`, category: "app_search",
// label: "", action: `app_${parsedname}_${data.id}_personalize_click`,
//}) label: "",
})
}
}}> }}>
<div style={{display: "flex"}}> <div style={{display: "flex"}}>
<img alt={data.name} src={data.image_url} style={{width: "100%", maxWidth: 30, minWidth: 30, minHeight: 30, maxHeight: 30, display: "block", }} /> <img alt={data.name} src={data.image_url} style={{width: "100%", maxWidth: 30, minWidth: 30, minHeight: 30, maxHeight: 30, display: "block", }} />
+46 -17
View File
@@ -529,25 +529,40 @@ const Framework = (props) => {
const [newSelectedApp, setNewSelectedApp] = React.useState({}) const [newSelectedApp, setNewSelectedApp] = React.useState({})
const [defaultSearch, setDefaultSearch] = React.useState("") const [defaultSearch, setDefaultSearch] = React.useState("")
const [animationStarted, setAnimationStarted] = React.useState(false) const [animationStarted, setAnimationStarted] = React.useState(false)
const [paperTitle, setPaperTitle] = React.useState("")
const scale = size === undefined ? 1 : size > 5 ? 3 : size const scale = size === undefined ? 1 : size > 5 ? 3 : size
const alert = useAlert() const alert = useAlert()
useEffect(() => { useEffect(() => {
console.log("DISCWRAP CHANG: ", discoveryWrapper) //console.log("DISCWRAP CHANG: ", discoveryWrapper)
if (discoveryWrapper === undefined || discoveryWrapper.id === "SHUFFLE" || discoveryWrapper.id === undefined || cy === undefined) { if (discoveryWrapper === undefined || discoveryWrapper.id === "SHUFFLE" || discoveryWrapper.id === undefined || cy === undefined) {
setDiscoveryData({})
if (cy !== undefined) {
cy.nodes().unselect()
}
return return
} }
// Find the node and click it? // Find the node and click it?
const nodes = cy.nodes().jsons() setTimeout(() => {
for (var key in nodes) { const nodes = cy.nodes().jsons()
const node = nodes[key] for (var key in nodes) {
console.log("NOD: ", node) const node = nodes[key]
//console.log("NOD: ", node.data, discoveryWrapper.id)
if (node.data.id === discoveryWrapper.id) {
const tmpnode = cy.getElementById(node.data.id)
if (tmpnode !== undefined) {
tmpnode.select()
}
//cy.getElementById(node.data.id).click(); setPaperTitle(discoveryWrapper.id)
} }
}
}, 50,)
//setDiscoveryData(discoveryWrapper) //setDiscoveryData(discoveryWrapper)
}, [discoveryWrapper]) }, [discoveryWrapper])
@@ -640,6 +655,11 @@ const Framework = (props) => {
return return
} }
if (paperTitle.length > 0) {
setDiscoveryWrapper({})
setSelectionOpen(false)
}
const submitValue = { const submitValue = {
"type": discoveryData.id, "type": discoveryData.id,
"name": newSelectedApp.name, "name": newSelectedApp.name,
@@ -1498,7 +1518,15 @@ const Framework = (props) => {
{ {
Object.getOwnPropertyNames(discoveryData).length > 0 ? Object.getOwnPropertyNames(discoveryData).length > 0 ?
<Paper style={{width: 250, maxHeight: 400, overflow: "hidden", zIndex: 12500, padding: 25, paddingRight: 35, backgroundColor: theme.palette.surfaceColor, border: "1px solid rgba(255,255,255,0.2)", position: "absolute", top: 50, left: 50, }}> <Paper style={{width: 275, maxHeight: 400, overflow: "hidden", zIndex: 12500, padding: 25, paddingRight: 35, backgroundColor: theme.palette.surfaceColor, border: "1px solid rgba(255,255,255,0.2)", position: "absolute", top: 50, left: 50, }}>
{paperTitle.length > 0 ?
<span>
<Typography variant="h6" style={{textAlign: "center"}}>
{paperTitle}
</Typography>
<Divider style={{marginTop: 5, marginBottom: 5 }} />
</span>
: null}
<Tooltip <Tooltip
title="Close window" title="Close window"
placement="top" placement="top"
@@ -1513,6 +1541,7 @@ const Framework = (props) => {
e.preventDefault(); e.preventDefault();
setDiscoveryData({}) setDiscoveryData({})
setDefaultSearch("") setDefaultSearch("")
setPaperTitle("")
}} }}
> >
<CloseIcon style={{ color: "white", height: 15, width: 15, }} /> <CloseIcon style={{ color: "white", height: 15, width: 15, }} />
@@ -1586,7 +1615,7 @@ const Framework = (props) => {
<div> <div>
{discoveryData !== undefined && discoveryData.name !== undefined && discoveryData.name !== null && discoveryData.name.length > 0 ? {discoveryData !== undefined && discoveryData.name !== undefined && discoveryData.name !== null && discoveryData.name.length > 0 ?
<span> <span>
<Typography variant="body2" color="textSecondary" style={{marginTop: 10, marginBottom: 10, }}> <Typography variant="body2" color="textSecondary" style={{marginTop: 10, marginBottom: 10, maxHeight: 75, overflowY: "auto", overflowX: "hidden", }}>
{discoveryData.description} {discoveryData.description}
</Typography> </Typography>
{/*isCloud && defaultSearch !== undefined && defaultSearch.length > 0 ? {/*isCloud && defaultSearch !== undefined && defaultSearch.length > 0 ?
@@ -1622,13 +1651,13 @@ const Framework = (props) => {
} }
</div> </div>
<div style={{marginTop: 10}}> <div style={{marginTop: 10}}>
{selectionOpen ? {selectionOpen ?
<AppSearch <AppSearch
defaultSearch={defaultSearch} defaultSearch={defaultSearch}
newSelectedApp={newSelectedApp} newSelectedApp={newSelectedApp}
setNewSelectedApp={setNewSelectedApp} setNewSelectedApp={setNewSelectedApp}
/> />
: null} : null}
</div> </div>
</Paper> </Paper>
: null : null
+1 -1
View File
@@ -98,7 +98,7 @@ const WorkflowSearch = props => {
type="search" type="search"
color="primary" color="primary"
defaultValue={defaultSearch} defaultValue={defaultSearch}
placeholder={`Find ${defaultSearch} Apps...`} placeholder={`Find ${defaultSearch} Workflows...`}
id="shuffle_workflow_search_field" id="shuffle_workflow_search_field"
onChange={(event) => { onChange={(event) => {
refine(event.currentTarget.value) refine(event.currentTarget.value)
+4 -1
View File
@@ -185,8 +185,11 @@ const LoginDialog = (props) => {
} }
setIsLoggedIn(true); setIsLoggedIn(true);
if (!responseJson.tutorials.includes("welcome")) {
console.log("RUN Welcome!!")
window.location.pathname = "/welcome"
}
//navigate("/workflows")
window.location.href = "/workflows" window.location.href = "/workflows"
} }
}) })