Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivozilkenat committed Apr 6, 2024
2 parents 9117cf8 + 29f03fa commit ea6d093
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 17 deletions.
4 changes: 2 additions & 2 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import React from "react";
import "./App.css"
import MapComponent from './components/RealtimeMap';
import Banner from "./components/Banner";
import InputBox from "./components/inputBox";
import RouteSearchDiv from "./components/RouteSearchDiv";

function App() {

return (
<div className="App">
<Banner />
<InputBox />
<MapComponent />
<RouteSearchDiv />
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';

function App() {
function InputBox() {
const [input1, setInput1] = useState('');
const [input2, setInput2] = useState('');
const [suggestedStations1, setSuggestedStations1] = useState([]);
Expand Down Expand Up @@ -111,4 +111,4 @@ function App() {
);
}

export default App;
export default InputBox;
49 changes: 37 additions & 12 deletions client/src/components/RealtimeMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,22 @@ function RealtimeMap() {
return (
<Marker position={[item.position.lat, item.position.lon]} icon={icon}>
<Popup>
<p>
Type: {capitalizeFirstLetter(item.type)} <br/>
Line: {item.line} | Direction: {item.direction} <br/>
<br/>
Absolute Utilization: {item.utilization.abs} <br/>
Relative Utilization: {item.utilization.rel}
</p>
<div className="popup-content">
<div className="popup-heading">
Type: {capitalizeFirstLetter(item.subType)} | Line: {item.line}
</div>
<div className="popup-info">
<div className="info-line">
<span className="info-label">Direction:</span> {item.direction}
</div>
<div className="info-line">
<span className="info-label">Absolute Utilization:</span> {item.utilization.abs !== null ? item.utilization.abs : "null"}
</div>
<div className="info-line">
<span className="info-label">Relative Utilization:</span> {item.utilization.rel !== null ? item.utilization.rel : "null"}
</div>
</div>
</div>
</Popup>
</Marker>
);
Expand All @@ -75,11 +84,27 @@ function RealtimeMap() {
return (
<Circle center={[item.position.lat, item.position.lon]} radius={25} color={color}>
<Popup>
<h1>{item.name}</h1>
<p>
Absolute Utilization: {item.utilization.abs} <br/>
Relative Utilization: {item.utilization.rel}
</p>
<div className="popup-content">
<div className="popup-heading">
{item.name}
</div>
<div className="popup-info">
<div className="info-line">
<span><span className="info-label">Transportation mode(s):</span> {
Object.entries(item.products)
.filter(([key, value]) => value)
.map(([key]) => key)
.join(', ')
}</span>
</div>
<div className="info-line">
<span className="info-label">Absolute Utilization:</span> {item.utilization.abs !== null ? item.utilization.abs : 'null'}
</div>
<div className="info-line">
<span className="info-label">Relative Utilization:</span> {item.utilization.rel !== null ? item.utilization.rel : 'null'}
</div>
</div>
</div>
</Popup>
</Circle>
);
Expand Down
10 changes: 10 additions & 0 deletions client/src/components/RouteSearchDiv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React, { useState } from 'react';
import InputBox from "./InputBox";

function RouteSearchDiv() {
return (
<InputBox />
);
}

export default RouteSearchDiv;
2 changes: 1 addition & 1 deletion client/src/components/VehicleIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function getColor(products) {
return "red";
} else if (products.tram) {
return "blue";
} else if (products.bus) {
} else if (products.suburban) {
return "yellow";
} else if (products.ferry) {
return "purple";
Expand Down
25 changes: 25 additions & 0 deletions client/src/components/css/RealtimeMap.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,28 @@
margin-right: auto;
}

.popup-content {
max-width: 600px; /* or a higher value to allow more content in one line */
overflow-x: auto; /* Allows horizontal scrolling */
}

.popup-heading {
font-size: 18px;
font-weight: bold;
}

.popup-info .info-line {
background-color: #f2f2f2;
border-radius: 8px;
padding: 5px;
margin-top: 5px;
white-space: pre-wrap; /* Allows text to wrap */
}

.info-label {
font-weight: bold; /* Makes the label text bold */
}

.popup-heading, .popup-info .info-line {
white-space: nowrap;
}

0 comments on commit ea6d093

Please sign in to comment.