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

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}) => { ...@@ -12,7 +12,7 @@ const CardContainer = ({searchTerm, campusRegion, facilities}) => {
const lSearchTerm = searchTerm.toLowerCase(); const lSearchTerm = searchTerm.toLowerCase();
const facilityName = facility.facility_name.toLowerCase(); const facilityName = facility.facility_name.toLowerCase();
const facilityLocation = facility.facility_location.building.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; const facilityTags = facility.facility_product_tags;
facilityTags.forEach((tag) => { facilityTags.forEach((tag) => {
......
import React from 'react'; import React from 'react';
import Typography from 'material-ui/Typography'; import Typography from 'material-ui/Typography';
import FacilityUtils from '../utils/facilityUtils'; import facilityUtils from '../utils/facilityUtils';
import classNames from 'classnames'; import classNames from 'classnames';
const FacilityStatus = ({facility}) => { 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. * Generates information about the facility's status.
* *
...@@ -15,8 +25,10 @@ const FacilityStatus = ({facility}) => { ...@@ -15,8 +25,10 @@ const FacilityStatus = ({facility}) => {
let label; let label;
let isOpen; let isOpen;
if (FacilityUtils.isFacilityOpen(facility)) { if (facilityUtils.isFacilityOpen(facility)) {
label = 'OPEN';
// label = 'OPEN ' + facilityUtils.calcTimeTillClose(facilityUtils.getFacilityActiveSchedule(facility));
label = 'OPEN'
isOpen = true; isOpen = true;
} else { } else {
label = 'CLOSED'; label = 'CLOSED';
...@@ -33,7 +45,7 @@ const FacilityStatus = ({facility}) => { ...@@ -33,7 +45,7 @@ const FacilityStatus = ({facility}) => {
return ( return (
<Typography type={'caption'} className={classNames('facility-status-text', statusInfo.isOpen ? 'facility-status-open' : 'facility-status-closed')}> <Typography type={'caption'} className={classNames('facility-status-text', statusInfo.isOpen ? 'facility-status-open' : 'facility-status-closed')}>
{/*{statusInfo.icon}*/} {/* statusInfo.icon */}
{statusInfo.label} {statusInfo.label}
</Typography> </Typography>
) )
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
} }
.fc-card-content { .fc-card-content {
padding: 8px 4px !important; padding: 8px 2px !important;
} }
.fc-small-grid-container-spacing { .fc-small-grid-container-spacing {
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
} }
.fc-extra-info { .fc-extra-info {
padding: 8px 4px 8px 4px !important;
display: flex; display: flex;
align-items: center; align-items: center;
max-width: 50%; max-width: 50%;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
} }
.search-bar-campus-control { .search-bar-campus-control {
margin-right: 8px !important;
width: 150px; width: 150px;
justify-content: center; justify-content: center;
} }
...@@ -81,6 +82,7 @@ ...@@ -81,6 +82,7 @@
} }
.search-bar-campus-control { .search-bar-campus-control {
display: none !important; display: none !important;
} }
...@@ -90,6 +92,7 @@ ...@@ -90,6 +92,7 @@
} }
.search-bar-campus-control { .search-bar-campus-control {
margin-right: 8px;
display: inline-flex !important; display: inline-flex !important;
} }
......
...@@ -96,6 +96,10 @@ const calcTimeTillOpen = schedule => { ...@@ -96,6 +96,10 @@ const calcTimeTillOpen = schedule => {
* @returns {number} The time (in minutes) until the facility closes. * @returns {number} The time (in minutes) until the facility closes.
*/ */
const calcTimeTillClose = schedule => { const calcTimeTillClose = schedule => {
console.log(schedule)
if(schedule.twenty_four_hours === true){
return '';
}
const curDateTime = new Date(); const curDateTime = new Date();
//Converts the JS day of week (0 is sunday), to the API day of week (0 is monday). //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()]; const dayOfWeek = [6, 0, 1, 2, 3, 4, 5][curDateTime.getDay()];
...@@ -114,7 +118,12 @@ const calcTimeTillClose = schedule => { ...@@ -114,7 +118,12 @@ const calcTimeTillClose = schedule => {
timeInParts[1], timeInParts[1],
timeInParts[2]); 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) => { ...@@ -332,6 +341,9 @@ const convertToMeridienTime = (time) => {
timeArr[0] = timeArr[0] - 12; timeArr[0] = timeArr[0] - 12;
am_pm = "pm"; am_pm = "pm";
} }
if(timeArr[0] === 0){
timeArr[0] = 12
}
if (timeArr[1] === 0) { if (timeArr[1] === 0) {
timeArr[1] = ""; timeArr[1] = "";
} else { } 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