Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(js): Convert PerformanceContainer to a FC #30628

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 13 additions & 18 deletions static/app/views/performance/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import {Component} from 'react';

import Feature from 'sentry/components/acl/feature';
import Alert from 'sentry/components/alert';
import {t} from 'sentry/locale';
Expand All @@ -11,31 +9,28 @@ import {MetricsSwitchContextContainer} from './metricsSwitch';

type Props = {
organization: Organization;
children: React.ReactChildren;
};

class PerformanceContainer extends Component<Props> {
renderNoAccess() {
function PerformanceContainer({organization, children}: Props) {
function renderNoAccess() {
return (
<PageContent>
<Alert type="warning">{t("You don't have access to this feature")}</Alert>
</PageContent>
);
}

render() {
const {organization, children} = this.props;

return (
<Feature
hookName="feature-disabled:performance-page"
features={['performance-view']}
organization={organization}
renderDisabled={this.renderNoAccess}
>
<MetricsSwitchContextContainer>{children}</MetricsSwitchContextContainer>
</Feature>
);
}
return (
<Feature
hookName="feature-disabled:performance-page"
features={['performance-view']}
organization={organization}
renderDisabled={renderNoAccess}
>
<MetricsSwitchContextContainer>{children}</MetricsSwitchContextContainer>
</Feature>
);
}

export default withOrganization(PerformanceContainer);