Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Added image details in template selector
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluard committed Jun 18, 2020
1 parent b337ccf commit daded82
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
32 changes: 29 additions & 3 deletions frontend/src/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Divider from '@material-ui/core/Divider';
import FeedbackIcon from '@material-ui/icons/Feedback';
import HelpIcon from '@material-ui/icons/Help';
import IconButton from '@material-ui/core/IconButton';
import Link from '@material-ui/core/Link';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
Expand All @@ -28,6 +29,7 @@ import TableRow from '@material-ui/core/TableRow';
import Toolbar from '@material-ui/core/Toolbar';
import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
import marked from 'marked';
import { useLocation, useParams } from "react-router-dom";
import Zoom from '@material-ui/core/Zoom';
Expand Down Expand Up @@ -409,9 +411,20 @@ function Nav({ toggleDetails }) {
);
}

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
'& > * + *': {
marginLeft: theme.spacing(2),
},
},
}),
);

function TemplateSelector({templates, onSelect, onRetryClick, state}) {
const [selection, select] = useState(templates[0]);
const templatesAvailable = templates?.length > 0;
const classes = useStyles();
return (
<React.Fragment>
<Typography variant="h5" style={{padding: 20}}>Select a template</Typography>
Expand All @@ -428,9 +441,22 @@ function TemplateSelector({templates, onSelect, onRetryClick, state}) {
</List>
<Divider flexItem={true} orientation={"vertical"} light={true} />
{selection &&
<Typography component="div" style={{width: "100%", marginLeft: 20, overflow: "auto", textAlign: "left"}}>
<div dangerouslySetInnerHTML={{__html:marked(selection.description)}}></div>
</Typography>}
<div style={{flex: 1, marginLeft: 20, paddingRight: 20, overflow: "auto", textAlign: "left"}}>
<Typography>
<span dangerouslySetInnerHTML={{__html:marked(selection.description)}}></span>
</Typography>
<Divider orientation={"horizontal"} light={true} />
<Typography className={classes.root} variant="overline">
Built using the following
<Link
href={`https://${selection.image}`}
rel="noreferrer"
variant="inherit"
style={{margin: 5}}>
image
</Link>
</Typography>
</div>}
</div>
: <ErrorMessage reason={"Can't find any template. Is the templates configuration incorrect."} onClick={onRetryClick} />
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dsfds dsfdsf dsf dsf dsf dsf dsf dsf dsfdsf dsf ds fds fdsf ds fds fds
## erez`;
const runtime = {env: [{name: "SOME_ENV", value: "1234"}], ports: [{name: "web", protocol: "TCP", path: "/", port: 123, target: 123}]};
const build = {base: "", extensions: [{name: "", value: ""}], repositories: [{name: "", value: ""}], commands: [{name: "", run: "", working_directory: ""}]};
const template = {image: "gcr.io/substrateplayground-252112/jeluard/substrate-playground-template-base@sha256:0b3ec9ad567d0f5b0eed8a0fc2b1fa3fe1cca24cc02416047d71f83770b05e34", name: "workshop", description: description, runtime: runtime, build: build}
const template = {image: "gcr.io/substrateplayground-252112/jeluard/substrate-playground-template-base@sha256:0b3ec9ad567d0f5b0eed8a0fc2b1fa3fe1cca24cc02416047d71f83770b05e34", name: "Node Template", description: description, runtime: runtime, build: build}
const url = "http://www.google.fr";
const pod = {version: "1.23", details: {status: {phase: "Running", startTime: "2020-05-15T14:06:18Z"}}};
const uuid = "1234";
Expand Down

0 comments on commit daded82

Please sign in to comment.