Skip to content

Commit

Permalink
Merge pull request #42 from amosproj/frontend-dev-#18
Browse files Browse the repository at this point in the history
Implementation of #18 and #37
  • Loading branch information
Waldleufer authored May 18, 2021
2 parents 19da4fe + 6b56959 commit 1404383
Show file tree
Hide file tree
Showing 17 changed files with 498 additions and 23,921 deletions.
23,715 changes: 35 additions & 23,680 deletions frontend/package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
]
},
"devDependencies": {
"gh-pages": "^2.0.1"
"gh-pages": "^2.0.1",
"prettier": "2.3.0"
}
}
103 changes: 70 additions & 33 deletions frontend/src/components/details/CanvasComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,84 @@
in this main component come all the canvas page components
such as diagrams and tables
@author parham, 08.05, Irem Toroslu
@author Parham Gandomkar, Irem Toroslu
*/

import React, { Component } from 'react';
import PieChart from './PieChartComponent';
import ColumnChart from './ColumnChartComponent';
import Table from './TableComponent'
import './canvas.css';
import {Container, Row, Col } from 'react-grid-system';
import Table from './TableComponent';
import { Container, Row, Col } from 'react-grid-system';
import theme from 'resources/theme';
import CompareCanvas from './CompareCanvas';



class CanvasPage extends Component {
class CanvasComponent extends Component {
render() {
return (
<Container fluid={true}>
<Row>
<Col xs={5} style={{marginTop:30}}>
<h3 style={{fontSize:theme.typography.subtitle.fontSize,fontWeight:theme.typography.subtitle.fontWeight, lineHeight:theme.typography.subtitle.lineHeight,
letterSpacing:theme.typography.subtitle.letterSpacing,marginLeft:100}}> Material Composition </h3>
<PieChart></PieChart>
</Col>
<Col xs={5} style={{marginTop:30,marginLeft:20}}>
<h3 style={{fontSize:theme.typography.subtitle.fontSize,fontWeight:theme.typography.subtitle.fontWeight, lineHeight:theme.typography.subtitle.lineHeight,
letterSpacing:theme.typography.subtitle.letterSpacing,marginLeft:90}}> Results of the impact assessment </h3>
<ColumnChart></ColumnChart>
</Col>
</Row>
<Row>
<Col xs={10} style={{marginTop:30,marginBottom:30}}>
<h3 style={{fontSize:theme.typography.subtitle.fontSize,fontWeight:theme.typography.subtitle.fontWeight, lineHeight:theme.typography.subtitle.lineHeight,
letterSpacing:theme.typography.subtitle.letterSpacing}} > Impact categories </h3>
<Table></Table>
</Col>
</Row>

</Container>

);
/*
if the loadComparePage state from its parrent (the detail Component)
is set to true, here the canvas page should be divided into two canvases
*/
if (this.props.loadComparePage) {
return <CompareCanvas />;
} else {
/*
the normal scenario
a canvas page without any comparisons
*/
return (
<Container fluid={true}>
<Row>
<Col xs={5} style={{ marginTop: 30 }}>
<h3
style={{
fontSize: theme.typography.subtitle.fontSize,
fontWeight: theme.typography.subtitle.fontWeight,
lineHeight: theme.typography.subtitle.lineHeight,
letterSpacing: theme.typography.subtitle.letterSpacing,
marginLeft: 100
}}
>
{' '}
Material Composition{' '}
</h3>
<PieChart />
</Col>
<Col xs={5} style={{ marginTop: 30, marginLeft: 20 }}>
<h3
style={{
fontSize: theme.typography.subtitle.fontSize,
fontWeight: theme.typography.subtitle.fontWeight,
lineHeight: theme.typography.subtitle.lineHeight,
letterSpacing: theme.typography.subtitle.letterSpacing,
marginLeft: 90
}}
>
{' '}
Results of the impact assessment{' '}
</h3>
<ColumnChart />
</Col>
</Row>
<Row>
<Col xs={10} style={{ marginTop: 30, marginBottom: 30 }}>
<h3
style={{
fontSize: theme.typography.subtitle.fontSize,
fontWeight: theme.typography.subtitle.fontWeight,
lineHeight: theme.typography.subtitle.lineHeight,
letterSpacing: theme.typography.subtitle.letterSpacing
}}
>
{' '}
Impact categories{' '}
</h3>
<Table />
</Col>
</Row>
</Container>
);
}
}
}

export default CanvasPage;
export default CanvasComponent;
2 changes: 1 addition & 1 deletion frontend/src/components/details/ColumnChartComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Column Chart
*
* @author Julian Oelhaf, Irem Toroslu
* @author Julian Oelhaf
*/
import React, { Component } from 'react';
import ReactApexChart from 'react-apexcharts';
Expand Down
123 changes: 123 additions & 0 deletions frontend/src/components/details/CompareCanvas.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import React, { Component } from 'react';
import PieChart from './PieChartComponent';
import ColumnChart from './ColumnChartComponent';
import Table from './TableComponent';
import { Container, Row, Col } from 'react-grid-system';
import theme from 'resources/theme';
/**
* This component displays the difference/comparison between the dashboards of two different type of variables of the same model
* will be compared when clicking on the "comparison" button.
*
* @returns the dasboard comparison
* @author Parham Gandomkar, Irem Toroslu
*
*
*/

const CompareCanvas = () => {
return (
<Container fluid={true}>
<Row>
<Col xs={5} style={{ marginRight: 150 }}>
<h3
style={{
fontSize: theme.typography.subtitle.fontSize,
fontWeight: theme.typography.subtitle.fontWeight,
lineHeight: theme.typography.subtitle.lineHeight,
letterSpacing: theme.typography.subtitle.letterSpacing,
marginLeft: 120
}}
>
{' '}
Material Composition{' '}
</h3>
<PieChart></PieChart>
</Col>
<Col xs={5}>
<h3
style={{
fontSize: theme.typography.subtitle.fontSize,
fontWeight: theme.typography.subtitle.fontWeight,
lineHeight: theme.typography.subtitle.lineHeight,
letterSpacing: theme.typography.subtitle.letterSpacing,
marginLeft: 120
}}
>
{' '}
Material Composition{' '}
</h3>
<PieChart></PieChart>
</Col>
</Row>
<Row>
<Col xs={5} style={{ marginRight: 150 }}>
<h3
style={{
fontSize: theme.typography.subtitle.fontSize,
fontWeight: theme.typography.subtitle.fontWeight,
lineHeight: theme.typography.subtitle.lineHeight,
letterSpacing: theme.typography.subtitle.letterSpacing,
marginLeft: 80
}}
>
{' '}
Results of the impact assessment{' '}
</h3>
<ColumnChart></ColumnChart>
</Col>
<Col xs={5}>
<h3
style={{
fontSize: theme.typography.subtitle.fontSize,
fontWeight: theme.typography.subtitle.fontWeight,
lineHeight: theme.typography.subtitle.lineHeight,
letterSpacing: theme.typography.subtitle.letterSpacing,
marginLeft: 80
}}
>
{' '}
Results of the impact assessment{' '}
</h3>
<ColumnChart></ColumnChart>
</Col>
</Row>

<Row>
<Col xs={10}>
<h3
style={{
fontSize: theme.typography.subtitle.fontSize,
fontWeight: theme.typography.subtitle.fontWeight,
lineHeight: theme.typography.subtitle.lineHeight,
letterSpacing: theme.typography.subtitle.letterSpacing
}}
>
{' '}
Impact categories{' '}
</h3>
<Table></Table>
</Col>
</Row>
<Row className='w3-margin-top'>
<Col xs={10}>
<h3
style={{
fontSize: theme.typography.subtitle.fontSize,
fontWeight: theme.typography.subtitle.fontWeight,
lineHeight: theme.typography.subtitle.lineHeight,
letterSpacing: theme.typography.subtitle.letterSpacing
}}
>
{' '}
Impact categories{' '}
</h3>
<div style={{ marginBottom: 30 }}>
<Table></Table>
</div>
</Col>
</Row>
</Container>
);
};

export default CompareCanvas;
54 changes: 54 additions & 0 deletions frontend/src/components/details/CompareVariablesComponent.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React, { Component } from 'react';
import theme from 'resources/theme';

/**
a drop down component for selecting variables
if we need to compare two variables
@author Parham Gandomkar
*/
const CompareVariablesComponent = (props) => {
const {state} = props;
return (

<div>
Pick your desire variable:
<div className='w3-dropdown-hover w3-margin-left w3-margin-right w3-margin-top'>
<button className='w3-button w3-2018-sailor-blue' style={{fontSize:theme.typography.buttontitle.fontSize,fontWeight:theme.typography.buttontitle.fontWeight,lineHeight:theme.typography.buttontitle.lineHeight,letterSpacing:theme.typography.buttonSendtitle.letterSpacing}}>
{state.selectedVariable}
</button>
<div className='w3-dropdown-content w3-bar-block w3-border' style={{fontSize:theme.typography.buttontitle.fontSize,fontWeight:theme.typography.buttontitle.fontWeight,lineHeight:theme.typography.buttontitle.lineHeight,letterSpacing:theme.typography.buttonSendtitle.letterSpacing}}>
{state.variables.map((item) => (
<a
onClick={() => props.firstDropDownHandler(item.name)}
className='w3-bar-item w3-button'
key={item.id}
>
{item.name}
</a>
))}
</div>
</div>
<div className='w3-dropdown-hover w3-margin-left w3-margin-right w3-margin-top'>
<button className='w3-button w3-2018-sailor-blue' style={{fontSize:theme.typography.buttontitle.fontSize,fontWeight:theme.typography.buttontitle.fontWeight,lineHeight:theme.typography.buttontitle.lineHeight,letterSpacing:theme.typography.buttonSendtitle.letterSpacing}}>
{state.secondVariable}
</button>
<div className='w3-dropdown-content w3-bar-block w3-border' style={{fontSize:theme.typography.buttontitle.fontSize,fontWeight:theme.typography.buttontitle.fontWeight,lineHeight:theme.typography.buttontitle.lineHeight,letterSpacing:theme.typography.buttonSendtitle.letterSpacing}}>
{state.variables.map((item) => (
<a
onClick={() => props.secondDropDownHandler(item.name)}
className='w3-bar-item w3-button'
key={item.id}
>
{item.name}
</a>
))}
</div>
</div>
<button onClick={props.submitHandler} style={{backgroundColor:theme.uniformStyle.color.sendButtonColor}} className='w3-button w3-wide'>
<b style={{fontSize:theme.typography.buttonSendtitle.fontSize,fontWeight:theme.typography.buttonSendtitle.fontWeight,letterSpacing:theme.typography.buttonSendtitle.letterSpacing,lineHeight:theme.typography.buttonSendtitle.lineHeight}}>Send Request</b>
</button>
</div> );
}

export default CompareVariablesComponent;
Loading

0 comments on commit 1404383

Please sign in to comment.