Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22,932 changes: 22,907 additions & 25 deletions package-lock.json

Large diffs are not rendered by default.

53 changes: 29 additions & 24 deletions src/pages/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,31 @@ import {
Button,
} from "@material-ui/core";
import useStyles from "@styles";
import axios from 'axios'
import AppContext from '@context'
import {Link} from 'react-router-dom'
import {login} from "lbd-server"
import axios from "axios";
import AppContext from "@context";
import { Link } from "react-router-dom";
import { login } from "lbd-server";

function Login(props) {
const classes = useStyles()
const {context, setContext} = useContext(AppContext)
const [password, setPassword] = useState("test123");
const [email, setEmail] = useState("jeroen.werbrouck@hotmail.com");
const classes = useStyles();
const { context, setContext } = useContext(AppContext);
const [password, setPassword] = useState("rubinho4");
const [email, setEmail] = useState("ruben.ballegeer@gmail.com");
const [loginError, setLoginError] = useState();
const [loading, setLoading] = useState(false);

async function submitLogin(e) {
e.preventDefault()
try {
e.preventDefault();
try {
setLoading(true);
const details = await login(email, password);
setLoading(false);

setLoading(true);
const details = await login(email, password)
setLoading(false);

setContext({...context, user: details})

} catch (error) {
setLoading(false);
setLoginError("Could not log in with these credentials")
}
setContext({ ...context, user: details });
} catch (error) {
setLoading(false);
setLoginError("Could not log in with these credentials");
}
}

return (
Expand All @@ -44,7 +42,7 @@ function Login(props) {
<Typography variant="h2" className={classes.pageTitle}>
Log in
</Typography>
<form onSubmit={e => submitLogin(e)}>
<form onSubmit={(e) => submitLogin(e)}>
<TextField
id="email"
name="email"
Expand All @@ -54,7 +52,10 @@ function Login(props) {
error={loginError ? true : false}
className={classes.textField}
value={email}
onChange={(e) => {setEmail(e.target.value); setLoginError(null)}}
onChange={(e) => {
setEmail(e.target.value);
setLoginError(null);
}}
fullWidth
/>
<TextField
Expand All @@ -66,7 +67,10 @@ function Login(props) {
error={loginError ? true : false}
className={classes.textField}
value={password}
onChange={(e) => {setPassword(e.target.value); setLoginError(null)}}
onChange={(e) => {
setPassword(e.target.value);
setLoginError(null);
}}
fullWidth
/>
<Button
Expand All @@ -83,7 +87,8 @@ function Login(props) {
</Button>
<br />
<p styles={{ padding: "20px" }}>
Don't have an account yet? Create one <Link to="/register">here</Link>.
Don't have an account yet? Create one{" "}
<Link to="/register">here</Link>.
</p>
</form>
</Grid>
Expand Down
19 changes: 10 additions & 9 deletions src/pages/Project.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Link, Redirect } from "react-router-dom";
import Viewer from "@components/GeometryComponent/LBDviewer";
import url from "url";
import Plugins from "../plugins";
import {drawerWidth} from '@styles'
import { drawerWidth } from "@styles";

function Project(props) {
const { context, setContext } = useContext(AppContext);
Expand All @@ -24,7 +24,9 @@ function Project(props) {
function checkGLTFselection() {
const gltfChecked = [];
context.currentProject.activeDocuments.forEach((doc) => {
if (context.currentProject.documents[doc].metadata["rdfs:label"] === "gltf") {
if (
context.currentProject.documents[doc].metadata["rdfs:label"] === "gltf"
) {
const fullUrl = url.parse(doc);
const realDocUrl = doc.replace(
`${fullUrl.protocol}//${fullUrl.host}`,
Expand All @@ -45,27 +47,26 @@ function Project(props) {
<div>
{context.currentProject ? (
<Grid container className={classes.form}>
<Grid xs={3} item>
<Plugins/>
<Grid xs={3} item>
<Plugins />
</Grid>
<Grid xs={(context.plugin ? 12 : 12)} item>
<Grid xs={context.plugin ? 12 : 12} item>
{context.currentProject.activeDocuments.length > 0 &&
checkGLTFselection().length > 0 ? (
<div>
<Viewer
height="96%"
width={(context.plugin ? "100%" : "100%")}
width={context.plugin ? "100%" : "100%"}
// width={(context.plugin ? `${100 - parseInt(drawerWidth.substring(0, drawerWidth.length - 1)+80)}%` : "100%")}
models={checkGLTFselection()}
projection={props.projection || "perspective"}
onSelect={onSelect}
selection={context.selection}
/>
</div>

) : (
<div style={{ margin: "200px", textAlign: "center" }}>
<h2>Please select a glTF file in the DOCUMENTS tab</h2>
<div style={{ margin: "200px", textAlign: "right" }}>
<h2> Please select a glTF file in the DOCUMENTS tab</h2>
</div>
)}
</Grid>
Expand Down
Loading