createProjectButton.tsx 802 B

12345678910111213141516171819202122232425
  1. import {Button} from 'sentry/components/button';
  2. import {useProjectCreationAccess} from 'sentry/components/projects/useProjectCreationAccess';
  3. import {IconAdd} from 'sentry/icons';
  4. import {t} from 'sentry/locale';
  5. import useOrganization from 'sentry/utils/useOrganization';
  6. export default function CreateProjectButton() {
  7. const organization = useOrganization();
  8. const {canCreateProject} = useProjectCreationAccess({organization});
  9. return (
  10. <Button
  11. priority="primary"
  12. size="sm"
  13. disabled={!canCreateProject}
  14. title={
  15. !canCreateProject ? t('You do not have permission to create projects') : undefined
  16. }
  17. to={`/organizations/${organization.slug}/projects/new/`}
  18. icon={<IconAdd isCircled />}
  19. >
  20. {t('Create Project')}
  21. </Button>
  22. );
  23. }