diff --git a/src/app.jsx b/src/app.jsx
index 1c4bbf0..43285c6 100644
--- a/src/app.jsx
+++ b/src/app.jsx
@@ -6,10 +6,10 @@ import { ReloadPrompt } from './components/reloadprompt';
export function App() {
return (
<>
+
-
>
);
}
diff --git a/src/components/calculator.jsx b/src/components/calculator.jsx
index ae8d23a..67e63b0 100644
--- a/src/components/calculator.jsx
+++ b/src/components/calculator.jsx
@@ -28,7 +28,7 @@ export function Calculator() {
useEffect(() => {
setSelectedItem(items[0]);
setTableType(TableType.MODERN);
- }, [items, tables]);
+ }, [items]);
const showResultsPanel = () => setResultsVisible(!resultsVisible);
diff --git a/src/components/reloadprompt.json b/src/components/reloadprompt.json
new file mode 100644
index 0000000..60a2f62
--- /dev/null
+++ b/src/components/reloadprompt.json
@@ -0,0 +1,8 @@
+{
+ "text": {
+ "offlineReady": "Aplikacja gotowa do pracy offline",
+ "contentRefresh": "Dostępna jest nowa wersja aplikacji, kliknij guzik \"Przeładuj\" aby ją odświeżyć",
+ "reloadButton": "Przeładuj",
+ "closeButton": "Zamknij"
+ }
+}
diff --git a/src/components/reloadprompt.jsx b/src/components/reloadprompt.jsx
new file mode 100644
index 0000000..0f48b10
--- /dev/null
+++ b/src/components/reloadprompt.jsx
@@ -0,0 +1,47 @@
+import { useRegisterSW } from 'virtual:pwa-register/react';
+
+import { text } from './reloadprompt.json';
+
+export function ReloadPrompt() {
+ const {
+ offlineReady: [offlineReady, setOfflineReady],
+ needRefresh: [needRefresh, setNeedRefresh],
+ updateServiceWorker,
+ } = useRegisterSW({
+ onRegistered(r) {
+ console.log(`SW Registered: ${r}`);
+ },
+ onRegisterError(error) {
+ console.log('SW registration error', error);
+ },
+ });
+
+ const close = () => {
+ setOfflineReady(false);
+ setNeedRefresh(false);
+ };
+
+ return (
+ <>
+ {(offlineReady || needRefresh) && (
+
+ {offlineReady ? {text.offlineReady}
: {text.contentRefresh}
}
+
+ {needRefresh && (
+
+
+
+ )}
+
+
+
+
+
+ )}
+ >
+ );
+}
diff --git a/src/components/reloadprompt.module.css b/src/components/reloadprompt.module.css
deleted file mode 100644
index ff0ae5b..0000000
--- a/src/components/reloadprompt.module.css
+++ /dev/null
@@ -1,32 +0,0 @@
-.ReloadPromptContainer {
- padding: 0;
- margin: 0;
- width: 0;
- height: 0;
-}
-
-.ReloadPromptToast {
- position: fixed;
- right: 0;
- bottom: 0;
- margin: 16px;
- padding: 12px;
- border: 1px solid #8885;
- border-radius: 4px;
- z-index: 1;
- text-align: left;
- box-shadow: 3px 4px 5px 0 #8885;
- background-color: white;
-}
-
-.ReloadPromptToastMessage {
- margin-bottom: 8px;
-}
-
-.ReloadPromptToastButton {
- border: 1px solid #8885;
- outline: none;
- margin-right: 5px;
- border-radius: 2px;
- padding: 3px 10px;
-}
diff --git a/src/components/reloadprompt.tsx b/src/components/reloadprompt.tsx
deleted file mode 100644
index 0852815..0000000
--- a/src/components/reloadprompt.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-import React from 'react';
-import styles from './reloadprompt.module.css';
-
-import { useRegisterSW } from 'virtual:pwa-register/react';
-
-export function ReloadPrompt() {
- const {
- offlineReady: [offlineReady, setOfflineReady],
- needRefresh: [needRefresh, setNeedRefresh],
- updateServiceWorker,
- } = useRegisterSW({
- onRegistered(r) {
- // eslint-disable-next-line prefer-template
- console.log('SW Registered: ' + r);
- },
- onRegisterError(error) {
- console.log('SW registration error', error);
- },
- });
-
- const close = () => {
- setOfflineReady(false);
- setNeedRefresh(false);
- };
-
- return (
-
- {(offlineReady || needRefresh) && (
-
-
- {offlineReady ? (
- App ready to work offline
- ) : (
- New content available, click on reload button to update.
- )}
-
- {needRefresh && (
-
- )}
-
-
- )}
-
- );
-}
diff --git a/src/style.scss b/src/style.scss
index 551c9e0..f15d4fa 100644
--- a/src/style.scss
+++ b/src/style.scss
@@ -12,3 +12,7 @@ footer > div.grid > div {
color: darkgoldenrod;
font-weight: bold;
}
+
+.autowidth {
+ width: auto;
+}