chore: address feedback

This commit is contained in:
Scott Wilson
2025-11-28 11:49:19 -08:00
parent 83b8c9f14a
commit a62305550b
@@ -82,15 +82,20 @@ import { ProjectLinkIdentityModal } from "./components/ProjectLinkIdentityModal"
const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2; const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
enum AddIdentityType {
CreateNew,
AssignExisting
}
export const IdentityTab = withProjectPermission( export const IdentityTab = withProjectPermission(
() => { () => {
const { currentProject, projectId } = useProject(); const { currentProject, projectId } = useProject();
const navigate = useNavigate(); const navigate = useNavigate();
const { isSubOrganization, currentOrg } = useOrganization(); const { isSubOrganization, currentOrg } = useOrganization();
const [addMachineIdentityType, setAddMachineIdentityType] = useState< const [addMachineIdentityType, setAddMachineIdentityType] = useState<AddIdentityType>(
"create-new" | "assign-existing" AddIdentityType.CreateNew
>("create-new"); );
const { const {
offset, offset,
@@ -517,26 +522,30 @@ export const IdentityTab = withProjectPermission(
<Button <Button
variant="outline_bg" variant="outline_bg"
onClick={() => { onClick={() => {
setAddMachineIdentityType("create-new"); setAddMachineIdentityType(AddIdentityType.CreateNew);
}} }}
size="xs" size="xs"
className={`${ className={twMerge(
addMachineIdentityType === "create-new" ? "bg-mineshaft-500" : "bg-transparent" "min-w-[2.4rem] flex-1 rounded border-none hover:bg-mineshaft-600",
} min-w-[2.4rem] flex-1 rounded border-none hover:bg-mineshaft-600`} addMachineIdentityType === AddIdentityType.CreateNew
? "bg-mineshaft-500"
: "bg-transparent"
)}
> >
Create New Create New
</Button> </Button>
<Button <Button
variant="outline_bg" variant="outline_bg"
onClick={() => { onClick={() => {
setAddMachineIdentityType("assign-existing"); setAddMachineIdentityType(AddIdentityType.AssignExisting);
}} }}
size="xs" size="xs"
className={`${ className={twMerge(
addMachineIdentityType === "assign-existing" "min-w-[2.4rem] flex-1 rounded border-none hover:bg-mineshaft-600",
addMachineIdentityType === AddIdentityType.AssignExisting
? "bg-mineshaft-500" ? "bg-mineshaft-500"
: "bg-transparent" : "bg-transparent"
} min-w-[2.4rem] flex-1 rounded border-none hover:bg-mineshaft-600`} )}
> >
Assign Existing Assign Existing
</Button> </Button>
@@ -574,14 +583,14 @@ export const IdentityTab = withProjectPermission(
<InfoIcon size={16} className="text-mineshaft-400" /> <InfoIcon size={16} className="text-mineshaft-400" />
</Tooltip> </Tooltip>
</div> </div>
{addMachineIdentityType === "create-new" && ( {addMachineIdentityType === AddIdentityType.CreateNew && (
<ProjectIdentityModal <ProjectIdentityModal
onClose={() => { onClose={() => {
handlePopUpClose("createIdentity"); handlePopUpClose("createIdentity");
}} }}
/> />
)} )}
{addMachineIdentityType === "assign-existing" && ( {addMachineIdentityType === AddIdentityType.AssignExisting && (
<ProjectLinkIdentityModal handlePopUpToggle={handlePopUpToggle} /> <ProjectLinkIdentityModal handlePopUpToggle={handlePopUpToggle} />
)} )}
</ModalContent> </ModalContent>