teamMembers.tsx 860 B

1234567891011121314151617181920212223242526272829303132333435
  1. import AsyncComponent from 'sentry/components/asyncComponent';
  2. import AvatarList from 'sentry/components/avatar/avatarList';
  3. import {Member} from 'sentry/types';
  4. type Props = AsyncComponent['props'] & {
  5. orgId: string;
  6. teamId: string;
  7. };
  8. type State = AsyncComponent['state'] & {
  9. members?: Member[];
  10. };
  11. class TeamMembers extends AsyncComponent<Props, State> {
  12. getEndpoints(): ReturnType<AsyncComponent['getEndpoints']> {
  13. const {orgId, teamId} = this.props;
  14. return [['members', `/teams/${orgId}/${teamId}/members/`]];
  15. }
  16. renderLoading() {
  17. return this.renderBody();
  18. }
  19. renderBody(): React.ReactNode {
  20. const {members} = this.state;
  21. if (!members) {
  22. return null;
  23. }
  24. const users = members.filter(({user}) => !!user).map(({user}) => user);
  25. return <AvatarList users={users} />;
  26. }
  27. }
  28. export default TeamMembers;