File size: 1,298 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// @flow
import React from 'react';
import type { GetCommunityType } from 'shared/graphql/queries/community/getCommunity';
import { Emoji, Heading, Description, PrivateCommunityWrapper } from '../style';
import { ViewGrid, CenteredGrid } from 'src/components/layout';

type Props = {
  community: GetCommunityType,
};

export const PrivateCommunity = (props: Props) => {
  const { community } = props;
  const { communityPermissions } = community;
  const { isPending } = communityPermissions;

  const heading = isPending
    ? 'Your request to join is pending'
    : 'This community is private';

  const description = isPending
    ? 'Your request to join this community is pending. The owners have been notified, and you will be notified if your request is approved.'
    : 'You can request to join this community below. The owners will be notified of your request, and you will be notified if your request is approved.';

  return (
    <ViewGrid data-cy="community-view-private">
      <CenteredGrid>
        <PrivateCommunityWrapper>
          <Emoji role="img" aria-label="Private">
            🔑
          </Emoji>
          <Heading>{heading}</Heading>
          <Description>{description}</Description>
        </PrivateCommunityWrapper>
      </CenteredGrid>
    </ViewGrid>
  );
};