Skip to content

Commit

Permalink
feat: add change owner button
Browse files Browse the repository at this point in the history
  • Loading branch information
IanFonzie committed Apr 5, 2024
1 parent d0b56b3 commit b522851
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/front-end/typescript/lib/pages/organization/edit/tab/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { userAvatarPath } from "front-end/lib/pages/user/lib";
import Capabilities, { Capability } from "front-end/lib/views/capabilities";
import Icon from "front-end/lib/views/icon";
import Link, {
Props as LinkProps,
iconLinkSymbol,
imageLinkSymbol,
leftPlacement
Expand Down Expand Up @@ -875,7 +876,8 @@ export const component: Tab.Component<State, Msg> = {
}
},
getActions: ({ state, dispatch }) => {
if (!isVendor(state.viewerUser) && !isAdmin(state.viewerUser)) {
const viewerIsAdmin = isAdmin(state.viewerUser);
if (!isVendor(state.viewerUser) && !viewerIsAdmin) {
return component_.page.actions.none();
}
const isAddTeamMembersLoading = state.addTeamMembersLoading > 0;
Expand All @@ -890,7 +892,22 @@ export const component: Tab.Component<State, Msg> = {
disabled: isLoading,
symbol_: leftPlacement(iconLinkSymbol("user-plus")),
color: "primary"
}
},
...(viewerIsAdmin
? [
{
children: "Change Owner",
onClick: () =>
dispatch(adt("showModal", adt("changeOwner")) as Msg),
button: true,
outline: true,
loading: isAddTeamMembersLoading,
disabled: isLoading,
symbol_: leftPlacement(iconLinkSymbol("user-edit")),
color: "c-nav-fg-alt"
} as LinkProps
]
: [])
]);
}
};

0 comments on commit b522851

Please sign in to comment.