aboutsummaryrefslogtreecommitdiff
path: root/src/app/(main)/teams/TeamsHeader.tsx
blob: 579ba5957106d2ec8fe7212768766fddc9fc4911 (plain) (blame)
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
import { Row } from '@umami/react-zen';
import { PageHeader } from '@/components/common/PageHeader';
import { useLoginQuery, useMessages } from '@/components/hooks';
import { ROLES } from '@/lib/constants';
import { TeamsAddButton } from './TeamsAddButton';
import { TeamsJoinButton } from './TeamsJoinButton';

export function TeamsHeader({
  allowCreate = true,
  allowJoin = true,
}: {
  allowCreate?: boolean;
  allowJoin?: boolean;
}) {
  const { formatMessage, labels } = useMessages();
  const { user } = useLoginQuery();

  return (
    <PageHeader title={formatMessage(labels.teams)}>
      <Row gap="3">
        {allowJoin && <TeamsJoinButton />}
        {allowCreate && user.role !== ROLES.viewOnly && <TeamsAddButton />}
      </Row>
    </PageHeader>
  );
}