From c73cf2d40eb7297614165f2044f2f147ba9c4acb Mon Sep 17 00:00:00 2001 From: Joseph Le Date: Fri, 27 Feb 2026 12:54:34 +1100 Subject: [PATCH] Update UI page manage value --- .../src/components/ListLog/ListLog.jsx | 5 +- manage-view/src/pages/ManageValues.css | 147 ++++++++ manage-view/src/pages/ManageValues.jsx | 341 ++++++++---------- 3 files changed, 302 insertions(+), 191 deletions(-) create mode 100644 manage-view/src/pages/ManageValues.css diff --git a/manage-view/src/components/ListLog/ListLog.jsx b/manage-view/src/components/ListLog/ListLog.jsx index 4fff0c1..b72a93c 100644 --- a/manage-view/src/components/ListLog/ListLog.jsx +++ b/manage-view/src/components/ListLog/ListLog.jsx @@ -98,8 +98,11 @@ const ListLog = () => { placeholder="Search file..." value={nameSearch} onChange={(e) => setNameSearch(e.target.value)} + onKeyDown={(key) => { + if (key.keyCode === 13 || key.key === "Enter") getListFile(1) + }} /> - diff --git a/manage-view/src/pages/ManageValues.css b/manage-view/src/pages/ManageValues.css new file mode 100644 index 0000000..f0872eb --- /dev/null +++ b/manage-view/src/pages/ManageValues.css @@ -0,0 +1,147 @@ +body { + background: #f4f6f9; + font-family: "Segoe UI", sans-serif; +} + +.manageContainer { + display: flex; + justify-content: center; + padding: 30px; +} + +.card { + width: 90%; + max-width: 1200px; + background: white; + border-radius: 12px; + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); + padding: 25px; +} + +.cardHeader { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; +} + +.tableWrapper { + height: 70vh; + overflow-y: auto; + border: 1px solid #d8d8d8; + border-radius: 8px; +} + +.modernTable { + width: 100%; + border-collapse: collapse; +} + +.modernTable thead th { + position: sticky; + top: 0; + background: #f9fafb; + padding: 12px; + text-align: left; + border-bottom: 1px solid #d8d8d8; +} + +.modernTable tbody td { + padding: 10px 12px; + border-bottom: 1px solid #d8d8d8; +} + +.modernTable tbody tr:hover { + background: #f9fafb; +} + +.keyCell { + font-weight: 600; + color: #1f2937; +} + +.input { + width: 100%; + padding: 6px 10px; + border-radius: 6px; + border: 1px solid #d1d5db; + outline: none; +} + +.input:focus { + border-color: #2563eb; + box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); +} + +.actionGroup { + display: flex; + gap: 8px; +} + +.btn { + padding: 6px 12px; + border: none; + border-radius: 6px; + cursor: pointer; + font-weight: 500; + transition: 0.2s; + width: 70px; +} + +.btn.primary { + background: #2563eb; + color: white; +} + +.btn.success { + background: #16a34a; + color: white; +} + +.btn.warning { + background: #f59e0b; + color: white; +} + +.btn.danger { + background: #dc2626; + color: white; +} + +.btn:hover { + opacity: 0.9; +} + +.addSection { + margin-top: 20px; + display: flex; + gap: 10px; + justify-content: center; +} + +.isDisabled { + pointer-events: none; + opacity: 0.7; + -moz-user-focus: none; + -webkit-user-focus: none; + -ms-user-focus: none; + -moz-user-modify: read-only; + -webkit-user-modify: read-only; + -ms-user-modify: read-only; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: not-allowed; +} + +.btnLogs { + padding: 6px 12px; + border: none; + border-radius: 6px; + cursor: pointer; + font-weight: 500; + transition: 0.2s; + background: #2563eb; + color: white; +} \ No newline at end of file diff --git a/manage-view/src/pages/ManageValues.jsx b/manage-view/src/pages/ManageValues.jsx index f184a8e..2048b70 100644 --- a/manage-view/src/pages/ManageValues.jsx +++ b/manage-view/src/pages/ManageValues.jsx @@ -1,214 +1,175 @@ import axios from "axios"; import React, { useEffect, useState } from "react"; -import { addKeyValue, deleteValue, editValue, getKeyValues } from "../api/apiLog"; +import { + addKeyValue, + deleteValue, + editValue, + getKeyValues, +} from "../api/apiLog"; import { Link } from "react-router-dom"; +import "./ManageValues.css"; + const ManageValues = () => { const [keyValue, setKeyValue] = useState([]); const [key, setKey] = useState([]); - const [addValue, setAddValue] = useState({ key: "CATCH_FAULTY", value: "" }); - const [inputSelect, setInpuSelect] = useState(0) - const [inputValue, setInputValue] = useState("") + const [addValue, setAddValue] = useState({ + key: "CATCH_FAULTY", + value: "", + }); + const [editingId, setEditingId] = useState(null); + const [inputValue, setInputValue] = useState(""); + const [isDisabled, setIsDisabled] = useState(false); + const getValues = async () => { - try { - const res = await axios.post(getKeyValues); - setKeyValue(res.data.sort((a, b) => a.key.localeCompare(b.key))); - setKey(res.data?.map((obj) => obj.key)); - } catch (error) { - console.log(error); - } + const res = await axios.post(getKeyValues); + setKeyValue(res.data.sort((a, b) => a.key.localeCompare(b.key))); + setKey(res.data?.map((obj) => obj.key)); }; useEffect(() => { getValues(); }, []); - console.log(inputValue) + return ( -
-
- - - - - - - - - - {keyValue?.map((value) => ( - - - - - - +
+
+
+
- Key - - Value - - Option -
{value.key} - { - setInputValue(e.target.value) - - }} - > - - - - -
+ + + + + - ))} - -
KeyValueActions
-
-
- - { - setAddValue({ ...addValue, value: e.target.value }); - }} - > - + + + + ) : ( + <> + + + + )} +
+ + + ))} + + +
+ + {/* Add new value */} +
+ + + + setAddValue({ ...addValue, value: e.target.value }) + } + /> + - +
+ +
+ + + +
); }; -export default ManageValues; +export default ManageValues; \ No newline at end of file