misc: moved prompt to tooltip

This commit is contained in:
Sheen Capadngan
2025-05-28 16:33:14 +08:00
parent 90c17820fc
commit f2dcbfa91c
@@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod"; import { z } from "zod";
import { createNotification } from "@app/components/notifications"; import { createNotification } from "@app/components/notifications";
import { Button, Checkbox, Modal, ModalContent } from "@app/components/v2"; import { Button, Checkbox, Modal, ModalContent, Tooltip } from "@app/components/v2";
import { useOrgPermission } from "@app/context"; import { useOrgPermission } from "@app/context";
import { useUpgradePrivilegeSystem } from "@app/hooks/api"; import { useUpgradePrivilegeSystem } from "@app/hooks/api";
@@ -262,15 +262,6 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
</div> </div>
</div> </div>
</div> </div>
{!isAdmin && (
<div className="mb-2 text-sm text-red-500">
You cannot perform this upgrade because you are not an organization admin.
<br />
(Your current role:{" "}
<span className="font-semibold">{membership?.role ?? "Unknown"}</span>)
</div>
)}
<form onSubmit={handleSubmit(handlePrivilegeSystemUpgrade)}> <form onSubmit={handleSubmit(handlePrivilegeSystemUpgrade)}>
<div className="mt-6 flex items-center justify-end gap-4"> <div className="mt-6 flex items-center justify-end gap-4">
<button <button
@@ -280,6 +271,14 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
> >
Cancel Cancel
</button> </button>
<Tooltip
content={
!isAdmin
? `You cannot perform this upgrade because you are not an organization admin. (Your current role: ${membership?.role ?? "Unknown"})`
: undefined
}
>
<div>
<Button <Button
type="submit" type="submit"
variant="solid" variant="solid"
@@ -292,6 +291,8 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
Upgrade Upgrade
</Button> </Button>
</div> </div>
</Tooltip>
</div>
</form> </form>
</div> </div>
)} )}