import React, { useEffect, useState } from 'react'; import ReactGA from 'react-ga'; import { useTheme } from '@material-ui/core/styles'; import {Link} from 'react-router-dom'; import { Search as SearchIcon, CloudQueue as CloudQueueIcon, Code as CodeIcon } from '@material-ui/icons'; import algoliasearch from 'algoliasearch/lite'; import { InstantSearch, Configure, connectSearchBox, connectHits } from 'react-instantsearch-dom'; import { Grid, Paper, TextField, ButtonBase, InputAdornment, Typography, Button, Tooltip, Card, Box, CardContent, IconButton, Zoom, CardMedia, CardActionArea, } from '@material-ui/core'; import { Avatar, AvatarGroup, } from "@mui/material" import { SkipNext as SkipNextIcon, SkipPrevious as SkipPreviousIcon, PlayArrow as PlayArrowIcon, VerifiedUser as VerifiedUserIcon, } from "@material-ui/icons"; const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e5240") const CreatorGrid = props => { const { maxRows, showName, showSuggestion, isMobile, globalUrl, parsedXs } = props const rowHandler = maxRows === undefined || maxRows === null ? 50 : maxRows const xs = parsedXs === undefined || parsedXs === null ? isMobile ? 6 : 4 : parsedXs const theme = useTheme(); //const [apps, setApps] = React.useState([]); //const [filteredApps, setFilteredApps] = React.useState([]); const [formMail, setFormMail] = React.useState(""); const [message, setMessage] = React.useState(""); const [formMessage, setFormMessage] = React.useState(""); const buttonStyle = {borderRadius: 30, height: 50, width: 220, margin: isMobile ? "15px auto 15px auto" : 20, fontSize: 18,} const innerColor = "rgba(255,255,255,0.65)" const borderRadius = 3 window.title = "Shuffle | Workflows | Discover your use-case" const submitContact = (email, message) => { const data = { "firstname": "", "lastname": "", "title": "", "companyname": "", "email": email, "phone": "", "message": message, } const errorMessage = "Something went wrong. Please contact frikky@shuffler.io directly." fetch(globalUrl+"/api/v1/contact", { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(data), }) .then(response => response.json()) .then(response => { if (response.success === true) { setFormMessage(response.reason) //alert.info("Thanks for submitting!") } else { setFormMessage(errorMessage) } setFormMail("") setMessage("") }) .catch(error => { setFormMessage(errorMessage) console.log(error) }); } // value={currentRefinement} const SearchBox = ({currentRefinement, refine, isSearchStalled} ) => { useEffect(() => { if (window !== undefined && window.location !== undefined && window.location.search !== undefined && window.location.search !== null) { const urlSearchParams = new URLSearchParams(window.location.search) const params = Object.fromEntries(urlSearchParams.entries()) const foundQuery = params["q"] if (foundQuery !== null && foundQuery !== undefined) { refine(foundQuery) } } }, []) return (
), }} autoComplete='off' type="search" color="primary" value={currentRefinement} placeholder="Find Creators..." id="shuffle_search_field" onChange={(event) => { refine(event.currentTarget.value) }} limit={5} /> {/*isSearchStalled ? 'My search is stalled' : ''*/} ) } const paperAppContainer = { display: "flex", flexWrap: "wrap", alignContent: "space-between", marginTop: 5, } const Hits = ({ hits }) => { const [mouseHoverIndex, setMouseHoverIndex] = useState(-1) var counted = 0 return ( {hits.map((data, index) => { if (counted === 12/xs*rowHandler) { return null } counted += 1 return (
{"Creator @{data.username} {data.verified === true ? : null }
{data.apps === undefined || data.apps === null ? 0 : data.apps} apps {data.workflows === null || data.workflows === undefined ? 0 : data.workflows} workflows {data.specialized_apps !== undefined && data.specialized_apps !== null && data.specialized_apps.length > 0 ? {data.specialized_apps.map((app, index) => { // Putting all this in secondary of ListItemText looked weird. return (
{ console.log("Click") //navigate("/apps/"+app.id) }} >
) })}
: null}
) })}
) } const CustomSearchBox = connectSearchBox(SearchBox) const CustomHits = connectHits(Hits) return (
{showSuggestion === true ?
Can't find what you're looking for?
setFormMail(e.target.value)} /> setMessage(e.target.value)} />
{formMessage}
: null }
) } export default CreatorGrid;