+ className="absolute top-[25%] left-1/2 transform -translate-x-1/2 bg-white p-10 rounded-xl shadow-2xl w-[clamp(280px,30vw,400px)] h-[clamp(500px,55vh,90vh)]">
Logowanie
administratora systemów
diff --git a/web_app/src/SystemAdmin/SystemAdminSettings.tsx b/web_app/src/SystemAdmin/SystemAdminSettings.tsx
new file mode 100644
index 00000000..d0da3cde
--- /dev/null
+++ b/web_app/src/SystemAdmin/SystemAdminSettings.tsx
@@ -0,0 +1,147 @@
+import React, {useState} from 'react';
+import {useNavigate} from 'react-router-dom';
+
+const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
+
+const SystemAdminSettings: React.FC = () => {
+ const [oldPassword, setOldPassword] = useState('');
+ const [newPassword, setNewPassword] = useState('');
+ const [repeatPassword, setRepeatPassword] = useState('');
+ const [message, setMessage] = useState('');
+ const [error, setError] = useState('');
+
+ const handleChangePassword = async (e: React.FormEvent) => {
+ e.preventDefault();
+ setMessage('');
+ setError('');
+
+ if (newPassword !== repeatPassword) {
+ setError('Hasła nie pasują do siebie.');
+ return;
+ }
+
+ try {
+ const token = localStorage.getItem('access_token');
+ if (!token) throw new Error('Brak tokenu autoryzacyjnego.');
+
+ const response = await fetch(`${API_BASE_URL}/api/users/change-password`, {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${token}`,
+ },
+ body: JSON.stringify({
+ oldPassword,
+ newPassword,
+ }),
+ });
+
+ const text = await response.text();
+
+ if (!response.ok) {
+ const errorData = text ? JSON.parse(text) : { message: 'Błąd zmiany hasła' };
+ throw new Error(errorData.message);
+ }
+
+ setMessage('Hasło zostało zmienione.');
+ setOldPassword('');
+ setNewPassword('');
+ setRepeatPassword('');
+ } catch (err: unknown) {
+ if (err instanceof Error) {
+ setError(err.message);
+ } else {
+ setError('Wystąpił nieznany błąd.');
+ }
+ }
+ };
+
+ const navigate = useNavigate();
+
+ function handleReturn() {
+ navigate('/system-admin-dashboard');
+ }
+
+ return (
+
+
+
+

+
+
+
+
+ );
+};
+
+export default SystemAdminSettings;
diff --git a/web_app/src/Librarian/useWebSocketNewOrderNotification.tsx b/web_app/src/Utils/useWebSocketNotification.tsx
similarity index 97%
rename from web_app/src/Librarian/useWebSocketNewOrderNotification.tsx
rename to web_app/src/Utils/useWebSocketNotification.tsx
index f44ed0e3..649e3e85 100644
--- a/web_app/src/Librarian/useWebSocketNewOrderNotification.tsx
+++ b/web_app/src/Utils/useWebSocketNotification.tsx
@@ -1,6 +1,6 @@
import { useEffect, useRef } from "react";
-export function useWebSocketNewOrderNotification(
+export function useWebSocketNotification(
channel: string,
onMessage: (msg: string) => void
) {