New 1.4.0 page view looks and bugfixes

This commit is contained in:
Frikky
2024-04-29 14:37:26 +02:00
parent 455c4a46ab
commit 74e90a083e
8 changed files with 2302 additions and 578 deletions
File diff suppressed because it is too large Load Diff
+13 -5
View File
@@ -43,7 +43,7 @@ import BillingStats from "../components/BillingStats.jsx";
import { handlePayasyougo } from "../views/HandlePaymentNew.jsx" import { handlePayasyougo } from "../views/HandlePaymentNew.jsx"
const Billing = (props) => { const Billing = (props) => {
const { globalUrl, userdata, serverside, billingInfo, stripeKey, selectedOrganization, handleGetOrg, } = props; const { globalUrl, userdata, serverside, billingInfo, stripeKey, selectedOrganization, handleGetOrg, clickedFromOrgTab } = props;
//const alert = useAlert(); //const alert = useAlert();
let navigate = useNavigate(); let navigate = useNavigate();
@@ -970,21 +970,29 @@ const Billing = (props) => {
const isChildOrg = userdata.active_org.creator_org !== "" && userdata.active_org.creator_org !== undefined && userdata.active_org.creator_org !== null const isChildOrg = userdata.active_org.creator_org !== "" && userdata.active_org.creator_org !== undefined && userdata.active_org.creator_org !== null
return ( return (
<div style={{ width: "auto", padding: 27, height: "auto", backgroundColor: '#212121', borderRadius: '16px', }}> <div style={{ width: clickedFromOrgTab? 1030 : "auto", padding: 27, backgroundColor: '#212121', borderRadius: '16px', }}>
{addDealModal} {addDealModal}
{clickedFromOrgTab?
<h2 style={{ marginBottom: 8, marginTop: 0, color: "#ffffff" }}>Billing & Licensing</h2>:
<Typography variant="h4" style={{ marginTop: 20, marginBottom: 10 }}> <Typography variant="h4" style={{ marginTop: 20, marginBottom: 10 }}>
Billing & Licensing Billing & Licensing
</Typography> </Typography>}
{clickedFromOrgTab?
<span style={{ color: "#9E9E9E" }}>{isCloud ?
"Get more out of Shuffle by adding your credit card, such as no App Run limitations, and priority support from our team. We use Stripe to manage subscriptions and do not store any of your billing information. You can manage your subscription and billing information below."
:
"Shuffle is an Open Source automation platform, and no license is required. We do however offer a Scale license with HA guarantees, along with support hours. By buying a license on https://shuffler.io, you can get access to the license immediately, and if Cloud Syncronisation is enabled, the UI in your local instance will also update."
}</span>:
<Typography variant="body1" color="textSecondary" style={{ marginTop: 0, marginBottom: 10}}> <Typography variant="body1" color="textSecondary" style={{ marginTop: 0, marginBottom: 10}}>
{isCloud ? {isCloud ?
"Get more out of Shuffle by adding your credit card, such as no App Run limitations, and priority support from our team. We use Stripe to manage subscriptions and do not store any of your billing information. You can manage your subscription and billing information below." "Get more out of Shuffle by adding your credit card, such as no App Run limitations, and priority support from our team. We use Stripe to manage subscriptions and do not store any of your billing information. You can manage your subscription and billing information below."
: :
"Shuffle is an Open Source automation platform, and no license is required. We do however offer a Scale license with HA guarantees, along with support hours. By buying a license on https://shuffler.io, you can get access to the license immediately, and if Cloud Syncronisation is enabled, the UI in your local instance will also update." "Shuffle is an Open Source automation platform, and no license is required. We do however offer a Scale license with HA guarantees, along with support hours. By buying a license on https://shuffler.io, you can get access to the license immediately, and if Cloud Syncronisation is enabled, the UI in your local instance will also update."
} }
</Typography> </Typography>}
{userdata.support === true ? {userdata.support === true ?
<div style={{marginBottom: 10, }}> <div style={{marginBottom: 10, marginTop:clickedFromOrgTab?16:null, color:clickedFromOrgTab?"#F1F1F1":null }}>
For sales: Create&nbsp; For sales: Create&nbsp;
<a href={"https://docs.google.com/document/d/1OeJSi42812EMg7fUAw1HAj1ymOG8rfp8Ma_DGJKvwgI/copy?usp=sharing&organization=" + selectedOrganization.id} target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none", color: "#f85a3e" }}> <a href={"https://docs.google.com/document/d/1OeJSi42812EMg7fUAw1HAj1ymOG8rfp8Ma_DGJKvwgI/copy?usp=sharing&organization=" + selectedOrganization.id} target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none", color: "#f85a3e" }}>
New Cloud Contract New Cloud Contract
+2 -2
View File
@@ -103,8 +103,8 @@ const Branding = (props) => {
} }
return ( return (
<div style={{ width: "auto", padding: 27, height: "auto", backgroundColor: '#212121', borderRadius: '16px', }}> <div style={{ width: clickedFromOrgTab? 1030: "auto", padding: 27, height: "auto", backgroundColor: '#212121', borderRadius: '16px', }}>
<h2> <h2 style={{marginTop: clickedFromOrgTab ?0:null,}}>
Branding Branding
</h2> </h2>
<Typography variant="body1" color="textSecondary" style={{ marginTop: 20, marginBottom: 10 }}> <Typography variant="body1" color="textSecondary" style={{ marginTop: 20, marginBottom: 10 }}>
+12 -48
View File
@@ -115,43 +115,6 @@ const CacheView = (props) => {
}); });
}; };
// const getCacheList = (orgId) => {
// fetch(`${globalUrl}/api/v1/orgs/${orgId}/get_cache`, {
// method: "GET",
// headers: {
// "Content-Type": "application/json",
// Accept: "application/json",
// },
// credentials: "include",
// })
// .then((response) => {
// if (response.status !== 200) {
// console.log("Status not 200 for WORKFLOW EXECUTION :O!");
// }
// return response.json();
// })
// .then((responseJson) => {
// if (responseJson.success !== false) {
// console.log("Found cache: ", responseJson)
// setListCache(responseJson)
// } else {
// console.log("Couldn't find the creator profile (rerun?): ", responseJson)
// // If the current user is any of the Shuffle Creators
// // AND the workflow doesn't have an owner: allow editing.
// // else: Allow suggestions?
// //console.log("User: ", userdata)
// //if (rerun !== true) {
// // getUserProfile(userdata.id, true)
// //}
// }
// })
// .catch((error) => {
// console.log("Get userprofile error: ", error);
// })
// }
const deleteCache = (orgId, key) => { const deleteCache = (orgId, key) => {
toast("Attempting to delete Cache"); toast("Attempting to delete Cache");
@@ -403,7 +366,7 @@ const CacheView = (props) => {
</span> </span>
</div> </div>
<Button <Button
style={{backgroundColor: isSelectedDataStore?'rgba(255, 132, 68, 0.2)':null, color:isSelectedDataStore?"#FF8444":null, borderRadius:isSelectedDataStore?200:null, width:isSelectedDataStore?162:null, height:isSelectedDataStore?40:null}} style={{backgroundColor: isSelectedDataStore?'rgba(255, 132, 68, 0.2)':null, boxShadow: isSelectedDataStore ? "none":null,textTransform: isSelectedDataStore ? 'capitalize':null, color:isSelectedDataStore?"#FF8444":null, borderRadius:isSelectedDataStore?200:null, width:isSelectedDataStore?162:null, height:isSelectedDataStore?40:null}}
variant="contained" variant="contained"
color="primary" color="primary"
onClick={() =>{ onClick={() =>{
@@ -416,7 +379,7 @@ const CacheView = (props) => {
Add Cache Add Cache
</Button> </Button>
<Button <Button
style={{ marginLeft: 5, marginRight: 15, backgroundColor: isSelectedDataStore?"#2F2F2F":null,borderRadius:isSelectedDataStore?200:null, width:isSelectedDataStore?81:null, height:isSelectedDataStore?40:null, }} style={{ marginLeft: 5, marginRight: 15, backgroundColor: isSelectedDataStore?"#2F2F2F":null, boxShadow: isSelectedDataStore ? "none":null,textTransform: isSelectedDataStore ? 'capitalize':null,borderRadius:isSelectedDataStore?200:null, width:isSelectedDataStore?81:null, height:isSelectedDataStore?40:null, }}
variant="contained" variant="contained"
color="primary" color="primary"
onClick={() => listOrgCache(orgId)} onClick={() => listOrgCache(orgId)}
@@ -433,26 +396,27 @@ const CacheView = (props) => {
<ListItem style={{width: isSelectedDataStore?"100%":null, borderBottom:isSelectedDataStore?"1px solid #494949":null}}> <ListItem style={{width: isSelectedDataStore?"100%":null, borderBottom:isSelectedDataStore?"1px solid #494949":null}}>
<ListItemText <ListItemText
primary="Key" primary="Key"
style={{ minWidth: 250, maxWidth: 250, }} style={{ minWidth: isSelectedDataStore?200:250, maxWidth: isSelectedDataStore?200:250, }}
/> />
<ListItemText <ListItemText
primary="Value" primary="Value"
style={{ minWidth: 400, maxWidth: 400, overflowX: "auto", overflowY: "hidden", }} style={{ minWidth: isSelectedDataStore?300:400, maxWidth: isSelectedDataStore?300:400, overflowX: "auto", overflowY: "hidden", }}
/> />
<ListItemText <ListItemText
primary="Actions" primary="Actions"
style={{ minWidth: 150, maxWidth: 150, marginLeft: 50, }} style={{ minWidth: 150, maxWidth: 150, marginLeft: isSelectedDataStore?80:null,}}
/> />
<ListItemText <ListItemText
style={{textAlign:isSelectedDataStore?"center":null}}
primary="Updated" primary="Updated"
/> />
</ListItem> </ListItem>
{listCache === undefined || listCache === null {listCache === undefined || listCache === null
? null ? null
: listCache.map((data, index) => { : listCache.map((data, index) => {
var bgColor = "#27292d"; var bgColor = isSelectedDataStore? "#212121":"#27292d";
if (index % 2 === 0) { if (index % 2 === 0) {
bgColor = "#1f2023"; bgColor = isSelectedDataStore? "#1A1A1A":"#1f2023";
} }
const validate = validateJson(data.value); const validate = validateJson(data.value);
@@ -460,16 +424,16 @@ const CacheView = (props) => {
<ListItem key={index} style={{ backgroundColor: bgColor, maxHeight: 300, overflow: "auto", }}> <ListItem key={index} style={{ backgroundColor: bgColor, maxHeight: 300, overflow: "auto", }}>
<ListItemText <ListItemText
style={{ style={{
maxWidth: 250, maxWidth: 200,
minWidth: 250, minWidth: 200,
overflow: "hidden", overflow: "hidden",
}} }}
primary={data.key} primary={data.key}
/> />
<ListItemText <ListItemText
style={{ style={{
minWidth: 400, minWidth: 300,
maxWidth: 400, maxWidth: 300,
}} }}
primary={validate.valid ? primary={validate.valid ?
<ReactJson <ReactJson
+17 -13
View File
@@ -659,7 +659,7 @@ const Files = (props) => {
onClick={() => { onClick={() => {
upload.click(); upload.click();
}} }}
style={{backgroundColor: isSelectedFiles?'rgba(255, 132, 68, 0.2)':null, color:isSelectedFiles?"#FF8444":null, borderRadius:isSelectedFiles?200:null, width:isSelectedFiles?162:null, height:isSelectedFiles?40:null}} style={{backgroundColor: isSelectedFiles?'rgba(255, 132, 68, 0.2)':null, color:isSelectedFiles?"#FF8444":null, borderRadius:isSelectedFiles?200:null, width:isSelectedFiles?162:null, height:isSelectedFiles?40:null, boxShadow: isSelectedFiles?'none':null,}}
> >
<PublishIcon /> Upload files <PublishIcon /> Upload files
</Button> </Button>
@@ -679,7 +679,7 @@ const Files = (props) => {
}} }}
/> />
<Button <Button
style={{ marginLeft: 5, marginRight: 15, backgroundColor:isSelectedFiles?"#2F2F2F":null,borderRadius:isSelectedFiles?200:null, width:isSelectedFiles?81:null, height:isSelectedFiles?40:null, }} style={{ marginLeft: 5, marginRight: 15, backgroundColor:isSelectedFiles?"#2F2F2F":null,borderRadius:isSelectedFiles?200:null, width:isSelectedFiles?81:null, height:isSelectedFiles?40:null, boxShadow: isSelectedFiles?'none':null, }}
variant="contained" variant="contained"
color="primary" color="primary"
onClick={() => getFiles()} onClick={() => getFiles()}
@@ -814,7 +814,7 @@ const Files = (props) => {
/> />
<ListItemText <ListItemText
primary="Md5" primary="Md5"
style={{ minWidth: 250, maxWidth: 250, overflow: "hidden" }} style={{ minWidth: isSelectedFiles?210:250, maxWidth: isSelectedFiles?210:250, overflow: "hidden" }}
/> />
<ListItemText <ListItemText
primary="Status" primary="Status"
@@ -836,9 +836,9 @@ const Files = (props) => {
return null; return null;
} }
var bgColor = "#27292d"; var bgColor = isSelectedFiles ? "#212121":"#27292d";
if (index % 2 === 0) { if (index % 2 === 0) {
bgColor = "#1f2023"; bgColor = isSelectedFiles ? "#1A1A1A":"#1f2023";
} }
const filenamesplit = file.filename.split(".") const filenamesplit = file.filename.split(".")
@@ -855,8 +855,8 @@ const Files = (props) => {
> >
<ListItemText <ListItemText
style={{ style={{
maxWidth: 225, maxWidth: isSelectedFiles ? 170:225,
minWidth: 225, minWidth: isSelectedFiles ? 170:225,
overflow: "hidden", overflow: "hidden",
}} }}
primary={new Date(file.updated_at * 1000).toISOString()} primary={new Date(file.updated_at * 1000).toISOString()}
@@ -922,14 +922,16 @@ const Files = (props) => {
minWidth: 100, minWidth: 100,
maxWidth: 100, maxWidth: 100,
overflow: "hidden", overflow: "hidden",
textAlign: isSelectedFiles?"center":null
}} }}
/> />
<ListItemText <ListItemText
primary={file.md5_sum} primary={file.md5_sum}
style={{ style={{
minWidth: 300, minWidth: isSelectedFiles?200:300,
maxWidth: 300, maxWidth: isSelectedFiles?200:300,
overflow: "hidden", marginLeft:isSelectedFiles? 15:null,
overflow: isSelectedFiles?"auto":"hidden",
}} }}
/> />
<ListItemText <ListItemText
@@ -938,14 +940,16 @@ const Files = (props) => {
minWidth: 75, minWidth: 75,
maxWidth: 75, maxWidth: 75,
overflow: "hidden", overflow: "hidden",
textAlign:isSelectedFiles?"center":null,
marginLeft: 10, marginLeft: 10,
}} }}
/> />
<ListItemText <ListItemText
primary={file.filesize} primary={file.filesize}
style={{ style={{
minWidth: 125, minWidth: isSelectedFiles?80:125,
maxWidth: 125, maxWidth: isSelectedFiles?80:125,
marginLeft: isSelectedFiles?15:null,
overflow: "hidden", overflow: "hidden",
}} }}
/> />
@@ -1064,7 +1068,7 @@ const Files = (props) => {
</Tooltip> </Tooltip>
<Tooltip <Tooltip
title={"Delete file"} title={"Delete file"}
style={{marginLeft: 15, }} style={{marginLeft: isSelectedFiles?5:15, }}
aria-label={"Delete"} aria-label={"Delete"}
> >
<span> <span>
+2 -2
View File
@@ -203,7 +203,7 @@ const Priorities = (props) => {
<Paper <Paper
style={{ style={{
backgroundColor: theme.palette.platformColor, backgroundColor: theme.palette.platformColor,
width: notificationWidth, width: clickedFromOrgTab ? null :notificationWidth,
padding: 30, padding: 30,
borderBottom: "1px solid rgba(255,255,255,0.4)", borderBottom: "1px solid rgba(255,255,255,0.4)",
marginBottom: 20, marginBottom: 20,
@@ -312,7 +312,7 @@ const Priorities = (props) => {
} }
return ( return (
<div style={{maxWidth: clickedFromOrgTab ? 1030:1000, padding: clickedFromOrgTab ? 27:null, height: clickedFromOrgTab ? "auto":null, backgroundColor: clickedFromOrgTab ? '#212121':null, borderRadius: clickedFromOrgTab ? '16px':null, }}> <div style={{width: clickedFromOrgTab ? 1030:1000, padding: clickedFromOrgTab ? 27:null, height: clickedFromOrgTab ? "auto":null, backgroundColor: clickedFromOrgTab ? '#212121':null, borderRadius: clickedFromOrgTab ? '16px':null, }}>
<h2 style={{ display: clickedFromOrgTab ?null:"inline", marginBottom: clickedFromOrgTab ? 8:null, marginTop: clickedFromOrgTab ?0:null, color: clickedFromOrgTab ?"#ffffff":null }}>Suggestions</h2> <h2 style={{ display: clickedFromOrgTab ?null:"inline", marginBottom: clickedFromOrgTab ? 8:null, marginTop: clickedFromOrgTab ?0:null, color: clickedFromOrgTab ?"#ffffff":null }}>Suggestions</h2>
<span style={{ color: clickedFromOrgTab ?"#9E9E9E":null,marginLeft: clickedFromOrgTab ?null:25 }}> <span style={{ color: clickedFromOrgTab ?"#9E9E9E":null,marginLeft: clickedFromOrgTab ?null:25 }}>
Suggestions are tasks identified by Shuffle to help you discover ways to protect your and customers' company. <br/>These range from simple configurations in Shuffle to Usecases you may have missed.&nbsp; Suggestions are tasks identified by Shuffle to help you discover ways to protect your and customers' company. <br/>These range from simple configurations in Shuffle to Usecases you may have missed.&nbsp;
+2 -2
View File
@@ -147,7 +147,7 @@ const Priority = (props) => {
} }
</div> </div>
<div style={{flex: 1, display: "flex", marginLeft: 30, }}> <div style={{flex: 1, display: "flex", marginLeft: 30, }}>
<Button style={{height: 50, borderRadius: 25, marginTop: 8, width: 175, marginRight: 10, color: priority.active === false ? "white" :clickedFromOrgTab ?"#FF8444": "black", backgroundColor: priority.active === false ? theme.palette.inputColor :clickedFromOrgTab?"rgba(255, 132, 68, 0.2)":"rgba(255,255,255,0.8)", }} variant="contained" color="secondary" onClick={() => { <Button style={{height: 50, borderRadius: 25, fontSize:16, boxShadow: clickedFromOrgTab ? "none":null,textTransform: clickedFromOrgTab ? 'capitalize':null, marginTop: 8, width: 175, marginRight: 10, color: priority.active === false ? "white" :clickedFromOrgTab ?"#FF8444": "black", backgroundColor: priority.active === false ? theme.palette.inputColor :clickedFromOrgTab?"rgba(255, 132, 68, 0.2)":"rgba(255,255,255,0.8)", }} variant="contained" color="secondary" onClick={() => {
if (isCloud) { if (isCloud) {
ReactGA.event({ ReactGA.event({
@@ -173,7 +173,7 @@ const Priority = (props) => {
Explore Explore
</Button> </Button>
{priority.active === true ? {priority.active === true ?
<Button style={{borderRadius: 25, width: 100, height: 50, marginTop: 8, }} variant="text" color="secondary" onClick={() => { <Button style={{borderRadius: 25, fontSize:16, boxShadow: clickedFromOrgTab ? "none":null,textTransform: clickedFromOrgTab ? 'capitalize':null, width: 100, height: 50, marginTop: 8, }} variant="text" color="secondary" onClick={() => {
// dismiss -> get envs // dismiss -> get envs
changeRecommendation(priority, "dismiss") changeRecommendation(priority, "dismiss")
}}> }}>
+206 -96
View File
@@ -1,65 +1,120 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect, useMemo } from "react";
import theme from '../theme.jsx'; import theme from "../theme.jsx";
import { isMobile } from "react-device-detect"; import { isMobile } from "react-device-detect";
import AppGrid from "../components/AppGrid.jsx" import AppGrid from "../components/AppGrid.jsx";
import WorkflowGrid from "../components/WorkflowGrid.jsx" import WorkflowGrid from "../components/WorkflowGrid.jsx";
import CreatorGrid from "../components/CreatorGrid.jsx" import CreatorGrid from "../components/CreatorGrid.jsx";
import DocsGrid from "../components/DocsGrid.jsx" import DocsGrid from "../components/DocsGrid.jsx";
import DiscordChat from "../components/DiscordChat.jsx";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import Typography from "@material-ui/core/Typography";
import { import { Tabs, Tab, setRef } from "@mui/material";
Tabs, import { styled } from "@mui/material/styles";
Tab, import { makeStyles } from '@mui/styles';
} from "@mui/material"; import DiscordChat from "../components/DiscordChat.jsx";
import { import {
Apps as AppsIcon, Apps as AppsIcon,
Code as CodeIcon, Code as CodeIcon,
Chat as ChatIcon,
EmojiObjects as EmojiObjectsIcon, EmojiObjects as EmojiObjectsIcon,
Description as DescriptionIcon, Chat as ChatIcon,
BorderBottom,
} from "@mui/icons-material"; } from "@mui/icons-material";
import PeopleAltOutlinedIcon from '@mui/icons-material/PeopleAltOutlined';
import DescriptionOutlinedIcon from '@mui/icons-material/DescriptionOutlined';
// Should be different if logged in :| // Should be different if logged in :|
const Search = (props) => { const Search = (props) => {
const { globalUrl, isLoaded, serverside, userdata, hidemargins, isHeader } = props; const { globalUrl, isLoaded, serverside, userdata, hidemargins, isHeader } =
props;
let navigate = useNavigate(); let navigate = useNavigate();
const [curTab, setCurTab] = useState(0); const [curTab, setCurTab] = useState(0);
const iconStyle = { marginRight: isHeader ? null : 10 }; const iconStyle = { marginRight: isHeader ? null : 10 };
useEffect(() => { useEffect(() => {
if (serverside !== true && window.location.search !== undefined && window.location.search !== null) { if (
const urlSearchParams = new URLSearchParams(window.location.search) serverside !== true &&
const params = Object.fromEntries(urlSearchParams.entries()) window.location.search !== undefined &&
const foundTab = params["tab"] window.location.search !== null
) {
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
const foundTab = params["tab"];
if (foundTab !== null && foundTab !== undefined) { if (foundTab !== null && foundTab !== undefined) {
for (var key in Object.keys(views)) { for (var key in Object.keys(views)) {
const value = views[key] const value = views[key];
console.log(key, value) console.log(key, value);
if (value === foundTab) { if (value === foundTab) {
setConfig("", key) setConfig("", key);
break break;
} }
} }
} }
} }
}, []) }, []);
//Stop unnecessariry re-rendering of the component to improve performace
const MemoizedAppGrid = useMemo(() => <AppGrid
maxRows={4}
isHeader={true}
showSuggestion={true}
globalUrl={globalUrl}
isMobile={isMobile}
userdata={userdata}
/>, [curTab]);
const MemoizedWorkflowGrid = useMemo(() => <WorkflowGrid
maxRows={3}
showSuggestion={true}
globalUrl={globalUrl}
isMobile={isMobile}
userdata={userdata}
/>, [curTab]);
const MemoizedDocsGrid = useMemo(() => <DocsGrid
maxRows={6}
parsedXs={12}
showSuggestion={true}
globalUrl={globalUrl}
isMobile={isMobile}
userdata={userdata}
/>, [curTab]);
const MemoizedCreatorGrid = useMemo(() => <CreatorGrid
parsedXs={4}
isHeader={true}
showSuggestion={true}
globalUrl={globalUrl}
isMobile={isMobile}
userdata={userdata}
/>, [curTab]);
const MemoizedDiscordChat = useMemo(() => <DiscordChat isMobile={isMobile} />)
const useStyles = makeStyles({
hideIndicator: {
display: 'none',
},
customTab: {
justifyContent: 'center',
gap: '46px',
}
});
const classes = useStyles();
if (serverside === true) { if (serverside === true) {
return null return null;
} }
const bodyDivStyle = { const bodyDivStyle = {
margin: "auto", margin: "auto",
maxWidth: 1024, maxWidth: "100%",
scrollX: "hidden", scrollX: "hidden",
overflowX: "hidden", overflowX: "hidden",
justifyContent: isHeader ? "center" : null, justifyContent: isHeader ? "center" : null,
} };
const boxStyle = { const boxStyle = {
color: "white", color: "white",
@@ -73,21 +128,20 @@ const Search = (props) => {
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
overflowX: "hidden", overflowX: "hidden",
width: "100%",
minHeight: 400, minHeight: 400,
} };
const views = { const views = {
0: "apps", 0: "apps",
1: "workflows", 1: "workflows",
2: "docs", 2: "docs",
3: "creators", 3: "creators",
4: "discord", };
}
const setConfig = (event, inputValue) => { const setConfig = (event, inputValue) => {
const newValue = parseInt(inputValue) const newValue = parseInt(inputValue);
setCurTab(newValue) setCurTab(newValue);
if (newValue === 0) { if (newValue === 0) {
document.title = "Shuffle - search - apps"; document.title = "Shuffle - search - apps";
} else if (newValue === 1) { } else if (newValue === 1) {
@@ -96,38 +150,77 @@ const Search = (props) => {
document.title = "Shuffle - search - documentation"; document.title = "Shuffle - search - documentation";
} else if (newValue === 3) { } else if (newValue === 3) {
document.title = "Shuffle - search - creators"; document.title = "Shuffle - search - creators";
} else if (newValue === 4) { } else {
document.title = "Shuffle - search - Discord Chat";
}else {
document.title = "Shuffle - search"; document.title = "Shuffle - search";
} }
const urlSearchParams = new URLSearchParams(window.location.search);
const urlSearchParams = new URLSearchParams(window.location.search) const params = Object.fromEntries(urlSearchParams.entries());
const params = Object.fromEntries(urlSearchParams.entries()) const foundQuery = params["q"];
const foundQuery = params["q"] var extraQ = "";
var extraQ = ""
if (foundQuery !== null && foundQuery !== undefined) { if (foundQuery !== null && foundQuery !== undefined) {
extraQ = "&q=" + foundQuery extraQ = "&q=" + foundQuery;
} }
if (
if ((serverside === false || serverside === undefined) && window.location.pathname.includes("/search")) { (serverside === false || serverside === undefined) &&
navigate(`/search?tab=${views[newValue]}` + extraQ) window.location.pathname.includes("/search")
} ) {
navigate(`/search?tab=${views[newValue]}` + extraQ);
} }
};
if (isLoaded === false) { if (isLoaded === false) {
return null return null;
}
const StyledTab = styled(Tab)(({ theme }) => ({
width: 151,
height: 51,
padding: "10px 20px",
borderRadius: 8,
fontWeight: 600,
textTransform: "none",
border: 'none',
"&.Mui-selected": {
backgroundColor: theme.palette.primary.main,
color: theme.palette.common.white,
"& .MuiSvgIcon-root": {
color: theme.palette.common.white,
},
},
}));
const tabSpanStyling = {
display: 'flex',
flexDirection: 'row',
alignItems: 'center'
}
const tabTextStyling = {
marginLeft: '5px',
color: 'white'
} }
// Random names for type & autoComplete. Didn't research :^) // Random names for type & autoComplete. Didn't research :^)
const landingpageDataBrowser = const landingpageDataBrowser = (
<div style={{ paddingBottom: hidemargins === true ? 0 : 100, color: "white", }}> <div
style={{
paddingBottom: hidemargins === true ? 0 : 100,
color: "white",
width: "100%",
}}
>
<div style={boxStyle}> <div style={boxStyle}>
<Tabs <Tabs
style={{ width: isHeader ? 765 : 610, margin: isHeader ? null : "auto", marginTop: hidemargins === true ? 0 : isHeader ? null : 25, }} style={{
width: 741,
margin: isHeader ? null : "auto",
marginTop: hidemargins === true ? 0 : isHeader ? null : 25,
backgroundColor: "rgba(33, 33, 33, 1)",
borderRadius:8
}}
value={curTab} value={curTab}
indicatorColor="primary" indicatorColor="primary"
textColor="secondary" textColor="secondary"
@@ -135,72 +228,89 @@ const Search = (props) => {
aria-label="disabled tabs example" aria-label="disabled tabs example"
variant="scrollable" variant="scrollable"
scrollButtons="auto" scrollButtons="auto"
classes={{indicator: classes.hideIndicator, root: classes.customTab}}
> >
<Tab <StyledTab
label=<span> style={{
<AppsIcon style={iconStyle} /> Apps backgroundColor: curTab === 0 ? theme.palette.primary.main : 'inherit',
color: curTab === 0? theme.palette.common.white : 'inherit',
}}
label={
<span style={tabSpanStyling}>
<AppsIcon style={iconStyle} />
<Typography variant="body1" style={tabTextStyling}>App</Typography>
</span> </span>
}
/> />
<Tab <StyledTab
label=<span> style={{
<CodeIcon style={iconStyle} /> Workflows backgroundColor: curTab ===1 ? theme.palette.primary.main : 'inherit',
color: curTab === 1? theme.palette.common.white : 'inherit',
}}
label={
<span style={tabSpanStyling}>
<CodeIcon style={iconStyle} />
<Typography variant="body1" style={tabTextStyling}>Workflow</Typography>
</span> </span>
}
/> />
<Tab <StyledTab
label=<span> style={{
<DescriptionIcon style={iconStyle} /> Docs backgroundColor: curTab === 2 ? theme.palette.primary.main : 'inherit',
color: curTab === 2? theme.palette.common.white : 'inherit',
}}
label={
<span style={tabSpanStyling}>
<DescriptionOutlinedIcon style={iconStyle} />
<Typography variant="body1" style={tabTextStyling}>Docs</Typography>
</span> </span>
}
/> />
<Tab <StyledTab
label=<span> style={{
<EmojiObjectsIcon style={iconStyle} /> Creators backgroundColor: curTab === 3 ? theme.palette.primary.main : 'inherit',
color: curTab === 3 ? theme.palette.common.white : 'inherit'
}}
label={
<span style={tabSpanStyling}>
<PeopleAltOutlinedIcon style={iconStyle} />
<Typography variant="body1" style={tabTextStyling}>Creators</Typography>
</span> </span>
}
/> />
<Tab <StyledTab
label=<span> style={{
<ChatIcon style={iconStyle} /> Discord Chat backgroundColor: curTab === 4 ? theme.palette.primary.main : 'inherit',
color: curTab === 4 ? theme.palette.common.white : 'inherit'
}}
label={
<span style={tabSpanStyling}>
<ChatIcon style={iconStyle} />
<Typography variant="body1" style={{tabTextStyling, whiteSpace: "nowrap", color: "white"}}>Discord Chat</Typography>
</span> </span>
}
/> />
</Tabs> </Tabs>
{curTab === 0 ? {curTab === 0 && MemoizedAppGrid}
<AppGrid maxRows={3} isHeader={true} showSuggestion={true} globalUrl={globalUrl} isMobile={isMobile} userdata={userdata} /> {curTab === 1 && MemoizedWorkflowGrid}
: {curTab === 2 && MemoizedDocsGrid}
curTab === 1 ? {curTab === 3 && MemoizedCreatorGrid}
window.location.pathname === "/search" ? {curTab === 4 && MemoizedDiscordChat}
<WorkflowGrid maxRows={3} showSuggestion={true} globalUrl={globalUrl} isMobile={isMobile} userdata={userdata} />
:
<WorkflowGrid maxRows={3} showSuggestion={true} globalUrl={globalUrl} isMobile={isMobile} userdata={userdata} />
:
curTab === 2 ?
<DocsGrid maxRows={6} parsedXs={12} showSuggestion={true} globalUrl={globalUrl} isMobile={isMobile} userdata={userdata} />
:
curTab === 3 ?
<CreatorGrid parsedXs={4} isHeader={true} showSuggestion={true} globalUrl={globalUrl} isMobile={isMobile} userdata={userdata} />
:
curTab === 4 ?
<DiscordChat isMobile={isMobile} />
:
null}
</div> </div>
</div> </div>
);
//{/*alternativeView={true} />*/} //{/*alternativeView={true} />*/}
const loadedCheck = isLoaded ? const loadedCheck = isLoaded ? (
<div> <div>
<div style={bodyDivStyle}>{landingpageDataBrowser}</div> <div style={bodyDivStyle}>{landingpageDataBrowser}</div>
</div> </div>
: ) : (
<div> <div></div>
</div> );
// #1f2023? // #1f2023?
return ( return <div style={{}}>{loadedCheck}</div>;
<div style={{}}> };
{loadedCheck}
</div>
)
}
export default Search; export default Search;