diff --git a/app/components/UnsavedChangesWarning.js b/app/components/UnsavedChangesWarning.js
new file mode 100644
index 0000000..1256d1e
--- /dev/null
+++ b/app/components/UnsavedChangesWarning.js
@@ -0,0 +1,22 @@
+"use client";
+
+import { useEffect } from "react";
+
+const UnsavedChangesWarning = () => {
+ useEffect(() => {
+ const handleBeforeUnload = (event) => {
+ event.preventDefault();
+ event.returnValue = ""; // Современные браузеры требуют, чтобы значение было пустой строкой
+ };
+
+ window.addEventListener("beforeunload", handleBeforeUnload);
+
+ return () => {
+ window.removeEventListener("beforeunload", handleBeforeUnload);
+ };
+ }, []);
+
+ return null;
+};
+
+export default UnsavedChangesWarning;
diff --git a/app/questionnaire/layout.jsx b/app/questionnaire/layout.jsx
index d27fea9..503dae7 100644
--- a/app/questionnaire/layout.jsx
+++ b/app/questionnaire/layout.jsx
@@ -12,7 +12,7 @@ import FormNavigationButton from "../components/FormNavigationButton";
import Building from "../model/Building";
import monthlyDurationIntervals from "../model/reference-data/monthlyDurationIntervals";
import CustomAppBar from "../components/MyAppBar";
-import Background from "../components/Background";
+import UnsavedChangesWarning from "../components/UnsavedChangesWarning";
const steps = [
{
@@ -156,6 +156,7 @@ export default function QuestionnaireLayout({ children }) {
return (
<>
+
{
+ <>
+
+
+
+
+
+ >
);
}