Skip to content

Commit

Permalink
Merge pull request #191 from Fmazin/f_dev
Browse files Browse the repository at this point in the history
Adding new pages titles #181, preview for candidate ERC #151 and disable synchronized scrolling #183
  • Loading branch information
njakuschona committed Mar 11, 2021
2 parents ebb12d3 + 6785e13 commit 54986c8
Show file tree
Hide file tree
Showing 22 changed files with 237 additions and 110 deletions.
29 changes: 14 additions & 15 deletions ui/src/components/app/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { Component } from 'react'
import {Button, AppBar, Toolbar, Typography, ThemeProvider } from '@material-ui/core';
import {Button, AppBar, Toolbar, Typography, MuiThemeProvider } from '@material-ui/core';
import { Route, NavLink, HashRouter } from "react-router-dom";

import theme from '../../helpers/theme';
import o2rTheme from '../../helpers/theme';
import './App.css';
import logo from '../../assets/img/o2r-logo-only-white.svg';
import orcidLogo from '../../assets/img/orcid.png';
Expand All @@ -18,7 +18,7 @@ import Discovery from '../discovery/Discovery';
import ERC from '../erc/ERC';

const Header = ( props ) => {
return (
return (
<AppBar id="header">
<Toolbar>
<a href="/"><img src={logo} alt="o2r" id="headerLogo"/></a>
Expand All @@ -35,22 +35,22 @@ const Header = ( props ) => {
</Button>
</NavLink>*/}
<NavLink id="link" to={"/author/" + props.userOrcid}>
{props.loggedIn ?
{props.loggedIn ?
<Button color="inherit">
{props.userName} |
{props.userName} |
<img src={orcidLogo} className="orcidImage" alt="orcid"></img>
{props.userOrcid}
</Button> : ''}
</NavLink>
</HashRouter>
<Button color="inherit"
href={props.loggedIn ? "api/v1/auth/logout" : "api/v1/auth/login"}
href={props.loggedIn ? "api/v1/auth/logout" : "api/v1/auth/login"}
onClick={() => props.login()}>{props.loggedIn ? 'Logout' : 'Login'}
</Button>
{/*<Button color="inherit">
Help
</Button>*/}
</Toolbar>
</Toolbar>
</AppBar>
);
};
Expand Down Expand Up @@ -106,20 +106,20 @@ class App extends Component {
)
.catch(response => {
console.log(response);
});
});
}

render() {
return (
<ThemeProvider theme={theme}>
<MuiThemeProvider theme={o2rTheme}>
<div id="pageContainer">
<Header
loggedIn={this.state.loggedIn}
<Header
loggedIn={this.state.loggedIn}
login={() => this.user()}
userName={this.state.userName}
userOrcid={this.state.userOrcid}>
userOrcid={this.state.userOrcid}>
</Header>

<HashRouter>
<div>
<div className="content" id="mainView">
Expand All @@ -135,10 +135,9 @@ class App extends Component {
</HashRouter>
<Footer></Footer>
</div>
</ThemeProvider>
</MuiThemeProvider>
)
}
}

export default App

13 changes: 10 additions & 3 deletions ui/src/components/app/footerLinks/Impressum.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import React, { Component } from "react";
import config from '../../../helpers/config';

class Impressum extends Component {

componentDidMount(){
document.title = "Impressum" + config.title;

}

render() {
return (
<div>
<h1>Impressum</h1>
<h2>Contact</h2>
<div>
Westfälische Wilhelms-Universität Münster<br/>
Westfälische Wilhelms-Universität Münster<br/>
Institut für Geoinformatik - o2r Project Team<br/>
Heisenbergstraße 2<br/>
D-48149 Münster<br/><br/>
Expand All @@ -16,12 +23,12 @@ class Impressum extends Component {
</div>
<h2>Notice of Liability</h2>
<div flex="50">
Although we check the content carefully, we cannot accept responsibility for the content of external links.
Although we check the content carefully, we cannot accept responsibility for the content of external links.
The linked sites’ carriers are responsible for their sites’ content.
</div>
</div>
);
}
}

export default Impressum;
export default Impressum;
11 changes: 9 additions & 2 deletions ui/src/components/app/footerLinks/Privacy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import React, { Component } from "react";
import config from '../../../helpers/config';

class Privacy extends Component {

componentDidMount(){
document.title = "Privacy" + config.title;

}

render() {
return (
return (
<div>
<h3>Privacy Policy</h3>
<h4 id="userdata">User Data</h4>
Expand Down Expand Up @@ -40,4 +47,4 @@ class Privacy extends Component {
}
}

export default Privacy;
export default Privacy;
4 changes: 3 additions & 1 deletion ui/src/components/authorView/Author.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { Component } from "react";
import httpRequests from '../../helpers/httpRequests';
import ResultList from './resultList'
import { Grid, Paper } from "@material-ui/core";
import config from '../../helpers/config';

class Author extends Component {

Expand All @@ -16,6 +17,7 @@ class Author extends Component {
}
componentDidMount() {
this.getCompendia();
document.title = "Author View" + config.title;
}

goToErc = (erc) => {
Expand Down Expand Up @@ -88,4 +90,4 @@ class Author extends Component {
}
}

export default Author;
export default Author;
16 changes: 10 additions & 6 deletions ui/src/components/createERC/CreateERC.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import RequiredMetadata from './requiredMetadata/RequiredMetadata';
import SpatioTemporalMetadata from './spatioTemporalMetadata/SpatioTemporalMetadata';
import Bindings from './bindings/Bindings';
import httpRequests from '../../helpers/httpRequests';

import config from '../../helpers/config';


function TabContainer(props) {
Expand Down Expand Up @@ -35,7 +35,7 @@ class CreateERC extends Component {
spatioTemporalChanged: false,
authorsValid: false,
candidate: true,
showProgress: false,
showProgress: false
}
}

Expand Down Expand Up @@ -146,17 +146,21 @@ class CreateERC extends Component {
this.setState({ authorsValid: valid });
};


componentDidMount = () => this.getMetadata();
componentDidMount = () => {
this.getMetadata();
document.title = "Create ERC" + config.title;
}

handleClose = () => {
this.setState({ open: false })


}

render() {
const { value } = this.state;
return (
<div>
<div>
<AppBar position="fixed" color="default" id="appBar">
<Tabs scrollButtons="on" variant="standard" indicatorColor="primary" centered textColor="primary"
value={value}
Expand Down Expand Up @@ -243,4 +247,4 @@ class CreateERC extends Component {
}
}

export default CreateERC;
export default CreateERC;
23 changes: 14 additions & 9 deletions ui/src/components/createERC/bindings/Bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,14 @@ function VerticalLinearStepper(props) {
<Button onClick={saveErc} disabled = {!valid2} className={classes.button} variant="contained" color="primary">
Publish
</Button>
<Button onClick={goToErc} disabled = {props.candidate} className={classes.button} variant="contained" color="primary">
Go to ERC
</Button>
{props.candidate
? <Button onClick={goToErc} className={classes.button} variant="contained">
Preview
</Button>
: <Button onClick={goToErc} disabled = {props.candidate} className={classes.button} variant="contained" color="primary">
Go to ERC
</Button>
}
</Paper>
)}
</div>
Expand Down Expand Up @@ -472,7 +477,7 @@ class Bindings extends Component {
}

analyzeIfConditions = (analyzedCode, codelines) => {

for (var codeItem of analyzedCode) {
if (codeItem.type === "if" || codeItem.type === "while" ) {
if(codeItem.code[0].func && codeItem.code[0].func.id ==="install.packages"){
Expand Down Expand Up @@ -530,8 +535,8 @@ class Bindings extends Component {
/*handleMouseUp ( e ) {
if (this.state.creationStep === 1) {
try {
this.setCode(window.getSelection().getRangeAt(0).toString());
} catch (error) {
this.setCode(window.getSelection().getRangeAt(0).toString());
} catch (error) {
}
} else if (this.state.creationStep === 2) {
this.setState({
Expand Down Expand Up @@ -627,13 +632,13 @@ class Bindings extends Component {
saveErc = () => {
this.props.setChangedFalse("all")
this.props.updateMetadata(this.props.metadata, true)

}

goToErc= () => {
this.props.goToErc();
}

clearBinding() {
let state = this.state;
//state.codeview=true;
Expand Down Expand Up @@ -808,4 +813,4 @@ export default Bindings;
}
}
}
*/
*/
20 changes: 14 additions & 6 deletions ui/src/components/createERC/requiredMetadata/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,20 @@ export const Form = props => {
>
Publish
</Button>
<Button
type="button"
onClick={goToErc}
disabled={props.candidate}>
Go To ERC
{props.candidate
? <Button
type="button"
onClick={goToErc}>
Preview
</Button>
: <Button
type="button"
color="primary"
onClick={goToErc}
disabled={props.candidate}>
Go To ERC
</Button>
}
</Paper>
<div id={"errorMessage"}>
{errors.title ? errors.title : ""}
Expand Down Expand Up @@ -366,4 +374,4 @@ export const Form = props => {

</form>
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class RequiredMetadata extends Component {
codeLicense: this.props.originalMetadata.license.code,

}

componentDidMount() {
prepareLicense();
refs2 = refs.splice(refs.length - this.props.authors.length, refs.length)
Expand Down Expand Up @@ -190,7 +190,7 @@ class RequiredMetadata extends Component {
dataLicenses={dataLicenses}
mostRestrictiveData={mostRestrictiveData}
leastRestrictiveData={leastRestrictiveData}
candidate={this.props.candidate}
candidate={this.props.candidate}
showProgress={this.props.showProgress} />}
initialValues={this.formValues}
validationSchema={validationSchema}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class SpatioTemporalMetadata extends React.Component {
this.props.goToErc()
}

handlePreview = (e) => {
this.props.goToErc()
}

handleSave = () => {
this.props.setChangedFalse("all")
this.props.setMetadata(this.props.metadata, true)
Expand Down Expand Up @@ -309,12 +313,19 @@ class SpatioTemporalMetadata extends React.Component {
>
Publish
</Button>
<Button
type="button"
onClick={this.handleClick.bind(null)}
disabled={this.props.candidate}>
Go To ERC
</Button>
{this.props.candidate
?<Button
type="button"
onClick={this.handlePreview.bind(null)}>
Preview
</Button>
: <Button
type="button"
onClick={this.handleClick.bind(null)}
disabled={this.props.candidate}
color="primary">
Go To ERC
</Button>}
</Card>
<div id={"errorMessage"}>
{!valid2 ? "Required Metadata is not valid" : ""} <br />
Expand Down
9 changes: 7 additions & 2 deletions ui/src/components/discovery/Discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import L from 'leaflet'
import prepareQuery from './/queryBuilder'
import OwnMap, { ref, ref2 } from "./Map"
import ResultList from './resultList'
import config from '../../helpers/config';

import './discovery.css'

Expand All @@ -27,7 +28,11 @@ class Discovery extends Component {
}
}

componentDidMount() { this.searchCompendia(); this.calculateDateRange() }
componentDidMount() {
this.searchCompendia();
this.calculateDateRange();
document.title = "Discover" + config.title;
}

calculateDateRange = () => {
const result = []
Expand Down Expand Up @@ -312,4 +317,4 @@ class Discovery extends Component {
}
}

export default Discovery;
export default Discovery;
Loading

0 comments on commit 54986c8

Please sign in to comment.