Skip to content

Commit 0b93119

Browse files
authored
Merge pull request #204 from HSLdevcom/#203_tab_system
#203: Add tabs to UI
2 parents 0107661 + 04e28bf commit 0b93119

File tree

8 files changed

+161
-55
lines changed

8 files changed

+161
-55
lines changed

package-lock.json

+66-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"react": "^18.1.0",
3636
"react-chartjs-2": "^5.2.0",
3737
"react-dom": "^18.1.0",
38+
"react-tabs": "^6.0.2",
3839
"react-tooltip": "^5.15.0",
3940
"uuid": "^9.0.0",
4041
"vex-js": "^4.1.0"

src/renderer/components/App.css

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ body {
77
margin: 0;
88
padding: 0;
99
position: relative;
10-
background: #ffffff;
10+
background-color: #F4F4F5;
1111
font-size: 18px;
1212
font-family: gotham_rounded_medium, sans-serif;
13+
overflow-x: hidden;
1314
}
1415

1516
button {
@@ -83,6 +84,9 @@ hr {
8384
background-color: #ffffff;
8485
background-image: url('Settings.png');
8586
background-repeat: no-repeat;
87+
background-position: center;
88+
padding: 0.5rem;
89+
border-radius: 1rem;
8690
}
8791

8892
.App__header {
@@ -102,14 +106,12 @@ hr {
102106
letter-spacing: -0.02em;
103107
}
104108

105-
.App__header-title {
106-
}
107-
108109
.App__header-version {
109110
font-size: 60%;
110111
}
111112

112113
.App__body {
114+
height: 920px;
113115
}
114116

115117
.header-documentation-link {

src/renderer/components/HelmetProject/CostBenefitAnalysis/CostBenefitAnalysis.css

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
.CBA {
2-
background: #F4F4F5;
3-
border-top: 1px solid #CCCCCC;
4-
border-bottom: 1px solid #CCCCCC;
2+
background: #FFFFFF;
53
box-sizing: border-box;
64
padding: 20px;
75
margin-bottom: 20px;
6+
margin-top: 1rem;
87
}
98

109
.CBA__heading {
@@ -66,9 +65,6 @@
6665
padding: 0;
6766
}
6867

69-
.CBA__run {
70-
}
71-
7268
.CBA__run button {
7369
margin-top: 20px;
7470
}
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,56 @@
11
.Project {
22
position: relative;
3+
background: #ffffff;
4+
height: 100%;
35
}
4-
/*
5-
.Project__runtime {
6-
position: absolute;
7-
top: 0;
8-
left: 0;
9-
width: 100vw;
10-
height: 100vh;
11-
}
12-
*/
6+
137
.Project__selected-details {
148
position: absolute;
159
top: 130px;
1610
right: 20px;
1711
left: 635px;
1812
}
19-
.HelmetProject__control-group-separator {
13+
14+
.tab-list {
15+
display: flex;
16+
justify-content: flex-start;
17+
list-style: none;
18+
list-style-position: inside;
19+
width: 100%;
20+
height: 5rem;
21+
background-color: #F4F4F5;
22+
}
23+
24+
.tab-list-item {
25+
width: 12rem;
26+
height: 60%;
27+
display: flex;
28+
align-content: center;
29+
justify-content: center;
30+
color: #333333;
31+
border-radius: 1rem 1rem 0 0;
32+
background-color: white;
33+
opacity: 0.65;
34+
margin-left: 5px;
35+
cursor: default;
36+
}
37+
38+
.tab-item-name {
39+
padding-top: 2rem;
40+
}
41+
42+
.tab-item-name:hover {
43+
border-bottom: 2px solid #333333b5;
44+
}
45+
46+
.selected-tab {
47+
background-color: white;
48+
height: 60%;
49+
color: #333333;
50+
opacity: 1;
51+
outline: none;
2052
}
53+
54+
.selected-tab:hover {
55+
border-bottom: 2px solid #3333337e;
56+
}

src/renderer/components/HelmetProject/HelmetProject.jsx

+37-21
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { v4 as uuidv4 } from 'uuid';
33
import Store from "electron-store";
44
import fs from "fs";
55
import path from "path";
6+
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
67

78
const {ipcRenderer} = require('electron');
89

@@ -383,27 +384,42 @@ const HelmetProject = ({
383384

384385
{/* Panel for primary view and controls */}
385386
<div className="Project__runtime">
386-
<Runtime
387-
projectPath={projectPath}
388-
reloadScenarios={() => _loadProjectScenarios(projectPath)}
389-
scenarios={scenarios}
390-
scenarioIDsToRun={scenarioIDsToRun}
391-
runningScenarioID={runningScenarioID}
392-
openScenarioID={openScenarioID}
393-
setOpenScenarioID={setOpenScenarioID}
394-
deleteScenario={(scenario) => {_deleteScenario(scenario)}}
395-
handleClickScenarioToActive={_handleClickScenarioToActive}
396-
handleClickNewScenario={_handleClickNewScenario}
397-
handleClickStartStop={_handleClickStartStop}
398-
logArgs={logArgs}
399-
duplicateScenario={duplicateScenario}
400-
/>
401-
<CostBenefitAnalysis
402-
resultsPath={resultsPath}
403-
cbaOptions={cbaOptions}
404-
setCbaOptions={setCbaOptions}
405-
runCbaScript={_runCbaScript}
406-
/>
387+
<Tabs className="tab-container">
388+
<TabList className="tab-list">
389+
<Tab selectedClassName="selected-tab" className="tab-list-item tab-item-name">
390+
Skenaariot
391+
</Tab>
392+
<Tab selectedClassName="selected-tab" className="tab-list-item tab-item-name">
393+
CBA
394+
</Tab>
395+
</TabList>
396+
397+
<TabPanel className="runtime-tab">
398+
<Runtime
399+
projectPath={projectPath}
400+
reloadScenarios={() => _loadProjectScenarios(projectPath)}
401+
scenarios={scenarios}
402+
scenarioIDsToRun={scenarioIDsToRun}
403+
runningScenarioID={runningScenarioID}
404+
openScenarioID={openScenarioID}
405+
setOpenScenarioID={setOpenScenarioID}
406+
deleteScenario={(scenario) => {_deleteScenario(scenario)}}
407+
handleClickScenarioToActive={_handleClickScenarioToActive}
408+
handleClickNewScenario={_handleClickNewScenario}
409+
handleClickStartStop={_handleClickStartStop}
410+
logArgs={logArgs}
411+
duplicateScenario={duplicateScenario}
412+
/>
413+
</TabPanel>
414+
<TabPanel>
415+
<CostBenefitAnalysis
416+
resultsPath={resultsPath}
417+
cbaOptions={cbaOptions}
418+
setCbaOptions={setCbaOptions}
419+
runCbaScript={_runCbaScript}
420+
/>
421+
</TabPanel>
422+
</Tabs>
407423
</div>
408424

409425
{/* Panel for secondary view(s) and controls */}

src/renderer/components/HelmetProject/Runtime/Runtime.css

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.Runtime {
2-
}
3-
41
/* Helmet project */
52

63
.Runtime__helmet-project-controls {
@@ -67,8 +64,6 @@
6764
width: 24px !important;
6865
height: 24px !important;
6966
}
70-
.Runtime__scenario-activate-checkbox--active {
71-
}
7267

7368
.Runtime__scenario-open-config {
7469
display: inline-block;
@@ -126,15 +121,10 @@
126121

127122
.Runtime__start-stop-controls {
128123
padding: 20px;
129-
}
130-
131-
.Runtime__start-stop-description {
124+
background-color: #FFFFFF;
132125
}
133126

134127
.Runtime__start-stop-scenarios {
135128
color: #00985F;
136129
font-weight: bold;
137-
}
138-
139-
.Runtime__start-stop-btn {
140130
}

src/renderer/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<link rel="stylesheet" type="text/css" href="components/HelmetProject/RunLog/RunLog.css">
2828
<script type="text/babel" src="components/HelmetProject/CostBenefitAnalysis/CostBenefitAnalysis.jsx"></script>
2929
<link rel="stylesheet" type="text/css" href="components/HelmetProject/CostBenefitAnalysis/CostBenefitAnalysis.css">
30+
<link rel="stylesheet" type="text/css" href="react-tabs/style/react-tabs.css">
3031
<script type="text/javascript">
3132
// ipcRenderer is aliased, so that other <script> tag(s) won't crash on startup in "constant-already-set"
3233
const {webFrame, ipcRenderer: aliasIpcRenderer} = require('electron');
@@ -40,6 +41,7 @@
4041
<script type="text/babel" src="./icons/DocumentationIcon.jsx"></script>
4142
<script type="text/babel" src="./icons/ArrowDown.jsx"></script>
4243
<script type="text/babel" src="./icons/ArrowUp.jsx"></script>
44+
<script src="node_modules/electron-tabs/dist/electron-tabs.js"></script>
4345
</head>
4446
<body>
4547

0 commit comments

Comments
 (0)