diff --git a/ui-react/src/components/flightboard/Flightboard.js b/ui-react/src/components/flightboard/Flightboard.js index 01f5ca0..bc70d57 100644 --- a/ui-react/src/components/flightboard/Flightboard.js +++ b/ui-react/src/components/flightboard/Flightboard.js @@ -59,7 +59,7 @@ class Flightboard extends Component { { response ? (!error ? rooms.map((room, key) => - + ) :
diff --git a/ui-react/src/components/flightboard/FlightboardRow.js b/ui-react/src/components/flightboard/FlightboardRow.js index dc52cf0..21cc8d1 100644 --- a/ui-react/src/components/flightboard/FlightboardRow.js +++ b/ui-react/src/components/flightboard/FlightboardRow.js @@ -14,16 +14,22 @@ class FlightboardRow extends Component { } getAppointmentTime = () => { - const { item, now } = this.props; + const { room, now } = this.props; - // check if there are times in the item.Start & item.End + // check if there are times in the room.Start & room.End // then: if the meeting is not going on now, append "Next Up: " - if (typeof item.Appointments !== 'undefined' && item.Appointments.length > 0) { - if (item.Appointments[0].Start && item.Appointments[0].End) { + if (typeof room.Appointments !== 'undefined' && room.Appointments.length > 0) { + if (room.Appointments[0].Start && room.Appointments[0].End) { this.setState({ timesPresent: true }); - if (item.Appointments[0].Start < now && now < item.Appointments[0].End) { } else { + + if (room.Busy) { + this.setState({ + nextUp: '' + }); + } + else { this.setState({ nextUp: fbConfig.board.nextUp + ': ' }); @@ -38,7 +44,7 @@ class FlightboardRow extends Component { render() { const { nextUp, timesPresent } = this.state; - const { item, now } = this.props; + const { room, now } = this.props; const styles = { show: {display: 'block'}, @@ -46,21 +52,21 @@ class FlightboardRow extends Component { flex: {display: 'flex'} } - const room = item.Name.toLowerCase().replace(/\s+/g, "-"); - const roomlist = 'roomlist-' + item.Roomlist.toLowerCase().replace(/\s+/g, "-"); + const roomName = room.Name.toLowerCase().replace(/\s+/g, "-"); + const roomlist = 'roomlist-' + room.Roomlist.toLowerCase().replace(/\s+/g, "-"); // set row class based on meet room status - let meetingRoomClass = `${ room } meeting-room ${ item.Busy ? 'meeting-room-busy' : '' }`; - meetingRoomClass += item.Busy ? ' meeting-room-busy' : ''; - meetingRoomClass += item.ErrorMessage ? ' meeting-room-error' : ''; - const meetingClass = item.ErrorMessage + let meetingRoomClass = `${ roomName } meeting-room ${ room.Busy ? 'meeting-room-busy' : '' }`; + meetingRoomClass += room.Busy ? ' meeting-room-busy' : ''; + meetingRoomClass += room.ErrorMessage ? ' meeting-room-error' : ''; + const meetingClass = room.ErrorMessage ? 'meeting-error' - : item.Busy + : room.Busy ? 'meeting-busy' : 'meeting-open'; - let statusText = item.ErrorMessage + let statusText = room.ErrorMessage ? fbConfig.board.statusError - : item.Busy + : room.Busy ? fbConfig.board.statusBusy : fbConfig.board.statusAvailable; @@ -70,45 +76,45 @@ class FlightboardRow extends Component {
-
-
+
+
{statusText}
-
- {item.Name} +
+ {room.Name}
-
- {timesPresent && item.Appointments[0].End >= now && +
+ {timesPresent && room.Appointments[0].End >= now &&
- + {nextUp} - - {item.Appointments[0].Subject} + + {room.Appointments[0].Subject}
}
-
+
{timesPresent ? - new Date(parseInt(item.Appointments[0].Start, 10)).toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'}) + ' - ' + new Date(parseInt(item.Appointments[0].End, 10)).toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'}) + new Date(parseInt(room.Appointments[0].Start, 10)).toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'}) + ' - ' + new Date(parseInt(room.Appointments[0].End, 10)).toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'}) : '' }
-
- {timesPresent && item.Appointments[0].End >= now && - item.Appointments[0].Organizer +
+ {timesPresent && room.Appointments[0].End >= now && + room.Appointments[0].Organizer }
- + @@ -124,7 +130,7 @@ class FlightboardRow extends Component { } FlightboardRow.propTypes = { - item: PropTypes.string, + room: PropTypes.string, now: PropTypes.instanceOf(Date), key: PropTypes.number, filter: PropTypes.string diff --git a/ui-react/src/components/single-room/Display.js b/ui-react/src/components/single-room/Display.js index 93dc7df..6f47a89 100644 --- a/ui-react/src/components/single-room/Display.js +++ b/ui-react/src/components/single-room/Display.js @@ -78,6 +78,14 @@ class Display extends Component { } })); } + else { + this.setState(prevState => ({ + roomDetails: { + ...prevState.roomDetails, + nextUp: '' + } + })); + } } }