Fixed docs and app creator views

This commit is contained in:
frikky
2020-05-23 08:35:12 +02:00
parent 190d13080c
commit 3c42f35dae
3 changed files with 31 additions and 30 deletions
+12 -15
View File
@@ -35,6 +35,7 @@ const actionListStyle = {
marginTop: "5px", marginTop: "5px",
backgroundColor: inputColor, backgroundColor: inputColor,
display: "flex", display: "flex",
color: "white",
} }
const boxStyle = { const boxStyle = {
@@ -1013,7 +1014,7 @@ const AppCreator = (props) => {
</Dialog> </Dialog>
const actionView = const actionView =
<div> <div style={{color: "white"}}>
<h2>Actions</h2> <h2>Actions</h2>
Actions are the tasks performed by an app. Read more about actions and apps Actions are the tasks performed by an app. Read more about actions and apps
<a href="/docs/apps#actions" style={{textDecoration: "none", color: "#f85a3e"}}> here</a>. <a href="/docs/apps#actions" style={{textDecoration: "none", color: "#f85a3e"}}> here</a>.
@@ -1038,7 +1039,7 @@ const AppCreator = (props) => {
</div> </div>
const testView = const testView =
<div> <div style={{color: "white"}}>
<h2>Test</h2> <h2>Test</h2>
Test an action to see whether it performs in an expected way. Test an action to see whether it performs in an expected way.
<a href="/docs/apps#testing" style={{textDecoration: "none", color: "#f85a3e"}}>&nbsp;Click here to learn more about testing</a>. <a href="/docs/apps#testing" style={{textDecoration: "none", color: "#f85a3e"}}>&nbsp;Click here to learn more about testing</a>.
@@ -1087,18 +1088,18 @@ const AppCreator = (props) => {
// Random names for type & autoComplete. Didn't research :^) // Random names for type & autoComplete. Didn't research :^)
const landingpageDataBrowser = const landingpageDataBrowser =
<div style={{paddingBottom: "100px"}}> <div style={{paddingBottom: 100, color: "white",}}>
<Paper style={boxStyle}> <Paper style={boxStyle}>
<h2 style={{marginBottom: "10px"}}>General information</h2> <h2 style={{marginBottom: "10px", color: "white"}}>General information</h2>
<a href="/docs/apps#create" style={{textDecoration: "none", color: "#f85a3e"}}>Click here to learn more about app creation</a> <a href="/docs/apps#create" style={{textDecoration: "none", color: "#f85a3e"}}>Click here to learn more about app creation</a>
<div style={{flex: "1", display: "flex", flexDirection: "row"}}> <div style={{color: "white", flex: "1", display: "flex", flexDirection: "row"}}>
<Tooltip title="Click to edit the app's image" placement="bottom"> <Tooltip title="Click to edit the app's image" placement="bottom">
<div style={{flex: "1", margin: 10, border: "1px solid #f85a3e", cursor: "pointer", backgroundColor: inputColor, maxWidth: 174, maxHeight: 174}} onClick={() => {upload.click()}}> <div style={{flex: "1", margin: 10, border: "1px solid #f85a3e", cursor: "pointer", backgroundColor: inputColor, maxWidth: 174, maxHeight: 174}} onClick={() => {upload.click()}}>
<input hidden type="file" ref={(ref) => upload = ref} onChange={editHeaderImage} /> <input hidden type="file" ref={(ref) => upload = ref} onChange={editHeaderImage} />
{imageInfo} {imageInfo}
</div> </div>
</Tooltip> </Tooltip>
<div style={{flex: "3"}}> <div style={{flex: "3", color: "white",}}>
<div style={{marginTop: "10px"}}/> <div style={{marginTop: "10px"}}/>
Name Name
<TextField <TextField
@@ -1149,8 +1150,8 @@ const AppCreator = (props) => {
</div> </div>
</div> </div>
<Divider style={{marginBottom: "10px", marginTop: "30px", height: "1px", width: "100%", backgroundColor: "grey"}}/> <Divider style={{marginBottom: "10px", marginTop: "30px", height: "1px", width: "100%", backgroundColor: "grey"}}/>
<h3 style={{marginBottom: "10px"}}>API information</h3> <h3 style={{marginBottom: "10px", color: "white",}}>API information</h3>
Base URL - leave empty if user changeable <span style={{color: "white"}}>Base URL - leave empty if user changeable</span>
<TextField <TextField
color="primary" color="primary"
style={{backgroundColor: inputColor, marginTop: "5px"}} style={{backgroundColor: inputColor, marginTop: "5px"}}
@@ -1176,7 +1177,7 @@ const AppCreator = (props) => {
onChange={e => setBaseUrl(e.target.value)} onChange={e => setBaseUrl(e.target.value)}
/> />
<FormControl style={{marginTop: "15px",}} variant="outlined"> <FormControl style={{marginTop: "15px",}} variant="outlined">
<h5 style={{marginBottom: "10px"}}>Authentication</h5> <h5 style={{marginBottom: "10px", color: "white",}}>Authentication</h5>
<Select <Select
fullWidth fullWidth
onChange={(e) => { onChange={(e) => {
@@ -1213,12 +1214,8 @@ const AppCreator = (props) => {
const loadedCheck = isLoaded && isAppLoaded && !firstrequest ? const loadedCheck = isLoaded && isAppLoaded && !firstrequest ?
<div> <div>
<BrowserView> <div style={bodyDivStyle}>{landingpageDataBrowser}</div>
<div style={bodyDivStyle}>{landingpageDataBrowser}</div> {newActionModal}
{newActionModal}
</BrowserView>
<MobileView>
</MobileView>
</div> </div>
: :
<div> <div>
+7 -5
View File
@@ -79,6 +79,7 @@ const Apps = (props) => {
color: "#ffffff", color: "#ffffff",
width: "100%", width: "100%",
display: "flex", display: "flex",
margin: 20,
} }
const paperAppStyle = { const paperAppStyle = {
@@ -248,9 +249,11 @@ const Apps = (props) => {
</Grid> </Grid>
</Grid> </Grid>
<Grid container style={{margin: "10px 10px 10px 10px", flex: "1"}} onClick={() => {downloadApp(data)}}> <Grid container style={{margin: "10px 10px 10px 10px", flex: "1"}} onClick={() => {downloadApp(data)}}>
{/*
<Tooltip title={"Download"} style={{marginTop: "28px", width: "100%"}} aria-label={data.name}> <Tooltip title={"Download"} style={{marginTop: "28px", width: "100%"}} aria-label={data.name}>
<CloudDownload /> <CloudDownload />
</Tooltip> </Tooltip>
*/}
</Grid> </Grid>
</Paper> </Paper>
) )
@@ -321,7 +324,6 @@ const Apps = (props) => {
<div style={{marginTop: 15, marginBottom: 15}}> <div style={{marginTop: 15, marginBottom: 15}}>
<b>Actions</b> <b>Actions</b>
{selectedAction.label}
<Select <Select
fullWidth fullWidth
value={selectedAction} value={selectedAction}
@@ -438,15 +440,15 @@ const Apps = (props) => {
} }
const appView = isLoggedIn ? const appView = isLoggedIn ?
<div style={{width: 1366, margin: "auto"}}> <div style={{maxWidth: 1366, margin: "auto",}}>
<div style={appViewStyle}> <div style={appViewStyle}>
<div style={{flex: "1", marginLeft: "10px", marginRight: "10px"}}> <div style={{flex: "1", marginLeft: 10, marginRight: 10}}>
<h2>Upload</h2> <h2>Upload</h2>
<div style={{marginTop: 20}}/> <div style={{marginTop: 20}}/>
<UploadView /> <UploadView />
</div> </div>
<Divider style={{marginBottom: "10px", marginTop: "10px", height: "100%", width: "1px", backgroundColor: dividerColor}}/> <Divider style={{marginBottom: "10px", marginTop: "10px", height: "100%", width: "1px", backgroundColor: dividerColor}}/>
<div style={{flex: 1, marginLeft: "10px", marginRight: "10px"}}> <div style={{flex: 1, marginLeft: 10, marginRight: 10}}>
<div style={{display: "flex"}}> <div style={{display: "flex"}}>
<div style={{flex: 10}}> <div style={{flex: 10}}>
<h2>Available integrations</h2> <h2>Available integrations</h2>
@@ -499,7 +501,7 @@ const Apps = (props) => {
<div style={{marginTop: 15}}> <div style={{marginTop: 15}}>
{apps.length > 0 ? {apps.length > 0 ?
filteredApps.length > 0 ? filteredApps.length > 0 ?
<div style={{maxHeight: "80vh", overflowY: "scroll"}}> <div style={{maxHeight: "78vh", overflowY: "scroll"}}>
{filteredApps.map(app => { {filteredApps.map(app => {
return ( return (
appPaper(app) appPaper(app)
+12 -10
View File
@@ -10,9 +10,9 @@ import MenuItem from '@material-ui/core/MenuItem';
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
const Body = { const Body = {
maxWidth: '1000px', maxWidth: '1000px',
minWidth: '768px', minWidth: '768px',
margin: 'auto', margin: 'auto',
display: "flex", display: "flex",
heigth: "100%", heigth: "100%",
color: "white", color: "white",
@@ -52,7 +52,7 @@ const Docs = (props) => {
if (firstrequest) { if (firstrequest) {
setFirstrequest(false) setFirstrequest(false)
fetchDocList() fetchDocList()
fetchDocs() fetchDocs(props.match.params.key)
return return
} }
@@ -142,8 +142,8 @@ const Docs = (props) => {
.catch(error => {}); .catch(error => {});
} }
const fetchDocs = () => { const fetchDocs = (docId) => {
fetch(globalUrl+"/api/v1/docs/"+props.match.params.key, { fetch(globalUrl+"/api/v1/docs/"+docId, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@@ -164,6 +164,8 @@ const Docs = (props) => {
const markdownStyle = { const markdownStyle = {
color: "rgba(255, 255, 255, 0.65)", color: "rgba(255, 255, 255, 0.65)",
flex: "1", flex: "1",
maxWidth: 750,
overflow: "hidden",
} }
function OuterLink(props) { function OuterLink(props) {
@@ -196,12 +198,12 @@ const Docs = (props) => {
</li> </li>
{list.map(item => { {list.map(item => {
const path = "/docs/"+item const path = "/docs/"+item
const newname = item.charAt(0).toUpperCase()+item.substring(1) const newname = item.charAt(0).toUpperCase()+item.substring(1).split("_").join(" ")
return ( return (
<li style={{marginTop: "10px"}}> <li style={{marginTop: "10px"}}>
<a style={hrefStyle} href={path}> <Link style={hrefStyle} to={path} onClick={() => {fetchDocs(item)}}>
<h2>{newname}</h2> <h2>{newname}</h2>
</a> </Link>
</li> </li>
) )
})} })}
@@ -241,7 +243,7 @@ const Docs = (props) => {
> >
{list.map(item => { {list.map(item => {
const path = "/docs/"+item const path = "/docs/"+item
const newname = item.charAt(0).toUpperCase()+item.substring(1) const newname = item.charAt(0).toUpperCase()+item.substring(1).split("_").join(" ")
return ( return (
<MenuItem onClick={() => {window.location.pathname = path}}>{newname}</MenuItem> <MenuItem onClick={() => {window.location.pathname = path}}>{newname}</MenuItem>
) )