diff --git a/frontend/src/components/adminPanel/AdminPanel.jsx b/frontend/src/components/adminPanel/AdminPanel.jsx index a90f68a..ba6c5d3 100644 --- a/frontend/src/components/adminPanel/AdminPanel.jsx +++ b/frontend/src/components/adminPanel/AdminPanel.jsx @@ -8,6 +8,7 @@ import { } from "../../services/api"; import DocumentUpload from "../documentUpload/DocumentUpload"; import { useNavigate } from "react-router-dom"; +import { motion } from "framer-motion"; import { FiUsers, FiFile, @@ -16,8 +17,10 @@ import { FiLoader, FiKey, } from "react-icons/fi"; +import { useRef } from "react"; function AdminPanel() { + const createUserFormRef = useRef(null); const navigate = useNavigate(); const [activeTab, setActiveTab] = useState("documents"); const [users, setUsers] = useState([]); @@ -87,15 +90,17 @@ function AdminPanel() { e.preventDefault(); try { await createUser(newUser); + fetchData(); + } catch (err) { + setError("Failed to create user"); + } finally { + // setNewUser(initialUserFormState); setNewUser({ name: "", email: "", password: "", isAdmin: false, }); - fetchData(); - } catch (err) { - setError("Failed to create user"); } }; @@ -123,9 +128,9 @@ function AdminPanel() { if (!isAdmin) return null; const tabs = [ - { id: "documents", name: "Documents", icon: FiFile }, - { id: "users", name: "Users", icon: FiUsers }, - { id: "upload", name: "Upload Document", icon: FiUpload }, + { id: "documents", name: "Документи", icon: FiFile }, + { id: "users", name: "Клиенти", icon: FiUsers }, + { id: "upload", name: "Прикачи документ", icon: FiUpload }, ]; if (loading) { @@ -146,9 +151,13 @@ function AdminPanel() {
Manage users and documents
+Клиенти и доументи
- + {/*| - Title - | -- Status - | -- Uploaded By - | -- Shared With - | -- Created At - | -||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {doc.title} | -
+
+
+
| */}
+ + {doc.uploadedBy?.name} ({doc.uploadedBy?.email}) + | +
+ {doc.sharedWith && doc.sharedWith.length > 0
+ ? doc.sharedWith.map((user) => (
+
+ {user.name} ({user.email})
+
+ ))
+ : "None"}
+ |
+ + {new Date(doc.createdAt).toLocaleString()} + | +
Access and manage your shared documents
++ {/* Access and manage your shared documents */} +
No documents available
Share documents with your clients
+ {/*Share documents with your clients
*/}