diff --git a/.vscode/settings.json b/.vscode/settings.json
index 78664b2..40b6bfb 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,5 @@
{
- "editor.tabSize": 2
+ "editor.tabSize": 2,
+ "editor.formatOnSave": true,
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
}
diff --git a/package.json b/package.json
index 0d91867..d8f4e3c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "weather-here",
- "version": "0.1.0",
+ "version": "1.1.0",
"private": true,
"dependencies": {
"react": "^16.8.6",
@@ -47,4 +47,4 @@
"react-app-rewired": "^2.1.3",
"workbox-webpack-plugin": "^4.3.1"
}
-}
+}
\ No newline at end of file
diff --git a/public/service-worker.js b/public/service-worker.js
index 4d42de7..002316d 100644
--- a/public/service-worker.js
+++ b/public/service-worker.js
@@ -5,6 +5,7 @@ if (workbox) {
workbox.routing.registerRoute(new RegExp('/images/backgrounds/'), new workbox.strategies.StaleWhileRevalidate());
workbox.routing.registerRoute(new RegExp('/favicon.png'), new workbox.strategies.StaleWhileRevalidate());
workbox.routing.registerRoute(/\.(?:js|css|html)$/, new workbox.strategies.StaleWhileRevalidate());
+ workbox.routing.registerRoute('/version.json', new workbox.strategies.NetworkFirst());
} else {
console.log(`Boo! Workbox didn't load 😬`);
}
diff --git a/public/version.json b/public/version.json
new file mode 100644
index 0000000..4ff917b
--- /dev/null
+++ b/public/version.json
@@ -0,0 +1 @@
+"1.1.0"
\ No newline at end of file
diff --git a/src/App.css b/src/App.css
index 4cd8606..d7fba77 100644
--- a/src/App.css
+++ b/src/App.css
@@ -337,6 +337,39 @@ footer a:active {
text-shadow: none;
}
+.updateBanner {
+ display: flex;
+ position: fixed;
+ background: rgba(0, 0, 0, 0.85);
+ padding: 10px;
+ left: 0;
+ right: 0;
+ justify-content: center;
+ align-items: center;
+ font-weight: bold;
+ color: hotpink;
+ top: auto;
+ bottom: 0;
+ z-index: 2;
+}
+
+.updateBanner .refresh-btn {
+ padding: 5px 15px;
+ border-radius: 15px;
+ font-size: 1.1em;
+ color: white;
+ background-color: teal;
+ font-weight: bold;
+ border: none;
+ margin-left: 10px;
+ box-sizing: border-box;
+}
+
+.updateBanner .refresh-btn:hover,
+.updateBanner .refresh-btn:focus {
+ background-color: darkgreen;
+}
+
@media (max-width: 740px) {
main {
padding-top: 5em;
diff --git a/src/App.jsx b/src/App.jsx
index fc562fe..c7fe324 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -8,6 +8,8 @@ import { fromCtoF, fromFtoC } from './helpers/tempHelper';
import useFetchTemp from './hooks/useFetchTemp';
import useBgImageURL from './hooks/useBgImageURL';
import useAQI from './hooks/useAQI';
+import useVersionInfo from './hooks/useVersionInfo';
+import AppUpdateBanner from './Components/AppUpdateBanner';
const { useState, Fragment } = React;
@@ -21,6 +23,7 @@ export default function App(props) {
const [upcomingFilter, setUpcomingFilter] = useState(null);
const [mainTransform, setTransform] = useState(null);
const { aqi, cityName } = useAQI(location);
+ const { isUpToDate } = useVersionInfo();
const handleUnitChange = () => {
if (temp !== '---') {
@@ -48,6 +51,7 @@ export default function App(props) {