From 4b1e9055c80b5dc400b0c230ba40b5c93d08735c Mon Sep 17 00:00:00 2001 From: Kai Nguyen Date: Sat, 18 Nov 2023 21:09:07 +0700 Subject: [PATCH] enhance predict feature and add nginx for UI --- client/main.js | 23 ++++++++++++++--------- client/style.css | 8 ++++++++ nginx/default.conf | 21 +++++++++++++++++++++ 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/client/main.js b/client/main.js index 34a3796..c2aecde 100644 --- a/client/main.js +++ b/client/main.js @@ -1,5 +1,5 @@ -const API_URL = "https://api.airchecker.online"; -const PREDICT_URL = "http://localhost:8081"; +const API_URL = "http://api.airqual.tech"; +const PREDICT_URL = "http://predict.airqual.tech"; // const API_URL = "http://localhost"; // const PREDICT_URL = "http://localhost:8081"; @@ -585,7 +585,7 @@ $(function () { title: "View detail pollutants", }, forecast: { - title: "Next 2 days forecast", + title: "Forecast today and tomorrow", aqi: "Air Quality Index", }, }, @@ -609,7 +609,7 @@ $(function () { title: "Xem chi tiết chất ô nhiễm", }, forecast: { - title: "Dự báo 2 ngày tới", + title: "Dự báo hôm nay và ngày mai", aqi: "Chỉ số chất lượng không khí", }, }, @@ -673,10 +673,15 @@ function langBoxOnClick(event) { aqiDescription.innerHTML = aqiInfoLanguage[aqiLevel.classList[0]][chosenLng]["description"]; - var forecastAqiLevel = document.getElementById("forecast-level"); + // FORECAST + var forecastAqiLevels = document.getElementsByClassName("forecast-level"); - forecastAqiLevel.innerHTML = - aqiInfoLanguage[forecastAqiLevel.classList[0]][chosenLng][ - "levelsOfConcern" - ]; + for (const forecastAqiLevel of forecastAqiLevels) { + let length = forecastAqiLevel.classList.length; + + forecastAqiLevel.children[0].innerHTML = + aqiInfoLanguage[forecastAqiLevel.classList[length - 1]][chosenLng][ + "levelsOfConcern" + ]; + } } diff --git a/client/style.css b/client/style.css index ff3c0ac..c6762e7 100644 --- a/client/style.css +++ b/client/style.css @@ -35,6 +35,7 @@ h6 { height: fit-content; padding: 32px 0px; border-radius: 16px; + margin-bottom: 32px; } section { @@ -228,9 +229,16 @@ h1 { .forecast > .inner-wrap { width: 100%; +} + +.forecast > .inner-wrap:first-child { margin-bottom: 2em; } +.forecast > .inner-wrap:last-child { + margin-top: 2em; +} + .forecast-box { display: flex; justify-content: space-between; diff --git a/nginx/default.conf b/nginx/default.conf index 21f01cb..dcd85eb 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -53,4 +53,25 @@ server { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } +} + +server { + listen 80; + + server_name airqual.tech; + + location / { + root /app/client; + index index.html; + + location /assets { + alias /app/client/assets; + autoindex on; + } + + location /scripts { + alias /app/client/scripts; + autoindex on; + } + } } \ No newline at end of file