fix: Fix issue where the Add System button is visible to read-only users (#1442)

移除按钮的hidden类并提前检查只读用户状态返回null
This commit is contained in:
zjkal
2025-11-20 05:38:37 +08:00
committed by GitHub
parent 00fbf5c9c3
commit c7a50dd74d

View File

@@ -36,6 +36,9 @@ import { AppleIcon, DockerIcon, FreeBsdIcon, TuxIcon, WindowsIcon } from "./ui/i
import { InputCopy } from "./ui/input-copy" import { InputCopy } from "./ui/input-copy"
export function AddSystemButton({ className }: { className?: string }) { export function AddSystemButton({ className }: { className?: string }) {
if (isReadOnlyUser()) {
return null
}
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
const opened = useRef(false) const opened = useRef(false)
if (open) { if (open) {
@@ -47,7 +50,7 @@ export function AddSystemButton({ className }: { className?: string }) {
<DialogTrigger asChild> <DialogTrigger asChild>
<Button <Button
variant="outline" variant="outline"
className={cn("flex gap-1 max-xs:h-[2.4rem]", className, isReadOnlyUser() && "hidden")} className={cn("flex gap-1 max-xs:h-[2.4rem]", className)}
> >
<PlusIcon className="h-4 w-4 -ms-1" /> <PlusIcon className="h-4 w-4 -ms-1" />
<Trans> <Trans>