@@ -191,9 +212,16 @@ export default function Navigation() {
{['Resources'].map((text, index) => (
+
+
+
+
+
+
+
))}
diff --git a/frontend/src/components/resourcechart/resourcechart.js b/frontend/src/components/resourcechart/resourcechart.js
index 3b74533..1029368 100644
--- a/frontend/src/components/resourcechart/resourcechart.js
+++ b/frontend/src/components/resourcechart/resourcechart.js
@@ -5,9 +5,54 @@ import {
import {
useParams
} from "react-router-dom";
+import CircularProgress from '@material-ui/core/CircularProgress';
+import Card from '@material-ui/core/Card';
+import CardContent from '@material-ui/core/CardContent';
+import Typography from '@material-ui/core/Typography';
+import { makeStyles } from '@material-ui/core/styles';
+import Grid from '@material-ui/core/Grid';
+
+const useStyles = makeStyles((theme) => ({
+ root: {
+ display: 'flex',
+ },
+}));
+
+const output = (data) => {
+ if (data === null) {
+ return (
+
+ )
+ } else {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+ }
+}
export default function ResourceChart(props) {
-
+ const classes = useStyles();
const [data, setData] = React.useState(null);
let { id } = useParams();
const loadData = async () => {
@@ -60,28 +105,25 @@ export default function ResourceChart(props) {
loadData();
}
+
+
return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Resource Chart
+
+
+
+
+
+ {output(data)}
+
+
+
+
+
+
);
}
diff --git a/frontend/src/components/selectResource/index.js b/frontend/src/components/selectResource/index.js
index 269876a..9027869 100644
--- a/frontend/src/components/selectResource/index.js
+++ b/frontend/src/components/selectResource/index.js
@@ -1,13 +1,7 @@
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
-import Card from '@material-ui/core/Card';
-import CardContent from '@material-ui/core/CardContent';
-import Typography from '@material-ui/core/Typography';
import Grid from '@material-ui/core/Grid';
-import { Link } from 'react-router-dom';
-import Link1 from '@material-ui/core/Link';
-import ListItem from '@material-ui/core/ListItem';
-import ListItemText from '@material-ui/core/ListItemText';
+import ResourceCard from './resourceCard';
const useStyles = makeStyles(theme => ({
@@ -16,23 +10,7 @@ const useStyles = makeStyles(theme => ({
}
}));
-function CreateResourceCard(resource, classes) {
- function ListItemLink(props) {
- return
;
- }
- return (
-
-
-
-
-
-
-
-
-
- )
-}
export default function SelectResource() {
const classes = useStyles();
@@ -43,7 +21,7 @@ export default function SelectResource() {
resourceJSON = await resourceJSON.json();
let rArr = [];
for (let i = 0; i < resourceJSON.length; i++) {
- rArr.push(CreateResourceCard(resourceJSON[i], classes));
+ rArr.push(
);
}
setResources(rArr);
}
diff --git a/frontend/src/components/selectResource/resourceCard.js b/frontend/src/components/selectResource/resourceCard.js
new file mode 100644
index 0000000..683f04c
--- /dev/null
+++ b/frontend/src/components/selectResource/resourceCard.js
@@ -0,0 +1,57 @@
+import React from 'react';
+import { makeStyles } from '@material-ui/core/styles';
+import Card from '@material-ui/core/Card';
+import CardContent from '@material-ui/core/CardContent';
+import Typography from '@material-ui/core/Typography';
+import Grid from '@material-ui/core/Grid';
+import { Link } from 'react-router-dom';
+import Link1 from '@material-ui/core/Link';
+import ListItem from '@material-ui/core/ListItem';
+import ListItemText from '@material-ui/core/ListItemText';
+import CardMedia from '@material-ui/core/CardMedia';
+
+
+const useStyles = makeStyles(theme => ({
+ picture: {
+
+ }
+}));
+function ListItemLink(props) {
+ return
;
+}
+
+export default function ResourceCard(props) {
+ const classes = useStyles();
+ const [picture, setPicture] = React.useState(null);
+
+ var picUrl = "https://d1fxy698ilbz6u.cloudfront.net/static/" + props.resource["image"]
+
+
+ const loadResourcePicture = async () => {
+ await fetch(picUrl).then(res => { return res.blob() }).then(blob => {
+ var img = URL.createObjectURL(blob);
+ setPicture(img);
+
+ })
+
+
+ }
+
+ if (picture === null)
+ loadResourcePicture();
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}