createProjectButton.tsx 818 B

123456789101112131415161718192021222324252627
  1. import {LinkButton} from 'sentry/components/button';
  2. import {canCreateProject} from 'sentry/components/projects/canCreateProject';
  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 canUserCreateProject = canCreateProject(organization);
  9. return (
  10. <LinkButton
  11. priority="primary"
  12. size="sm"
  13. disabled={!canUserCreateProject}
  14. title={
  15. !canUserCreateProject
  16. ? t('You do not have permission to create projects')
  17. : undefined
  18. }
  19. to={`/organizations/${organization.slug}/projects/new/`}
  20. icon={<IconAdd isCircled />}
  21. >
  22. {t('Create Project')}
  23. </LinkButton>
  24. );
  25. }