eleven-solutions-common-website-unique-web 1.0.29 → 1.0.31
Sign up to get free protection for your applications and to get access to all the features.
@@ -25,13 +25,13 @@ function Users() {
|
|
25
25
|
useEffect(() => {
|
26
26
|
fetchUsersData();
|
27
27
|
}, []);
|
28
|
-
const handleNav = (e) => {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
};
|
28
|
+
// const handleNav = (e: React.FormEvent) => {
|
29
|
+
// e.preventDefault();
|
30
|
+
// window.history.pushState({}, "", "/admin/users/userform");
|
31
|
+
// // Trigger React's routing logic manually if required
|
32
|
+
// const navEvent = new PopStateEvent("popstate");
|
33
|
+
// window.dispatchEvent(navEvent);
|
34
|
+
// };
|
35
35
|
const [currentPage, setCurrentPage] = useState(1);
|
36
36
|
const itemsPerPage = 10;
|
37
37
|
const totalPages = Math.ceil(users.length / itemsPerPage);
|
@@ -71,6 +71,8 @@ function Users() {
|
|
71
71
|
window.location.href = `/admin/users/userform?id=${user.id}`; // Manually navigate
|
72
72
|
}, children: _jsx("button", { className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" }) }) }) })] }) }), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-700 whitespace-nowrap", children: _jsx("div", { className: "inline-flex items-center gap-x-3", children: _jsx("div", { className: "flex items-center gap-x-2", children: _jsx("div", { children: _jsx("h2", { className: " text-sm font-medium text-gray-800 dark:text-white ", children: user.name }) }) }) }) }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: user.email }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: (user === null || user === void 0 ? void 0 : user.mobile) || "Not Provided" }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: (user === null || user === void 0 ? void 0 : user.address) || "Not Provided" }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: user.roleType === "1" ? "Guest" : "Admin" })] }, user.id || index))) })] }) }), _jsxs("div", { className: "flex items-center justify-between mt-6", children: [_jsxs("button", { onClick: handlePreviousPage, disabled: currentPage === 1, className: "flex items-center px-5 py-2 text-sm text-gray-700 capitalize transition-colors duration-200 bg-white border rounded-md gap-x-2 hover:bg-gray-100 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800", children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5 rtl:-scale-x-100", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M6.75 15.75L3 12m0 0l3.75-3.75M3 12h18" }) }), _jsx("span", { children: "previous" })] }), _jsx("div", { className: "items-center hidden lg:flex gap-x-3", children: Array.from({ length: totalPages }, (_, index) => (_jsx("button", { onClick: () => handlePageClick(index + 1), className: `px-2 py-1 text-sm ${currentPage === index + 1
|
73
73
|
? "text-blue-500 bg-blue-100"
|
74
|
-
: "text-gray-500 hover:bg-gray-100"} rounded-md`, children: index + 1 }, index + 1))) }), _jsxs("button", { onClick: handleNextPage, disabled: currentPage === totalPages, className: "flex items-center px-5 py-2 text-sm text-gray-700 capitalize transition-colors duration-200 bg-white border rounded-md gap-x-2 hover:bg-gray-100 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800", children: [_jsx("span", { children: "Next" }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5 rtl:-scale-x-100", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3" }) })] })] }), _jsx("div", { className: "flex-grow ml-0 mt-4 w-0", children: _jsxs("button", { type: "button",
|
74
|
+
: "text-gray-500 hover:bg-gray-100"} rounded-md`, children: index + 1 }, index + 1))) }), _jsxs("button", { onClick: handleNextPage, disabled: currentPage === totalPages, className: "flex items-center px-5 py-2 text-sm text-gray-700 capitalize transition-colors duration-200 bg-white border rounded-md gap-x-2 hover:bg-gray-100 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800", children: [_jsx("span", { children: "Next" }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5 rtl:-scale-x-100", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3" }) })] })] }), _jsx("div", { className: "flex-grow ml-0 mt-4 w-0", children: _jsxs("button", { type: "button",
|
75
|
+
// onClick={handleNav}
|
76
|
+
className: "flex items-center justify-center px-6 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-300 transform bg-blue-600 rounded-lg hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80", children: [_jsx(FaPlus, { className: "mr-2 font-medium" }), "User"] }) })] })] }));
|
75
77
|
}
|
76
78
|
export default Users;
|
package/package.json
CHANGED
@@ -4,6 +4,7 @@ import { useState, useEffect } from "react";
|
|
4
4
|
import { FaPlus } from "react-icons/fa";
|
5
5
|
|
6
6
|
import { fetchUsersApi, deleteUserApi } from "../api/user";
|
7
|
+
|
7
8
|
function Users() {
|
8
9
|
const [users, setUsers] = useState<any[]>([]);
|
9
10
|
|
@@ -19,14 +20,14 @@ function Users() {
|
|
19
20
|
useEffect(() => {
|
20
21
|
fetchUsersData();
|
21
22
|
}, []);
|
22
|
-
const handleNav = (e: React.FormEvent) => {
|
23
|
-
|
24
|
-
|
23
|
+
// const handleNav = (e: React.FormEvent) => {
|
24
|
+
// e.preventDefault();
|
25
|
+
// window.history.pushState({}, "", "/admin/users/userform");
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
};
|
27
|
+
// // Trigger React's routing logic manually if required
|
28
|
+
// const navEvent = new PopStateEvent("popstate");
|
29
|
+
// window.dispatchEvent(navEvent);
|
30
|
+
// };
|
30
31
|
|
31
32
|
const [currentPage, setCurrentPage] = useState(1);
|
32
33
|
const itemsPerPage = 10;
|
@@ -339,7 +340,7 @@ function Users() {
|
|
339
340
|
</a> */}
|
340
341
|
<button
|
341
342
|
type="button"
|
342
|
-
onClick={handleNav}
|
343
|
+
// onClick={handleNav}
|
343
344
|
className="flex items-center justify-center px-6 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-300 transform bg-blue-600 rounded-lg hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80"
|
344
345
|
>
|
345
346
|
<FaPlus className="mr-2 font-medium" />
|