import React, { Fragment, ReactElement } from "react"; import { observer } from "mobx-react-lite"; import { Tab } from "@headlessui/react"; import { useTheme } from "next-themes"; // hooks import { useApplication, useEventTracker, 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 { EmptyState, getEmptyStateImagePath } from "components/empty-state"; // constants import { ANALYTICS_TABS } from "constants/analytics"; import { EUserWorkspaceRoles } from "constants/workspace"; // type import { NextPageWithLayout } from "lib/types"; const AnalyticsPage: NextPageWithLayout = observer(() => { // theme const { resolvedTheme } = useTheme(); // store hooks const { commandPalette: { toggleCreateProjectModal }, } = useApplication(); const { setTrackElement } = useEventTracker(); const { membership: { currentWorkspaceRole }, currentUser, } = useUser(); const { workspaceProjectIds } = useProject(); const isLightMode = resolvedTheme ? resolvedTheme === "light" : currentUser?.theme.theme === "light"; const EmptyStateImagePath = getEmptyStateImagePath("onboarding", "analytics", isLightMode); const isEditingAllowed = !!currentWorkspaceRole && currentWorkspaceRole >= 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} ))}
) : ( { setTrackElement("Analytics empty state"); toggleCreateProjectModal(true); }, }} comicBox={{ title: "Analytics works best with Cycles + Modules", description: "First, timebox your issues into Cycles and, if you can, group issues that span more than a cycle into Modules. Check out both on the left nav.", }} size="lg" disabled={!isEditingAllowed} /> )} ); }); AnalyticsPage.getLayout = function getLayout(page: ReactElement) { return }>{page}; }; export default AnalyticsPage;