import {Fragment} from 'react';
import type {RouteComponentProps} from 'react-router';
import type {Client} from 'sentry/api';
import ErrorBoundary from 'sentry/components/errorBoundary';
import NotFound from 'sentry/components/errors/notFound';
import LoadingIndicator from 'sentry/components/loadingIndicator';
import type {Organization} from 'sentry/types';
import withApi from 'sentry/utils/withApi';
import withOrganization from 'sentry/utils/withOrganization';
import DashboardDetail from './detail';
import OrgDashboards from './orgDashboards';
import {DashboardState} from './types';
import {DashboardBasicFeature} from './view';
type Props = RouteComponentProps<{}, {}> & {
api: Client;
children: React.ReactNode;
organization: Organization;
};
function DashboardsV2Container(props: Props) {
const {organization, api, location, children} = props;
if (organization.features.includes('dashboards-edit')) {
return {children};
}
const params = {...props.params, orgId: organization.slug};
return (
{({dashboard, dashboards, error, onDashboardUpdate}) => {
return error ? (
) : dashboard ? (
) : (
);
}}
);
}
export default withApi(withOrganization(DashboardsV2Container));