diff --git a/UpNext.md b/UpNext.md index 9fcb79f..f76d9ab 100644 --- a/UpNext.md +++ b/UpNext.md @@ -3,12 +3,5 @@ * Backend - Add Indexes: - "stations": 3ALPHA, STANOX, TIPLOC - "corpus": 3ALPHA, NLC, NLCDESC(TEXT) -* Backend - Tidy up nrcc messages. Remove `

` and `\n`. -* Frontend - Implement paginated NRCC Notices as they take up lots of space. - - Carousel: https://www.section.io/engineering-education/how-to-make-an-image-carousel-for-your-website/ - - "Active Alerts" dropdown accordian? -* Frontend - If Ferry Services Present - Load at bottom of screen. -* Frontend - Decide what to do with Bus Services. -* Frontend - Implement error pages - will need to look at including these on the proxy container too? - - https://expressjs.com/en/guide/error-handling.html -* Building - Implement build process in dockerfile that minifies and then compresses the static source. \ No newline at end of file +* Backend - The list of services should always be an array [] as per the NRCC MEssages. +* Frontend - Implement error pages \ No newline at end of file diff --git a/static/board.html b/static/board.html index 17e613d..27ae136 100644 --- a/static/board.html +++ b/static/board.html @@ -38,9 +38,8 @@

There are no active alerts

- +
-

\nThe lifts are out of order between Platforms 1 & 2 and the station at Cardiff Central station.

","\nDisruption in the Bristol area due to a number of incidents. More details can be found in Latest Travel News.","\nBuses replace trains between Radyr and Cardiff Central. More details can be found in Latest Travel News.","\nPoor weather affecting services in Wales due to flooding on the railway More details can be found in Latest Travel News.","Poor weather affecting services across the South West of England. More details can be found in Latest Travel News
diff --git a/static/js/boards.js b/static/js/boards.js index 6b7e37c..f2712af 100644 --- a/static/js/boards.js +++ b/static/js/boards.js @@ -55,6 +55,10 @@ async function parseTime(string){ var output = "-"; var change = ""; break; + case "No report": + var output = "?"; + var change = ""; + break; default: var output = string; var change = "changed"; @@ -68,14 +72,30 @@ async function parseName() { } // Display Alert Messages -async function displayAlerts() { +async function displayAlerts(array) { + var counter = 0 + for(var i = 0; i < array.length; i++) { + // Increment counter + counter += 1; + // Reset Vars + var msg = array[i]; + console.log(`Alert: ${msg}`); + document.getElementById("alerts_msg").insertAdjacentHTML("beforeend", `

${msg}

`); + } + document.getElementById("alert_number").innerHTML = `${counter}` + document.getElementById("alerts").style = "display:block" + document.getElementById("alerts_bar").style = "display:block" document.getElementById("output").style = "margin-top:95px" // Adjust margin of train table div. } -async function expandAlerts() { - return +async function inflateAlerts() { + document.getElementById("alerts_msg").style = "display:block;"; + document.getElementById("alert_expand_arrow").style = "transform: rotate(180deg);"; + document.getElementById("alert_expand_arrow").setAttribute("onclick", "deflateAlerts()") } async function deflateAlerts() { - return + document.getElementById("alerts_msg").style = "display.none;"; + document.getElementById("alert_expand_arrow").style = "transform: rotate(0deg);"; + document.getElementById("alert_expand_arrow").setAttribute("onclick", "inflateAlerts()") } \ No newline at end of file diff --git a/static/js/public-board.js b/static/js/public-board.js index 248172a..3795cba 100644 --- a/static/js/public-board.js +++ b/static/js/public-board.js @@ -61,7 +61,7 @@ async function buildPage(data) { setHeaders(stationName, generateTime); // Check for notices and if true pass to function if (data.GetStationBoardResult.nrccMessages) { - displayNotices(data.GetStationBoardResult.nrccMessages.message) + displayAlerts(data.GetStationBoardResult.nrccMessages.message); } if (typeof data.GetStationBoardResult.trainServices == 'undefined') { displayNoTrains() @@ -73,14 +73,6 @@ async function buildPage(data) { } } -async function displayNotices(notices) { - // Input: data.GetStationBoardResult.nrccMessages.messages - // Processing: For each message, create a

inside #notices. - // If there is more than one notice, scroll between them. - // Output: Only to DOM. - //document.getElementById("notices").innerHTML = notices; -} - async function displayNoTrains() { document.getElementById('no_services').style = "display: block;"; clearLoading(); diff --git a/static/styles/boards.css b/static/styles/boards.css index e27323b..3783052 100644 --- a/static/styles/boards.css +++ b/static/styles/boards.css @@ -71,6 +71,7 @@ /* NRCC Notices */ #alerts{ + display: none; position: fixed; width: 100%; left: 0; @@ -78,6 +79,7 @@ } #alerts_bar{ + display: none; position: absolute; margin-top:50px; left: 0; @@ -109,25 +111,34 @@ top: 0; padding: 10px; padding-right: 15px; - padding-left: 30px; + padding-left: 15px; background: none; border: none; font-weight: 900; color: white; + transition: transform 0.25s linear; } #alerts_msg{ + display: none; position: absolute; left: 0; top: 40px; width: 100%; - background-color: pink; + background-color: orange; +} + +#alerts_msg p { + width: 90%; + margin-left: auto; + margin-right: auto; + font-weight: 900; } /* Content */ #output { width: 100%; - margin-top: 95px; /* SHOULD BE REMOVED AFTER IMPLEMENTING ALERTS */ + margin-top: 65px; } table {