Commit 028d478f authored by Mattias J Duffy's avatar Mattias J Duffy

small visual changes, search improvements and bug fixes

parent 886e2c9a
Pipeline #1946 passed with stage
in 1 minute and 46 seconds
......@@ -12,7 +12,7 @@ const CardContainer = ({searchTerm, campusRegion, facilities}) => {
const lSearchTerm = searchTerm.toLowerCase();
const facilityName = facility.facility_name.toLowerCase();
const facilityLocation = facility.facility_location.building.toLowerCase();
const facilityCategory = facility.facility_category.name.toLowerCase();
const facilityCategory = facility.facility_category.name.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, "");
const facilityTags = facility.facility_product_tags;
facilityTags.forEach((tag) => {
......
import React from 'react';
import Typography from 'material-ui/Typography';
import FacilityUtils from '../utils/facilityUtils';
import facilityUtils from '../utils/facilityUtils';
import classNames from 'classnames';
const FacilityStatus = ({facility}) => {
// const getOpenStatus = () => {
// const openFor = facilityUtils.calcTimeTillClose(facilityUtils.getFacilityActiveSchedule(facility))
// if( openFor)
// label = 'OPEN ' + ;
// }
// const getClosedStatus = () => {
// }
/**
* Generates information about the facility's status.
*
......@@ -15,8 +25,10 @@ const FacilityStatus = ({facility}) => {
let label;
let isOpen;
if (FacilityUtils.isFacilityOpen(facility)) {
label = 'OPEN';
if (facilityUtils.isFacilityOpen(facility)) {
// label = 'OPEN ' + facilityUtils.calcTimeTillClose(facilityUtils.getFacilityActiveSchedule(facility));
label = 'OPEN'
isOpen = true;
} else {
label = 'CLOSED';
......@@ -33,7 +45,7 @@ const FacilityStatus = ({facility}) => {
return (
<Typography type={'caption'} className={classNames('facility-status-text', statusInfo.isOpen ? 'facility-status-open' : 'facility-status-closed')}>
{/*{statusInfo.icon}*/}
{/* statusInfo.icon */}
{statusInfo.label}
</Typography>
)
......
......@@ -8,7 +8,7 @@
}
.fc-card-content {
padding: 8px 4px !important;
padding: 8px 2px !important;
}
.fc-small-grid-container-spacing {
......@@ -51,6 +51,7 @@
}
.fc-extra-info {
padding: 8px 4px 8px 4px !important;
display: flex;
align-items: center;
max-width: 50%;
......
......@@ -41,6 +41,7 @@
}
.search-bar-campus-control {
margin-right: 8px !important;
width: 150px;
justify-content: center;
}
......@@ -81,6 +82,7 @@
}
.search-bar-campus-control {
display: none !important;
}
......@@ -90,6 +92,7 @@
}
.search-bar-campus-control {
margin-right: 8px;
display: inline-flex !important;
}
......
......@@ -96,6 +96,10 @@ const calcTimeTillOpen = schedule => {
* @returns {number} The time (in minutes) until the facility closes.
*/
const calcTimeTillClose = schedule => {
console.log(schedule)
if(schedule.twenty_four_hours === true){
return '';
}
const curDateTime = new Date();
//Converts the JS day of week (0 is sunday), to the API day of week (0 is monday).
const dayOfWeek = [6, 0, 1, 2, 3, 4, 5][curDateTime.getDay()];
......@@ -114,7 +118,12 @@ const calcTimeTillClose = schedule => {
timeInParts[1],
timeInParts[2]);
return (closeTime - curDateTime) / 60000;
const minutesTillClose = (closeTime - curDateTime) / 60000
if(minutesTillClose < 60){
return parseInt(minutesTillClose) + "mins"
}else{
return parseInt(minutesTillClose/60) + "hrs"
}
};
......@@ -332,6 +341,9 @@ const convertToMeridienTime = (time) => {
timeArr[0] = timeArr[0] - 12;
am_pm = "pm";
}
if(timeArr[0] === 0){
timeArr[0] = 12
}
if (timeArr[1] === 0) {
timeArr[1] = "";
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment