From e5bb81ef275d7a588e2636b6d5aa58776c91a9d6 Mon Sep 17 00:00:00 2001 From: nguyentrungthat <80239428+nguentrungthat@users.noreply.github.com> Date: Mon, 24 Nov 2025 10:09:52 +0700 Subject: [PATCH] Refactor BottomToolBar expand state handling Moved the expand state management for BottomToolBar from internal state to props, allowing parent components to control its expanded state. Also commented out an unused conditional in DrawerControl. --- FRONTEND/src/App.tsx | 1 + FRONTEND/src/components/BottomToolBar.tsx | 5 +++-- FRONTEND/src/components/DrawerControl.tsx | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/FRONTEND/src/App.tsx b/FRONTEND/src/App.tsx index c850703..75c02da 100644 --- a/FRONTEND/src/App.tsx +++ b/FRONTEND/src/App.tsx @@ -510,6 +510,7 @@ function App() { setExpanded={setExpandedBottomBar} activeTabBottom={activeTabBottom} setActiveTabBottom={setActiveTabBottom} + isExpand={expandedBottomBar} /> diff --git a/FRONTEND/src/components/BottomToolBar.tsx b/FRONTEND/src/components/BottomToolBar.tsx index 6ad49ed..91a3178 100644 --- a/FRONTEND/src/components/BottomToolBar.tsx +++ b/FRONTEND/src/components/BottomToolBar.tsx @@ -37,6 +37,7 @@ interface TabsProps { setExpanded: (value: React.SetStateAction) => void; activeTabBottom: string; setActiveTabBottom: (value: React.SetStateAction) => void; + isExpand: boolean; } const BottomToolBar = ({ @@ -54,6 +55,7 @@ const BottomToolBar = ({ setExpanded, setActiveTabBottom, activeTabBottom, + isExpand, }: TabsProps) => { const user = useMemo(() => { return localStorage.getItem("user") && @@ -63,7 +65,7 @@ const BottomToolBar = ({ }, []); const [valueInput, setValueInput] = useState(""); // const [activeTabBottom, setActiveTabBottom] = useState("command"); - const [isExpand, setIsExpand] = useState(true); + // const [isExpand, setIsExpand] = useState(true); return ( { - setIsExpand((prev) => !prev); setExpanded((prev) => !prev); }} > diff --git a/FRONTEND/src/components/DrawerControl.tsx b/FRONTEND/src/components/DrawerControl.tsx index 4454065..4b46e30 100644 --- a/FRONTEND/src/components/DrawerControl.tsx +++ b/FRONTEND/src/components/DrawerControl.tsx @@ -778,7 +778,7 @@ export const DrawerSwitchControl: React.FC = ({ const isOddA = numA % 2 !== 0; const isOddB = numB % 2 !== 0; - if (numA / 48 > 1) return 0; + // if (numA / 48 > 1) return 0; // Ưu tiên số lẻ lên trước if (isOddA && !isOddB) return -1;