Skip to content

Commit ee01366

Browse files
committed
Better tabs and table fixups
1 parent 70921d0 commit ee01366

File tree

5 files changed

+57
-24
lines changed

5 files changed

+57
-24
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"leaflet": "^1.9.4",
99
"react": "^18.2.0",
1010
"react-dom": "^18.2.0",
11+
"react-icons": "^5.3.0",
1112
"react-leaflet": "^4.2.1",
1213
"react-leaflet-markercluster": "^4.1.1",
1314
"react-router-dom": "^6.0.2",

src/components/RankingTable.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,7 @@ td:nth-child(3), th:nth-child(3) {
9898
color: var(--text-color);
9999
cursor: pointer;
100100
}
101+
102+
.expanded-content {
103+
display: flex;
104+
}

src/components/RankingTable.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ const RankingTable = ({ orchestrators, selectedKPI }) => {
107107

108108
return (
109109
<div className="ranking-table">
110-
<h4>Ranking Table</h4>
111-
112110
{/* Dropdown for Region Selection */}
113111
<div className="region-selector">
114112
<label htmlFor="region-select">Select Region:</label>
@@ -161,17 +159,16 @@ const RankingTable = ({ orchestrators, selectedKPI }) => {
161159
<td colSpan="3">
162160
<div className="expanded-content">
163161
{selectedKPI === "avgPrice" && (
164-
<p>
165-
<strong>Wei per pixel:</strong> {value.toFixed(0)} Wei<br />
166-
<strong>Converted Price:</strong> {ethPerHour?.toFixed(8)} ETH/hr at 1080p 30fps<br />
167-
<strong>Price in Dollars:</strong> ${(ethPerHour * 3000)?.toFixed(3)} (assuming 1 ETH = 3000 USD)
168-
</p>
162+
<span>
163+
{value.toFixed(1)} Wei -> {ethPerHour?.toFixed(8)} ETH/hr<br />
164+
TODO: results that make up the avg
165+
</span>
169166
)}
170167
{selectedKPI === "avgDiscoveryTime" && (
171-
<p>Discovery time is measured in milliseconds (ms).</p>
168+
<span>TODO: results that make up the avg</span>
172169
)}
173170
{selectedKPI === "avgRTR" && (
174-
<p>Realtime ratio (RTR) indicates the performance of the orchestrator.</p>
171+
<span>TODO: results that make up the avg</span>
175172
)}
176173
</div>
177174
</td>

src/pages/home.css

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,52 +37,71 @@
3737
flex-direction: column; /* Default for narrow screens */
3838
align-items: center; /* Centers the tabs and logo */
3939
padding: 10px 0;
40+
padding-bottom: 0;
4041
background-color: var(--darkest);
41-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Optional: shadow for separation */
42-
border-bottom: 1px solid var(--darker);
43-
z-index: 10;
42+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Updated shadow for better separation */
43+
border-bottom: 2px solid var(--darker);
44+
position: sticky; /* Makes header bar sticky */
45+
top: 0;
46+
z-index: 100;
4447
}
4548

4649
@media (min-width: 768px) {
4750
.header-bar {
4851
flex-direction: row; /* Horizontal layout for wide screens */
4952
justify-content: space-between; /* Separates the two tab groups */
5053
padding: 20px; /* More padding for larger screens */
54+
padding-bottom: 0;
5155
}
5256
}
5357

5458
.tabs {
5559
display: flex;
5660
justify-content: center;
57-
gap: 0.2em;
58-
flex-wrap: nowrap;
61+
gap: 1em;
62+
flex-wrap: wrap;
5963
height: 100%;
6064
margin: 10px 0;
6165
}
6266

67+
span {
68+
text-align: center;
69+
margin: 0;
70+
flex: 1;
71+
}
72+
6373
.tab {
6474
position: relative;
65-
background: var(--darker);
75+
background: var(--dark);
6676
color: var(--button-text-color);
6777
padding: 10px 20px;
6878
border: 1px solid var(--button-border);
69-
border-bottom: none; /* Makes it look like a folder tab */
70-
border-radius: 5px 5px 0 0;
79+
border-bottom: none;
80+
border-radius: 8px 8px 0 0;
7181
cursor: pointer;
7282
font-size: 1rem;
73-
height: 100%;
74-
transition: background-color 0.3s ease, transform 0.3s ease;
83+
transition: all 0.3s ease;
84+
display: flex;
85+
align-items: center;
86+
justify-content: center;
87+
}
88+
89+
.tab-icon {
90+
margin-right: 8px;
7591
}
7692

7793
.tab.active {
78-
background: var(--button-hover-background);
79-
color: var(--accent-color);
94+
background: var(--dark); /* Updated to make the active tab stand out more */
95+
color: var(--weird);
96+
border-color: var(--yellow);
8097
z-index: 12;
98+
transform: scale(1.05); /* Subtle enlargement to emphasize selection */
8199
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
82100
}
83101

84102
.tab:hover {
85-
background: var(--dark);
103+
background: var(--darker);
104+
transform: scale(1.10);
86105
}
87106

88107
.tab-content {
@@ -149,7 +168,11 @@
149168
}
150169

151170
.ranking-section {
171+
display: flex;
172+
flex-direction: column;
152173
max-width: 800px;
174+
align-items: center;
175+
justify-content: center;
153176
}
154177

155178
.ranking-section,

src/pages/home.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import RankingTable from "../components/RankingTable";
55
import Histogram from "../components/Histogram";
66
import WorldMap from "../components/WorldMap";
77
import useProcessedData from "../hooks/useProcessedData";
8+
import { FaDollarSign, FaClock, FaChartLine, FaMap, FaTable, FaChartBar } from 'react-icons/fa';
89
import "./home.css";
910

1011
const Home = () => {
@@ -38,7 +39,8 @@ const Home = () => {
3839
<div className="scrollable-content">
3940
<div className="tab-content">
4041
<section className="ranking-section">
41-
<h3>{getTitle()} Ranking</h3>
42+
<h4>{getTitle()} Ranking</h4>
43+
{activeKPI == "pricing" ? <span>(for 1 hour of 1080p 30fps, assuming 1 ETH = 3000 USD)</span> : ""}
4244
<RankingTable orchestrators={processedData.orchestrators} selectedKPI={selectedKPI} />
4345
</section>
4446
</div>
@@ -65,7 +67,7 @@ const Home = () => {
6567
<div className="scrollable-content">
6668
<div className="tab-content">
6769
<section className="histogram-section">
68-
<h3>{getTitle()} Histogram</h3>
70+
<h4>{getTitle()} Charts</h4>
6971
<Histogram aggregateData={processedData.aggregates} selectedKPI={selectedKPI} />
7072
</section>
7173
</div>
@@ -93,18 +95,21 @@ const Home = () => {
9395
className={`tab ${activeKPI === "pricing" ? "active" : ""}`}
9496
onClick={() => setKPI("pricing")}
9597
>
98+
<FaDollarSign className="tab-icon" />
9699
Pricing
97100
</button>
98101
<button
99102
className={`tab ${activeKPI === "discovery-time" ? "active" : ""}`}
100103
onClick={() => setKPI("discovery-time")}
101104
>
105+
<FaClock className="tab-icon" />
102106
Discovery Time
103107
</button>
104108
<button
105109
className={`tab ${activeKPI === "performance" ? "active" : ""}`}
106110
onClick={() => setKPI("performance")}
107111
>
112+
<FaChartLine className="tab-icon" />
108113
Performance
109114
</button>
110115
</div>
@@ -113,18 +118,21 @@ const Home = () => {
113118
className={`tab ${activeView === "table" ? "active" : ""}`}
114119
onClick={() => setView("table")}
115120
>
121+
<FaTable className="tab-icon" />
116122
Ranking
117123
</button>
118124
<button
119125
className={`tab ${activeView === "map" ? "active" : ""}`}
120126
onClick={() => setView("map")}
121127
>
128+
<FaMap className="tab-icon" />
122129
World Map
123130
</button>
124131
<button
125132
className={`tab ${activeView === "distribution" ? "active" : ""}`}
126133
onClick={() => setView("distribution")}
127134
>
135+
<FaChartBar className="tab-icon" />
128136
Distribution
129137
</button>
130138
</div>

0 commit comments

Comments
 (0)