Skip to content

Commit

Permalink
add: icons to drop down menu & helper map 'vehicleImages' & custom Re…
Browse files Browse the repository at this point in the history
…act Select Option; rename: 'vehicleTypes' -> 'routeInfo'
  • Loading branch information
its-all-waves committed Dec 5, 2024
1 parent 78d54be commit 236add0
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 16 deletions.
38 changes: 29 additions & 9 deletions app/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@ import 'bootstrap/dist/css/bootstrap.min.css';
import NortaGeoJson from '../data/routes.json';
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';
import Select from 'react-select'
import Select, { components as SelectComponents } from 'react-select'
import makeAnimated from 'react-select/animated';
import CustomModal from './components/modal';
import LocationMarker from './components/location';
import './main.css';

import vehicleTypes from '../data/vehicle_types.json'
import routesInfo from '../data/routes_info.json'
import busIcon from '../img/icon-mock-bus.png'
import streetcarIcon from '../img/icont-mock-streetcar.png'
import ferryIcon from '../img/icon-mock-ferry.png'
import errorIcon from '../img/icon-vehicle-error.png'
import arrowIcon from '../img/arrow_offset.png'

const vehicleImages = Object.freeze({
ferry: ferryIcon,
streetcar: streetcarIcon,
bus: busIcon,
error: errorIcon,
})

const animatedComponents = makeAnimated();
const ROUTES = NortaGeoJson
.features
Expand Down Expand Up @@ -65,7 +72,7 @@ function vehicleIcon(image) {
});
}

const vehicleIcons = Object.freeze({
const vehicleMarkerIcons = Object.freeze({
ferry: vehicleIcon(ferryIcon),
streetcar: vehicleIcon(streetcarIcon),
bus: vehicleIcon(busIcon),
Expand All @@ -75,17 +82,29 @@ const vehicleIcons = Object.freeze({
function VehicleMarker({ children, ...props }) {
const { type } = props
return (
<Marker {...props} icon={vehicleIcons[type]} riseOnHover={true}>
<Marker {...props} icon={vehicleMarkerIcons[type]} riseOnHover={true}>
{children}
</Marker>
)
}

// React Select - add icons to route options
const { Option } = SelectComponents
function RouteOption(props) {
const { data: { label, icon } } = props
return (
<Option {...props}>
<img src={icon} alt={label} width="20" height="20" className="me-2"/>
{label}
</Option>
)
}

function timestampDisplay(timestamp) {
const relativeTimestamp = new Date() - new Date(timestamp);
if (relativeTimestamp < 60000) { return 'less than a minute ago'; }
const minutes = Math.round(relativeTimestamp / 60000);
if (minutes === 1) { return '1 minute ago'}
if (minutes === 1) { return '1 minute ago'; }
return minutes + ' minutes ago';
}

Expand Down Expand Up @@ -159,7 +178,7 @@ class App extends React.Component {
const coords = [v.lat, v.lon].map(parseFloat)
const rotAng = parseInt(v.hdg, 10)
const relTime = timestampDisplay(v.tmstmp)
const type = vehicleTypes[v.rt]?.type ?? 'error'
const type = routesInfo[v.rt]?.type ?? 'error'
return (
<div key={v.vid + '_container'}>
<ArrowMarker key={v.vid + '_arrow'} position={coords} rotationAngle={rotAng} />
Expand Down Expand Up @@ -221,15 +240,16 @@ class App extends React.Component {

const routes = [...new Set(this.state.vehicles.map(v => v.rt))]
const routeOptions = routes.map(rt => {
const name = vehicleTypes[rt].name.replace(' ', ' :: ')
return { value: rt, label: name }
const label = routesInfo[rt].name.replace(' ', ' :: ')
const icon = vehicleImages[routesInfo[rt].type]
return { value: rt, label, icon }
})

return <div className="control-bar">
<label className="control-bar__filter-label"><span className="control-bar__label-text">Filter Routes:</span>
<Select
closeMenuOnSelect={false}
components={animatedComponents}
components={{ ...animatedComponents, Option: RouteOption }}
defaultValue={[]}
value={this.state.routes}
isMulti
Expand Down
File renamed without changes.
File renamed without changes
34 changes: 27 additions & 7 deletions public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -39485,7 +39485,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
key: "renderMenu",
value: function renderMenu() {
var _this4 = this;
var _this$getComponents7 = this.getComponents(), Group3 = _this$getComponents7.Group, GroupHeading3 = _this$getComponents7.GroupHeading, Menu3 = _this$getComponents7.Menu, MenuList3 = _this$getComponents7.MenuList, MenuPortal3 = _this$getComponents7.MenuPortal, LoadingMessage3 = _this$getComponents7.LoadingMessage, NoOptionsMessage3 = _this$getComponents7.NoOptionsMessage, Option3 = _this$getComponents7.Option;
var _this$getComponents7 = this.getComponents(), Group3 = _this$getComponents7.Group, GroupHeading3 = _this$getComponents7.GroupHeading, Menu3 = _this$getComponents7.Menu, MenuList3 = _this$getComponents7.MenuList, MenuPortal3 = _this$getComponents7.MenuPortal, LoadingMessage3 = _this$getComponents7.LoadingMessage, NoOptionsMessage3 = _this$getComponents7.NoOptionsMessage, Option4 = _this$getComponents7.Option;
var commonProps = this.commonProps;
var focusedOption = this.state.focusedOption;
var _this$props12 = this.props, captureMenuScroll = _this$props12.captureMenuScroll, inputValue = _this$props12.inputValue, isLoading = _this$props12.isLoading, loadingMessage2 = _this$props12.loadingMessage, minMenuHeight = _this$props12.minMenuHeight, maxMenuHeight = _this$props12.maxMenuHeight, menuIsOpen = _this$props12.menuIsOpen, menuPlacement = _this$props12.menuPlacement, menuPosition = _this$props12.menuPosition, menuPortalTarget = _this$props12.menuPortalTarget, menuShouldBlockScroll = _this$props12.menuShouldBlockScroll, menuShouldScrollIntoView = _this$props12.menuShouldScrollIntoView, noOptionsMessage2 = _this$props12.noOptionsMessage, onMenuScrollToTop = _this$props12.onMenuScrollToTop, onMenuScrollToBottom = _this$props12.onMenuScrollToBottom;
Expand All @@ -39508,7 +39508,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
onMouseOver: onHover,
tabIndex: -1
};
return /* @__PURE__ */ React8.createElement(Option3, _extends2({}, commonProps, {
return /* @__PURE__ */ React8.createElement(Option4, _extends2({}, commonProps, {
innerProps,
data,
isDisabled,
Expand Down Expand Up @@ -40715,6 +40715,12 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
var arrow_offset_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWgAAALQCAYAAAC9lOpQAAAACXBIWXMAAAsSAAALEgHS3X78AAAYp0lEQVR4nO3dQW4b6ZnH4ZfBYBDMDCCtGrOKPSeQAmRv5g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EqgAUIJNEAogQYIJdAAoQQaIJRAA4QSaIBQAg0QSqABQgk0QCiBBggl0AChBBoglEADhBJogFACDRBKoAFCCTRAKIEGCCXQAKEEGiCUQAOEEmiAUAINEEqgAUIJNEAogQYIJdAAoQQaIJRAA4QSaIBQAg0QSqABQgk0QCiBBggl0AChBBoglEADhBJogFACDRBKoAFCCTRAKIEGCCXQAKEEGiCUQAOEEmiAUAINEEqgAUIJNEAogQYIJdAAoQQaIJRAA4QSaIBQAg0QSqABQgk0QCiBBggl0AChBBoglEADhBJogFACDRBKoAFCCTRAKIEGCCXQAKEEGiCUQAOEEmiAUAINEEqgAUIJNEAogQYIJdAAoQQaIJRAA4QSaIBQAg0QSqABQgk0QCiBBggl0AChBBoglEADhBJogFACDRBKoAFCCTRAKIEGCCXQAKEEGiCUQAOEEmiAUAINEEqgAUIJNEAogQYIJdAAoQQaIJRAA4QSaIBQAg0QSqABQgk0QCiBBggl0AChBBoglEADhBJogFACDRBKoAFCCTRAKIEGCCXQAKEEGiCUQAOEEmiAUAINEEqgAUIJNEAogQYIJdAAoQQaIJRAA4QSaIBQAg0QSqABQgk0QCiBBggl0AChBBoglEADhBJogFACDRBKoAFCCTRAKIEGCCXQAKEEGiCUQAOEEmiAUAINEEqgAUIJNEAogQYIJdAAoQQaIJRAA4QSaIBQAg0Q6v8B15WqvF0xzHYAAAAASUVORK5CYII=";

// app/main.jsx
var vehicleImages = Object.freeze({
ferry: icon_mock_ferry_default,
streetcar: icont_mock_streetcar_default,
bus: icon_mock_bus_default,
error: icon_vehicle_error_default
});
var animatedComponents = react_select_animated_esm_default();
var ROUTES = routes_default.features.filter((f2) => f2.geometry.type === "MultiLineString" && f2.properties.route_id).reduce((acc, f2) => {
return {
Expand Down Expand Up @@ -40755,7 +40761,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
className: "leaflet-marker-icon"
});
}
var vehicleIcons = Object.freeze({
var vehicleMarkerIcons = Object.freeze({
ferry: vehicleIcon(icon_mock_ferry_default),
streetcar: vehicleIcon(icont_mock_streetcar_default),
bus: vehicleIcon(icon_mock_bus_default),
Expand All @@ -40765,10 +40771,23 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
const { type } = props;
return /* @__PURE__ */ import_react28.default.createElement(Marker, {
...props,
icon: vehicleIcons[type],
icon: vehicleMarkerIcons[type],
riseOnHover: true
}, children);
}
var { Option: Option3 } = components;
function RouteOption(props) {
const { data: { label, icon } } = props;
return /* @__PURE__ */ import_react28.default.createElement(Option3, {
...props
}, /* @__PURE__ */ import_react28.default.createElement("img", {
src: icon,
alt: label,
width: "20",
height: "20",
className: "me-2"
}), label);
}
function timestampDisplay(timestamp) {
const relativeTimestamp = new Date() - new Date(timestamp);
if (relativeTimestamp < 6e4) {
Expand Down Expand Up @@ -40895,8 +40914,9 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
}
const routes = [...new Set(this.state.vehicles.map((v2) => v2.rt))];
const routeOptions = routes.map((rt) => {
const name = vehicle_types_default[rt].name.replace(" ", " :: ");
return { value: rt, label: name };
const label = vehicle_types_default[rt].name.replace(" ", " :: ");
const icon = vehicleImages[vehicle_types_default[rt].type];
return { value: rt, label, icon };
});
return /* @__PURE__ */ import_react28.default.createElement("div", {
className: "control-bar"
Expand All @@ -40906,7 +40926,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
className: "control-bar__label-text"
}, "Filter Routes:"), /* @__PURE__ */ import_react28.default.createElement(react_select_esm_default, {
closeMenuOnSelect: false,
components: animatedComponents,
components: { ...animatedComponents, Option: RouteOption },
defaultValue: [],
value: this.state.routes,
isMulti: true,
Expand Down

0 comments on commit 236add0

Please sign in to comment.