From c7a50dd74d12c5d3d1937909d0ee57a78e0382dd Mon Sep 17 00:00:00 2001 From: zjkal Date: Thu, 20 Nov 2025 05:38:37 +0800 Subject: [PATCH] fix: Fix issue where the Add System button is visible to read-only users (#1442) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除按钮的hidden类并提前检查只读用户状态返回null --- internal/site/src/components/add-system.tsx | 45 +++++++++++---------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/internal/site/src/components/add-system.tsx b/internal/site/src/components/add-system.tsx index 02241b72..9139dd94 100644 --- a/internal/site/src/components/add-system.tsx +++ b/internal/site/src/components/add-system.tsx @@ -36,28 +36,31 @@ import { AppleIcon, DockerIcon, FreeBsdIcon, TuxIcon, WindowsIcon } from "./ui/i import { InputCopy } from "./ui/input-copy" export function AddSystemButton({ className }: { className?: string }) { - const [open, setOpen] = useState(false) - const opened = useRef(false) - if (open) { - opened.current = true - } + if (isReadOnlyUser()) { + return null + } + const [open, setOpen] = useState(false) + const opened = useRef(false) + if (open) { + opened.current = true + } - return ( - - - - - {opened.current && } - - ) + return ( + + + + + {opened.current && } + + ) } /**