|
@@ -1,31 +1,44 @@
|
|
|
import React from 'react';
|
|
|
import {Flex} from 'grid-emotion';
|
|
|
import styled from 'react-emotion';
|
|
|
+import PropTypes from 'prop-types';
|
|
|
|
|
|
import {t} from 'app/locale';
|
|
|
import Button from 'app/components/button';
|
|
|
+import PageHeading from 'app/components/pageHeading';
|
|
|
import Tooltip from 'app/components/tooltip';
|
|
|
import SentryTypes from 'app/sentryTypes';
|
|
|
-import img from '../../../images/dashboard/hair-on-fire.svg';
|
|
|
+import space from 'app/styles/space';
|
|
|
+/* TODO: replace with I/O when finished */
|
|
|
+import img from '../../images/dashboard/hair-on-fire.svg';
|
|
|
|
|
|
-export default class EmptyState extends React.Component {
|
|
|
+export default class NoProjectMessage extends React.Component {
|
|
|
static propTypes = {
|
|
|
+ /* if the user has access to any projects, we show whatever
|
|
|
+ children are included. Otherwise we show the message */
|
|
|
+ children: PropTypes.node,
|
|
|
organization: SentryTypes.Organization,
|
|
|
+ className: PropTypes.string,
|
|
|
};
|
|
|
|
|
|
render() {
|
|
|
- const {organization} = this.props;
|
|
|
+ const {children, organization, className} = this.props;
|
|
|
const orgId = organization.slug;
|
|
|
const canCreateProject = organization.access.includes('project:write');
|
|
|
const canJoinTeam = organization.access.includes('team:read');
|
|
|
+ const hasProjects = organization.projects.some(p => p.isMember && p.hasAccess);
|
|
|
|
|
|
- return (
|
|
|
- <Flex flex="1" align="center" justify="center">
|
|
|
+ return hasProjects ? (
|
|
|
+ children
|
|
|
+ ) : (
|
|
|
+ <Flex flex="1" align="center" justify="center" className={className}>
|
|
|
<Wrapper>
|
|
|
<img src={img} height={350} alt="Nothing to see" />
|
|
|
<Content direction="column" justify="center">
|
|
|
- <h2>{t('Remain calm.')}</h2>
|
|
|
- <p>{t("Sentry's got you covered. To get started:")}</p>
|
|
|
+ <StyledPageHeading>{t('Remain Calm')}</StyledPageHeading>
|
|
|
+ <HelpMessage>
|
|
|
+ {t('You need at least one project to use this view')}
|
|
|
+ </HelpMessage>
|
|
|
<Flex align="center">
|
|
|
<CallToAction>
|
|
|
<Tooltip
|
|
@@ -63,6 +76,11 @@ export default class EmptyState extends React.Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const StyledPageHeading = styled(PageHeading)`
|
|
|
+ font-size: 28px;
|
|
|
+ margin-bottom: ${space(1.5)};
|
|
|
+`;
|
|
|
+
|
|
|
const CallToAction = styled('div')`
|
|
|
margin-right: 8px;
|
|
|
&:last-child {
|
|
@@ -70,6 +88,10 @@ const CallToAction = styled('div')`
|
|
|
}
|
|
|
`;
|
|
|
|
|
|
+const HelpMessage = styled('div')`
|
|
|
+ margin-bottom: ${space(2)};
|
|
|
+`;
|
|
|
+
|
|
|
const Wrapper = styled(Flex)`
|
|
|
height: 350px;
|
|
|
`;
|