* init members page for platform * add missing icon * add members tab to sidebar * use data from useMe query instead of useSession * return user profiles since platform users are stored there * small refactor * fixup * remove unused logs from console * fixup * resolve merge conflicts * add missing tabs for members and billing * update schema * fixup * memoise selection options for org and platform * update onSubmit handler * resolve merge conflicts * add members tab * improve team billing view when user not subscribed * update members tab * add function to find if user is admin of team * update invite members handler to handle platform user as well --------- Co-authored-by: Morgan <[email protected]>
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import type { PlatformOAuthClient } from "@calcom/prisma/client";
|
|
import {
|
|
Button,
|
|
Dropdown,
|
|
DropdownMenuTrigger,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownItem,
|
|
} from "@calcom/ui";
|
|
|
|
type OAuthClientsDropdownProps = {
|
|
oauthClients: PlatformOAuthClient[];
|
|
initialClientName: string;
|
|
handleChange: (clientId: string, clientName: string) => void;
|
|
};
|
|
|
|
export const OAuthClientsDropdown = ({
|
|
oauthClients,
|
|
initialClientName,
|
|
handleChange,
|
|
}: OAuthClientsDropdownProps) => {
|
|
return (
|
|
<div>
|
|
{Array.isArray(oauthClients) && oauthClients.length > 0 ? (
|
|
<Dropdown modal={false}>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button color="secondary" EndIcon="chevron-down">
|
|
{initialClientName}
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent>
|
|
{oauthClients.map((client) => {
|
|
return (
|
|
<div key={client.id}>
|
|
{initialClientName !== client.name ? (
|
|
<DropdownMenuItem className="outline-none">
|
|
<DropdownItem type="button" onClick={() => handleChange(client.id, client.name)}>
|
|
{client.name}
|
|
</DropdownItem>
|
|
</DropdownMenuItem>
|
|
) : (
|
|
<></>
|
|
)}
|
|
</div>
|
|
);
|
|
})}
|
|
</DropdownMenuContent>
|
|
</Dropdown>
|
|
) : null}
|
|
</div>
|
|
);
|
|
};
|