import React, { Fragment, ReactElement } from "react"; import { observer } from "mobx-react-lite"; import { Tab } from "@headlessui/react"; // hooks import { useApplication, useProject, useUser } from "hooks/store"; // layouts import { AppLayout } from "layouts/app-layout"; // components import { CustomAnalytics, ScopeAndDemand } from "components/analytics"; import { WorkspaceAnalyticsHeader } from "components/headers"; import { NewEmptyState } from "components/common/new-empty-state"; // icons import { Plus } from "lucide-react"; // assets import emptyAnalytics from "public/empty-state/empty_analytics.webp"; // constants import { ANALYTICS_TABS } from "constants/analytics"; import { EUserWorkspaceRoles } from "constants/workspace"; // type import { NextPageWithLayout } from "lib/types"; const AnalyticsPage: NextPageWithLayout = observer(() => { // store hooks const { commandPalette: { toggleCreateProjectModal }, eventTracker: { setTrackElement }, } = useApplication(); const { membership: { currentProjectRole }, } = useUser(); const { workspaceProjectIds } = useProject(); const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER; return ( <> {workspaceProjectIds && workspaceProjectIds.length > 0 ? (
{ANALYTICS_TABS.map((tab) => ( `rounded-3xl border border-custom-border-200 px-4 py-2 text-xs hover:bg-custom-background-80 ${ selected ? "bg-custom-background-80" : "" }` } onClick={() => {}} > {tab.title} ))}
) : ( <> , text: "Create Cycles and Modules first", onClick: () => { setTrackElement("ANALYTICS_EMPTY_STATE"); toggleCreateProjectModal(true); }, }} disabled={!isEditingAllowed} /> )} ); }); AnalyticsPage.getLayout = function getLayout(page: ReactElement) { return }>{page}; }; export default AnalyticsPage;